gp-experiment/AnalysisOfExperiment.ipynb

316 lines
12 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Warning: `setindex!(df::DataFrame, v::AbstractVector, col_ind::ColumnIndex)` is deprecated, use `begin\n",
"│ df[!, col_ind] = v\n",
"│ df\n",
"│ end` instead.\n",
"│ caller = top-level scope at Experiment.jl:25 [inlined]\n",
"└ @ Core /home/jake/project/beef-o-bradys-state-space-search/Experiment.jl:25\n"
]
},
{
"data": {
"text/plain": [
"main (generic function with 1 method)"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"include(\"Experiment.jl\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"POPSIZE = 6\n",
"mu = 2\n",
"lambda = 4\n",
"TARGETCALORIES = 2500\n",
"CANDIDATESIZE = 4"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Warning: `getindex(df::DataFrame, col_ind::ColumnIndex)` is deprecated, use `df[!, col_ind]` instead.\n",
"│ caller = fitness(::DataFrames.DataFrame) at Experiment.jl:67\n",
"└ @ Main /home/jake/project/beef-o-bradys-state-space-search/Experiment.jl:67\n"
]
},
{
"data": {
"text/plain": [
"Dict{Integer,Float64} with 11 entries:\n",
" 2 => 20.0\n",
" 11 => 20.0\n",
" 7 => 20.0\n",
" 9 => 20.0\n",
" 10 => 20.0\n",
" 8 => 20.0\n",
" 6 => 20.0\n",
" 4 => 20.0\n",
" 3 => 20.0\n",
" 5 => 20.0\n",
" 1 => 50.0"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"main(10)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"OrderedCollections.OrderedDict{Integer,Float64} with 21 entries:\n",
" 1 => 150.0\n",
" 2 => 150.0\n",
" 3 => 150.0\n",
" 4 => 10.0\n",
" 5 => 10.0\n",
" 6 => 10.0\n",
" 7 => 10.0\n",
" 8 => 10.0\n",
" 9 => 10.0\n",
" 10 => 10.0\n",
" 11 => 10.0\n",
" 12 => 10.0\n",
" 13 => 10.0\n",
" 14 => 0.0\n",
" 15 => 0.0\n",
" 16 => 0.0\n",
" 17 => 0.0\n",
" 18 => 0.0\n",
" 19 => 0.0\n",
" 20 => 0.0\n",
" 21 => 0.0"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using Plots\n",
"res = main(20)\n",
"res = sort(res)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Results\n",
"Shown by tweaking the parameters of popsize, mu, lambda, targetcalories, and candidatesize.\n",
"\n",
"## Gadfly\n",
"Julia plotting library based on Grammar of Graphics."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
"<defs>\n",
" <clipPath id=\"clip2900\">\n",
" <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polygon clip-path=\"url(#clip2900)\" points=\"\n",
"0,1600 2400,1600 2400,0 0,0 \n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip2901\">\n",
" <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polygon clip-path=\"url(#clip2900)\" points=\"\n",
"167.279,1487.47 2352.76,1487.47 2352.76,47.2441 167.279,47.2441 \n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip2902\">\n",
" <rect x=\"167\" y=\"47\" width=\"2186\" height=\"1441\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 641.486,1487.47 641.486,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1156.93,1487.47 1156.93,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1672.37,1487.47 1672.37,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 2187.81,1487.47 2187.81,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 167.279,1446.71 2352.76,1446.71 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 167.279,993.811 2352.76,993.811 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 167.279,540.908 2352.76,540.908 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 167.279,88.0053 2352.76,88.0053 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 167.279,1487.47 2352.76,1487.47 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 167.279,1487.47 167.279,47.2441 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 641.486,1487.47 641.486,1465.87 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1156.93,1487.47 1156.93,1465.87 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1672.37,1487.47 1672.37,1465.87 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 2187.81,1487.47 2187.81,1465.87 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 167.279,1446.71 200.061,1446.71 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 167.279,993.811 200.061,993.811 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 167.279,540.908 200.061,540.908 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 167.279,88.0053 200.061,88.0053 \n",
" \"/>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 641.486, 1541.47)\" x=\"641.486\" y=\"1541.47\">5</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1156.93, 1541.47)\" x=\"1156.93\" y=\"1541.47\">10</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 1672.37, 1541.47)\" x=\"1672.37\" y=\"1541.47\">15</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:middle;\" transform=\"rotate(0, 2187.81, 1541.47)\" x=\"2187.81\" y=\"1541.47\">20</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 143.279, 1464.21)\" x=\"143.279\" y=\"1464.21\">0</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 143.279, 1011.31)\" x=\"143.279\" y=\"1011.31\">50</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 143.279, 558.408)\" x=\"143.279\" y=\"558.408\">100</text>\n",
"</g>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:end;\" transform=\"rotate(0, 143.279, 105.505)\" x=\"143.279\" y=\"105.505\">150</text>\n",
"</g>\n",
"<polyline clip-path=\"url(#clip2902)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 229.132,88.0053 332.221,88.0053 435.309,88.0053 538.398,1356.13 641.486,1356.13 744.575,1356.13 847.663,1356.13 950.752,1356.13 1053.84,1356.13 1156.93,1356.13 \n",
" 1260.02,1356.13 1363.11,1356.13 1466.19,1356.13 1569.28,1446.71 1672.37,1446.71 1775.46,1446.71 1878.55,1446.71 1981.64,1446.71 2084.73,1446.71 2187.81,1446.71 \n",
" 2290.9,1446.71 \n",
" \"/>\n",
"<polygon clip-path=\"url(#clip2900)\" points=\"\n",
"1989.93,251.724 2280.76,251.724 2280.76,130.764 1989.93,130.764 \n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1989.93,251.724 2280.76,251.724 2280.76,130.764 1989.93,130.764 1989.93,251.724 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip2900)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 2013.93,191.244 2157.93,191.244 \n",
" \"/>\n",
"<g clip-path=\"url(#clip2900)\">\n",
"<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:48px; text-anchor:start;\" transform=\"rotate(0, 2181.93, 208.744)\" x=\"2181.93\" y=\"208.744\">y1</text>\n",
"</g>\n",
"</svg>\n"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"plot(collect(keys(res)), collect(values(res)))\n",
"xlabel!()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.0.3",
"language": "julia",
"name": "julia-1.0"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.0.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}