Merge branch 'master' of s444425/AI into master

This commit is contained in:
Tomasz Lech 2020-06-08 20:44:19 +00:00 committed by Gogs
commit 45c67cb8e6
17 changed files with 274 additions and 206 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

View File

@ -1,8 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="BookmarkManager">
<bookmark url="file://$PROJECT_DIR$/genetyczne.py" line="21" mnemonic="9" />
</component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="8264ee8d-5217-4cb6-b982-78f67fabc82e" name="Default Changelist" comment=""> <list default="true" id="8264ee8d-5217-4cb6-b982-78f67fabc82e" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/funkcje.py" beforeDir="false" afterPath="$PROJECT_DIR$/funkcje.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/genetyczne.py" beforeDir="false" afterPath="$PROJECT_DIR$/genetyczne.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/program.py" beforeDir="false" afterPath="$PROJECT_DIR$/program.py" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -15,11 +22,61 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/funkcje.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1547">
<caret line="91" column="9" selection-start-line="91" selection-start-column="9" selection-end-line="91" selection-end-column="9" />
<folding>
<element signature="e#0#43#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/shelf.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/genetyczne.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="16" column="7" selection-start-line="16" selection-start-column="7" selection-end-line="16" selection-end-column="7" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="625">
<caret line="46" column="11" selection-start-line="46" selection-start-column="11" selection-end-line="46" selection-end-column="11" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/AStar.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="741">
<caret line="81" column="31" selection-start-line="81" selection-start-column="31" selection-end-line="81" selection-end-column="31" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/program.py"> <entry file="file://$PROJECT_DIR$/program.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34"> <state relative-caret-position="452">
<caret line="20" selection-start-line="20" selection-end-line="20" /> <caret line="96" column="52" lean-forward="true" selection-start-line="96" selection-start-column="52" selection-end-line="96" selection-end-column="52" />
<folding> <folding>
<element signature="e#0#13#0" expanded="true" /> <element signature="e#0#13#0" expanded="true" />
</folding> </folding>
@ -28,34 +85,10 @@
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/KijowskiM.md"> <entry file="file://$PROJECT_DIR$/Data.py">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="1241">
<caret line="73" column="64" selection-start-line="73" selection-start-column="64" selection-end-line="73" selection-end-column="64" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/funkcje.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3026"> <state relative-caret-position="289">
<caret line="183" selection-start-line="183" selection-end-line="183" /> <caret line="17" column="27" selection-start-line="17" selection-start-column="27" selection-end-line="17" selection-end-column="27" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/genetyczne.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="169">
<caret line="32" column="13" selection-start-line="32" selection-start-column="13" selection-end-line="32" selection-end-column="13" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -71,13 +104,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>tmp</find>
<find>global</find>
<find>cop</find>
<find>jakLiczycKoszt</find>
<find>jakLiczyc</find>
<find>eve</find>
<find>doW</find>
<find>self</find> <find>self</find>
<find>gen</find> <find>gen</find>
<find>data.geny</find> <find>data.geny</find>
@ -101,6 +127,13 @@
<find>muta</find> <find>muta</find>
<find>mutate</find> <find>mutate</find>
<find>od tego mom</find> <find>od tego mom</find>
<find>regalsik</find>
<find>podajDwaChromosomy</find>
<find>generuj</find>
<find>populacjaF</find>
<find>rys</find>
<find>data</find>
<find>populacjaFitness</find>
</findStrings> </findStrings>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
@ -126,7 +159,6 @@
<option value="$PROJECT_DIR$/genetyczny/randomBox.py" /> <option value="$PROJECT_DIR$/genetyczny/randomBox.py" />
<option value="$PROJECT_DIR$/AStar.py" /> <option value="$PROJECT_DIR$/AStar.py" />
<option value="$PROJECT_DIR$/genetyczny/Gene1.py" /> <option value="$PROJECT_DIR$/genetyczny/Gene1.py" />
<option value="$PROJECT_DIR$/main.py" />
<option value="$PROJECT_DIR$/genetyczny/genetyczny.py" /> <option value="$PROJECT_DIR$/genetyczny/genetyczny.py" />
<option value="$PROJECT_DIR$/Mapa/generate.py" /> <option value="$PROJECT_DIR$/Mapa/generate.py" />
<option value="$PROJECT_DIR$/genetyczny/Gene.py" /> <option value="$PROJECT_DIR$/genetyczny/Gene.py" />
@ -135,18 +167,19 @@
<option value="$PROJECT_DIR$/genetyczny/eee.py" /> <option value="$PROJECT_DIR$/genetyczny/eee.py" />
<option value="$PROJECT_DIR$/genetyczny/genetyczne.py" /> <option value="$PROJECT_DIR$/genetyczny/genetyczne.py" />
<option value="$PROJECT_DIR$/opis/environment.md" /> <option value="$PROJECT_DIR$/opis/environment.md" />
<option value="$PROJECT_DIR$/program.py" />
<option value="$PROJECT_DIR$/funkcje.py" />
<option value="$PROJECT_DIR$/genetyczne.py" />
<option value="$PROJECT_DIR$/LechT.md" /> <option value="$PROJECT_DIR$/LechT.md" />
<option value="$PROJECT_DIR$/funkcje.py" />
<option value="$PROJECT_DIR$/program.py" />
<option value="$PROJECT_DIR$/genetyczne.py" />
<option value="$PROJECT_DIR$/main.py" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="643" /> <option name="x" value="2493" />
<option name="y" value="-8" /> <option name="y" value="-8" />
<option name="width" value="758" /> <option name="width" value="1078" />
<option name="height" value="1048" /> <option name="height" value="838" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectReloadState"> <component name="ProjectReloadState">
@ -196,7 +229,7 @@
</option> </option>
</component> </component>
<component name="RunManager" selected="Python.main"> <component name="RunManager" selected="Python.main">
<configuration name="AStar" type="PythonConfigurationType" factoryName="Python" temporary="true"> <configuration name="funkcje" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="AI" /> <module name="AI" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
@ -208,7 +241,7 @@
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/AStar.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/funkcje.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
@ -217,7 +250,7 @@
<option name="INPUT_FILE" value="" /> <option name="INPUT_FILE" value="" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="generate" type="PythonConfigurationType" factoryName="Python" temporary="true"> <configuration name="genetyczne" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="AI" /> <module name="AI" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
@ -229,7 +262,7 @@
<option name="IS_MODULE_SDK" value="true" /> <option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SCRIPT_NAME" value="C:\Users\zwyklak\Desktop\AI\generate.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/genetyczne.py" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="EMULATE_TERMINAL" value="false" />
@ -303,11 +336,11 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Python.neurons" />
<item itemvalue="Python.main" /> <item itemvalue="Python.main" />
<item itemvalue="Python.genetyczne" />
<item itemvalue="Python.funkcje" />
<item itemvalue="Python.neurons" />
<item itemvalue="Python.julian" /> <item itemvalue="Python.julian" />
<item itemvalue="Python.generate" />
<item itemvalue="Python.AStar" />
</list> </list>
</recent_temporary> </recent_temporary>
</component> </component>
@ -337,18 +370,18 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-7" y="-7" width="1550" height="838" extended-state="6" /> <frame x="1912" y="-8" width="1616" height="1176" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.4995206" visible="true" weight="0.35167786" /> <window_info content_ui="combo" id="Project" order="0" sideWeight="0.4995206" visible="true" weight="0.2114396" />
<window_info id="Structure" order="1" sideWeight="0.5004794" side_tool="true" weight="0.3382353" /> <window_info id="Structure" order="1" sideWeight="0.5004794" side_tool="true" weight="0.3382353" />
<window_info id="Favorites" order="2" sideWeight="0.5011338" side_tool="true" weight="0.27768165" /> <window_info id="Favorites" order="2" sideWeight="0.5011338" side_tool="true" weight="0.27768165" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32640332" /> <window_info anchor="bottom" id="Find" order="1" weight="0.32598275" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49932885" visible="true" weight="0.21104816" /> <window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.49932885" visible="true" weight="0.21093" />
<window_info anchor="bottom" id="Cvs" order="3" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="3" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="4" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="4" weight="0.4" />
<window_info anchor="bottom" x="1942" y="641" width="1156" height="277" id="Debug" order="5" sideWeight="0.49932885" weight="0.41302842" /> <window_info anchor="bottom" x="1942" y="641" width="1156" height="277" id="Debug" order="5" sideWeight="0.49932885" weight="0.4122723" />
<window_info anchor="bottom" id="TODO" order="6" weight="0.32848233" /> <window_info anchor="bottom" id="TODO" order="6" weight="0.32848233" />
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32848233" /> <window_info anchor="bottom" id="Version Control" order="7" weight="0.32848233" />
<window_info anchor="bottom" id="Terminal" order="8" weight="0.32848233" /> <window_info anchor="bottom" id="Terminal" order="8" weight="0.32848233" />
@ -387,8 +420,8 @@
<breakpoints> <breakpoints>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/genetyczne.py</url> <url>file://$PROJECT_DIR$/genetyczne.py</url>
<line>94</line> <line>26</line>
<option name="timeStamp" value="231" /> <option name="timeStamp" value="10" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>
<default-breakpoints> <default-breakpoints>
@ -440,16 +473,6 @@
<entry file="file://$PROJECT_DIR$/images/nip.png"> <entry file="file://$PROJECT_DIR$/images/nip.png">
<provider selected="true" editor-type-id="images" /> <provider selected="true" editor-type-id="images" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/wheel.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="459">
<caret line="31" column="28" selection-start-line="31" selection-start-column="28" selection-end-line="31" selection-end-column="28" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/floor.py"> <entry file="file://$PROJECT_DIR$/floor.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153"> <state relative-caret-position="153">
@ -457,16 +480,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/neurons.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="595">
<caret line="35" column="9" selection-start-line="35" selection-start-column="9" selection-end-line="35" selection-end-column="9" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python37/Lib/site-packages/easygui/boxes/fileopen_box.py"> <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python37/Lib/site-packages/easygui/boxes/fileopen_box.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="459"> <state relative-caret-position="459">
@ -474,16 +487,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/whereDecision.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1054">
<caret line="62" selection-start-line="62" selection-end-line="62" />
<folding>
<element signature="e#0#19#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python37/Lib/random.py"> <entry file="file://$USER_HOME$/AppData/Local/Programs/Python/Python37/Lib/random.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="366"> <state relative-caret-position="366">
@ -491,16 +494,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Evencik.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/generate.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1383">
<caret line="179" lean-forward="true" selection-start-line="179" selection-end-line="179" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/wall.py"> <entry file="file://$PROJECT_DIR$/wall.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187"> <state relative-caret-position="187">
@ -539,20 +532,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Data.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="17" column="27" selection-start-line="17" selection-start-column="27" selection-end-line="17" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/shelf.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-46">
<caret line="2" column="11" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/route-planning.md"> <entry file="file://$PROJECT_DIR$/route-planning.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
@ -566,9 +545,7 @@
<entry file="file://$USER_HOME$/Downloads/Untitled Diagram.xml"> <entry file="file://$USER_HOME$/Downloads/Untitled Diagram.xml">
<provider selected="true" editor-type-id="text-editor" /> <provider selected="true" editor-type-id="text-editor" />
</entry> </entry>
<entry file="file://$PROJECT_DIR$/images/dzialanieAlgorytmu.png"> <entry file="file://$PROJECT_DIR$/images/dzialanieAlgorytmu.png" />
<provider selected="true" editor-type-id="images" />
</entry>
<entry file="file://$PROJECT_DIR$/Gene.py"> <entry file="file://$PROJECT_DIR$/Gene.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="136">
@ -601,36 +578,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="544">
<caret line="42" selection-start-line="42" selection-end-line="42" />
<folding>
<element signature="e#0#21#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/AStar.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="22" column="46" selection-start-line="22" selection-start-column="46" selection-end-line="22" selection-end-column="46" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/program.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="34">
<caret line="20" selection-start-line="20" selection-end-line="20" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/KijowskiM.md"> <entry file="file://$PROJECT_DIR$/KijowskiM.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
@ -641,17 +588,94 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/generate.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3094">
<caret line="182" selection-start-line="182" selection-end-line="182" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/neurons.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="221">
<caret line="16" selection-start-line="16" selection-end-line="16" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Evencik.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/whereDecision.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="15" selection-start-line="1" selection-start-column="7" selection-end-line="1" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Data.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="289">
<caret line="17" column="27" selection-start-line="17" selection-start-column="27" selection-end-line="17" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/shelf.py">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/wheel.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="684">
<caret line="58" column="55" selection-start-line="58" selection-start-column="55" selection-end-line="58" selection-end-column="55" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/AStar.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="741">
<caret line="81" column="31" selection-start-line="81" selection-start-column="31" selection-end-line="81" selection-end-column="31" />
<folding>
<element signature="e#0#12#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/funkcje.py"> <entry file="file://$PROJECT_DIR$/funkcje.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3026"> <state relative-caret-position="1547">
<caret line="183" selection-start-line="183" selection-end-line="183" /> <caret line="91" column="9" selection-start-line="91" selection-start-column="9" selection-end-line="91" selection-end-column="9" />
<folding>
<element signature="e#0#43#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/program.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="452">
<caret line="96" column="52" lean-forward="true" selection-start-line="96" selection-start-column="52" selection-end-line="96" selection-end-column="52" />
<folding>
<element signature="e#0#13#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/genetyczne.py"> <entry file="file://$PROJECT_DIR$/genetyczne.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="169"> <state relative-caret-position="255">
<caret line="32" column="13" selection-start-line="32" selection-start-column="13" selection-end-line="32" selection-end-column="13" /> <caret line="16" column="7" selection-start-line="16" selection-start-column="7" selection-end-line="16" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="625">
<caret line="46" column="11" selection-start-line="46" selection-start-column="11" selection-end-line="46" selection-end-column="11" />
<folding> <folding>
<element signature="e#0#21#0" expanded="true" /> <element signature="e#0#21#0" expanded="true" />
</folding> </folding>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -89,7 +89,7 @@ def rysujWykres(data, x, yStart, yEnd):
y = data.doWykresu[i] y = data.doWykresu[i]
x = i x = i
plt.scatter(x, y) plt.scatter(x, y)
plt.pause(0.0001) #plt.pause(0.0001)
plt.show() plt.show()
@ -187,38 +187,46 @@ def updateMap(data, map, mapForAstar, regals):
def okno(): def okno():
good = True try:
fieldValues = multenterbox("Wprowadź warunki początkowe", "Start algorytmu genetycznego", ["Ile chrom. w generacji", "Wielkosc dziedziczonego fragmentu (x>0 and x<1)", "Wartosc mutacji (x>0 and x<1)", "Unbox: (0or 1 or 2 or 2)", "Ile generacji"]) good = True
if(fieldValues[0].isnumeric() and (fieldValues[0]!="")): fieldValues = multenterbox("Wprowadź warunki początkowe", "Start algorytmu genetycznego", ["Ile chrom. w generacji", "Wielkosc dziedziczonego fragmentu (x>0 and x<1)", "Wartosc mutacji (x>0 and x<1)", "Gdzie odwieść paczkę: (0 or 1 or 2 or 3)", "Ile generacji"])
if(fieldValues[0] == None):
return 0
if(not(fieldValues[0].isnumeric() and (fieldValues[0]!=""))):
good = False
msgbox("Wartość nie jest liczbą", "Błąd")
if(isinstance(float(fieldValues[1]),float) and (fieldValues[1]!="")):
if((float(fieldValues[1])<=0) and (good==True) and (float(fieldValues[1])>= 1)):
msgbox("Zla wartosc fragmentu")
good = False
elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd")
good = False good = False
elif(good==True):
msgbox("Wartość nie jest liczbą", "Błąd") if(isinstance(float(fieldValues[2]),float) and (fieldValues[2]!="")):
good = False if((float(fieldValues[1])<=0) and (good==True) and (float(fieldValues[1])>= 1)):
if(fieldValues[1].isnumeric() and (fieldValues[1]!="")): msgbox("Zla wartosc mutacji")
if((int(fieldValues[1])<=0) and (good==True) and (int(fieldValues[1])>= 1)): good = False
msgbox("Zla wartosc fragmentu") elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd")
good = False good = False
elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd") if(fieldValues[3].isnumeric() and (fieldValues[3]!="")):
good = False if(((int(fieldValues[3]) != 0) and (int(fieldValues[3]) != 1) and (int(fieldValues[3]) != 2) and (int(fieldValues[3]) != 3))):
if(fieldValues[2].isnumeric() and (fieldValues[2]!="")): msgbox("Zla wartosc unboxa")
if((int(fieldValues[1])<=0) and (good==True) and (int(fieldValues[1])>= 1)): good = False
msgbox("Zla wartosc mutacji") elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd")
good = False good = False
elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd") if(not(fieldValues[4].isnumeric() and (fieldValues[4]!=""))):
good = False msgbox("Wartość nie jest liczbą", "Błąd")
if(fieldValues[3].isnumeric() and (fieldValues[3]!="")):
if(((int(fieldValues[3]) != 0) or (int(fieldValues[3]) != 1) or (int(fieldValues[3]) != 2) or (int(fieldValues[3]) != 3)) and (good==True)):
msgbox("Zla wartosc unboxa")
good = False good = False
elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd") if(good == True):
good = False return [fieldValues[0], fieldValues[1], fieldValues[2],fieldValues[3], fieldValues[4]]
if(fieldValues[4].isnumeric() and (fieldValues[4]!="")):
pass except:
else: return 0
msgbox("Wartość nie jest liczbą", "Błąd")
good = False
if(good == True):
return [fieldValues[0], fieldValues[1], fieldValues[2],fieldValues[3]]

