Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-zeller committed Oct 14, 2023
1 parent fec8c33 commit 05d337c
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions notebooks/PythonFuzzer.ipynb
Expand Up @@ -3071,6 +3071,8 @@
"outputs": [],
"source": [
"def evolve(population, min_fitness=-1):\n",
" solver = ISLaSolver(ast_grammar)\n",
"\n",
" for (candidate, _) in list(population):\n",
" for i in range(OFFSPRING):\n",
" child = solver.mutate(candidate, min_mutations=1, max_mutations=1)\n",
Expand All @@ -3087,44 +3089,59 @@
"metadata": {},
"outputs": [],
"source": [
"sum_population = evolve(sum_population)"
"sum_population = evolve(sum_population)\n",
"len(sum_population)"
]
},
{
"cell_type": "markdown",
"id": "b6bb6154",
"metadata": {},
"source": [
"As we can evolve all these, too, we get an exponential growth."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a68abb9f",
"id": "fc81b599",
"metadata": {},
"outputs": [],
"source": [
"sum_population = evolve(sum_population)\n",
"len(sum_population)"
]
},
{
"cell_type": "markdown",
"id": "b6bb6154",
"cell_type": "code",
"execution_count": null,
"id": "a375f82b",
"metadata": {},
"outputs": [],
"source": [
"As we can evolve all these, too, we get an exponential growth."
"sum_population = evolve(sum_population)\n",
"len(sum_population)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fc81b599",
"id": "d7f570d3",
"metadata": {},
"outputs": [],
"source": [
"sum_population = evolve(sum_population)"
"sum_population = evolve(sum_population)\n",
"len(sum_population)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b8d38f9e",
"id": "d0e4ce29",
"metadata": {},
"outputs": [],
"source": [
"sum_population = evolve(sum_population)\n",
"len(sum_population)"
]
},
Expand Down Expand Up @@ -3190,16 +3207,7 @@
"metadata": {},
"outputs": [],
"source": [
"sum_population = select(sum_population)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "17ee109e",
"metadata": {},
"outputs": [],
"source": [
"sum_population = select(sum_population)\n",
"len(sum_population)"
]
},
Expand Down Expand Up @@ -3261,9 +3269,20 @@
" prev_best_fitness = best_fitness\n",
"\n",
" if has_distributive_law(best_ast):\n",
" print(\"Done!\")\n",
" break"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6790b028",
"metadata": {},
"outputs": [],
"source": [
"print(ast.unparse(best_ast))"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -3279,7 +3298,7 @@
"id": "8a712034",
"metadata": {},
"source": [
"Success! We found a piece of code that triggers the bug. Check out for occurrences of the distributive law."
"Success! We found a piece of code that triggers the bug. Check for occurrences of the distributive law."
]
},
{
Expand Down

0 comments on commit 05d337c

Please sign in to comment.