View File

@ -1,25 +1,32 @@
from funkcje import * from funkcje import *
from Gene import Gene from Gene import Gene
def start(data, wheel): def start(data, wheel, dane):
ileGeneracji = 20 ileGeneracji = int(dane[4])
ileWPopulacji = int(dane[0])
fragment = float(dane[1])
mutacja = float(dane[2])
unbox = int(dane[3])
"""
ileGeneracji = 1000
ileWPopulacji = 16 ileWPopulacji = 16
fragment = 0.5 fragment = 0.5
mutacja = 0.05 mutacja = 0.05
unbox = 3 unbox = 3
"""
data.kordyWozka = (wheel.ns, wheel.we) data.kordyWozka = (wheel.ns, wheel.we)
data.jakLiczycKoszt = unbox data.jakLiczycKoszt = unbox
randomPopulation = genRandomPopulation(data, ileWPopulacji) randomPopulation = genRandomPopulation(data, ileWPopulacji)
for i in range(ileGeneracji): for i in range(ileGeneracji):
if i == 0: if i == 0:
best2 = dwieNajlepsze(randomPopulation, data) populacjaFitness = fitnessDlaPopulacji(randomPopulation, data)
else: else:
x = genPopulacje(data,best2[0], best2[1], ileWPopulacji, fragment, mutacja) #chrom2 = podajDwaChromosomy(populacjaFitness[0], populacjaFitness[1])
best2 = dwieNajlepsze(x, data) x = genPopulacje(data,populacjaFitness[0], populacjaFitness[1], ileWPopulacji, fragment, mutacja)
del x populacjaFitness = fitnessDlaPopulacji(x, data)
#del x
data.histZmian.append(data.best[1]) data.histZmian.append(data.best[1])
@ -61,6 +68,21 @@ def genRandomPopulation(data, ileWPopulacji):
populacja.append(genRandomChromosome(data)) populacja.append(genRandomChromosome(data))
return populacja return populacja
def podajDwaChromosomy(populacja, chromFitness):
bestValue = min(chromFitness)
bestChromIndex = chromFitness.index(bestValue)
chrom1 = populacja[bestChromIndex]
populacja.pop(bestChromIndex)
chromFitness.pop(bestChromIndex)
bestValue = min(chromFitness)
bestChromIndex = chromFitness.index(bestValue)
chrom2 = populacja[bestChromIndex]
populacja.pop(bestChromIndex)
chromFitness.pop(bestChromIndex)
return (chrom1, chrom2)
def fitness(chromosome, data): def fitness(chromosome, data):
koszt = 0 koszt = 0
@ -87,7 +109,7 @@ def fitness(chromosome, data):
return koszt return koszt
def dwieNajlepsze(populacja, data): def fitnessDlaPopulacji(populacja, data):
tmpPopulacja = populacja[:] tmpPopulacja = populacja[:]
chromFitness = [] chromFitness = []
@ -102,7 +124,7 @@ def dwieNajlepsze(populacja, data):
elif(data.best[1] > bestValue): elif(data.best[1] > bestValue):
data.best = (pierwsza[:],bestValue) data.best = (pierwsza[:],bestValue)
data.doWykresu.append(bestValue) data.doWykresu.append(bestValue)
"""
tmpPopulacja.pop(bestChromIndex) tmpPopulacja.pop(bestChromIndex)
chromFitness.pop(bestChromIndex) chromFitness.pop(bestChromIndex)
@ -111,9 +133,9 @@ def dwieNajlepsze(populacja, data):
druga = tmpPopulacja[bestChromIndex] druga = tmpPopulacja[bestChromIndex]
tmpPopulacja.pop(bestChromIndex) tmpPopulacja.pop(bestChromIndex)
chromFitness.pop(bestChromIndex) chromFitness.pop(bestChromIndex)
"""
return (tmpPopulacja, chromFitness)
return (pierwsza, druga)
def crossover(data,pierwszy, drugi, fragmentLiczba, wspMutacji): def crossover(data,pierwszy, drugi, fragmentLiczba, wspMutacji):
ileWChrom = len(pierwszy) ileWChrom = len(pierwszy)
@ -158,15 +180,17 @@ def crossover(data,pierwszy, drugi, fragmentLiczba, wspMutacji):
return nowyChrom return nowyChrom
def genPopulacje(data,pierwszy, drugi, ileWPopulacji, fragmentLiczba, wspMutacji): def genPopulacje(data,populacja, chromFitness, ileWPopulacji, fragmentLiczba, wspMutacji):
ileWChrom = len(pierwszy) ileWChrom = len(populacja[0])
fragment = round(fragmentLiczba*ileWChrom) fragment = round(fragmentLiczba*ileWChrom)
if(fragment == 1): if(fragment == 1):
fragment +=1 fragment +=1
nowaPopulacja = [] nowaPopulacja = []
for i in range(ileWPopulacji): for i,index in enumerate(range(ileWPopulacji)):
nowaPopulacja.append(crossover(data,pierwszy,drugi,fragment, wspMutacji)) if index % 2 == 0:
dwaChrom = podajDwaChromosomy(populacja,chromFitness)
nowaPopulacja.append(crossover(data,dwaChrom[0],dwaChrom[1],fragment, wspMutacji))
return nowaPopulacja return nowaPopulacja

23
main.py
View File

@ -3,10 +3,11 @@ from program import MainWindow
import os; import os;
def main(): def main():
good = False good = False
while (True): while (True):
good = True good = True
"""
fieldValues = multenterbox("Wprowadź warunki początkowe", "Start programu", ["Szerekość kraty (>=6)", "Wysokość kraty (>=7)", "Ilość regałów kruchych", "Ilość regałów łatwopalnych", "Ilość regałów radioaktywnych", "Ilość regałów niebezpiecznych"]) fieldValues = multenterbox("Wprowadź warunki początkowe", "Start programu", ["Szerekość kraty (>=6)", "Wysokość kraty (>=7)", "Ilość regałów kruchych", "Ilość regałów łatwopalnych", "Ilość regałów radioaktywnych", "Ilość regałów niebezpiecznych"])
if(fieldValues[0].isnumeric() and (fieldValues[0]!="")): if(fieldValues[0].isnumeric() and (fieldValues[0]!="")):
if(int(fieldValues[0])<=5): if(int(fieldValues[0])<=5):
@ -31,14 +32,18 @@ def main():
elif (good == True): elif (good == True):
msgbox("Wartość nie jest liczbą", "Błąd") msgbox("Wartość nie jest liczbą", "Błąd")
good = False good = False
"""
if good: if good:
szerokosc = 15#min 6 window = MainWindow(int(fieldValues[0]), int(fieldValues[1]), int(fieldValues[2]), int(fieldValues[3]), int(fieldValues[4]), int(fieldValues[5]));
wysokosc = 10 #min 7
kruche = 1
latwopalne = 1
radioaktywne = 1
niebezpieczne= 1
window = MainWindow(szerokosc, wysokosc, kruche, latwopalne, radioaktywne, niebezpieczne);
break break
"""
szerokosc = 15#min 6
wysokosc = 10 #min 7
kruche = 1
latwopalne = 1
radioaktywne = 1
niebezpieczne= 1
window = MainWindow(szerokosc, wysokosc, kruche, latwopalne, radioaktywne, niebezpieczne);
"""
main() main()

View File

@ -88,7 +88,13 @@ class MainWindow:
elif(event.type==pygame.KEYDOWN): elif(event.type==pygame.KEYDOWN):
if event.key == pygame.K_g: if event.key == pygame.K_g:
start(self.data,self.wheel) updateMap(self.data, self.map, self.mapForAStar, self.regals)
dane = okno()
if(dane == 0):
continue
start(self.data,self.wheel, dane)
for gen in self.data.best[0]: for gen in self.data.best[0]:
if(gen.unboxWczesniejszegoGenu == None): if(gen.unboxWczesniejszegoGenu == None):
kordStartowy = (self.wheel.ns, self.wheel.we) kordStartowy = (self.wheel.ns, self.wheel.we)
@ -97,7 +103,7 @@ class MainWindow:
zbierzBox(gen,self.data, self.moves, kordStartowy) zbierzBox(gen,self.data, self.moves, kordStartowy)
elif(event.key== pygame.K_r): elif(event.key== pygame.K_r):
self.map = randomBox(self.map, self.regals, 15) self.map = randomBox(self.map, self.regals, 20)
updateMap(self.data, self.map, self.mapForAStar, self.regals) updateMap(self.data, self.map, self.mapForAStar, self.regals)
elif len(self.moves)==0: elif len(self.moves)==0:
self.wheel.move(event, self.map) self.wheel.move(event, self.map)