Compare commits
18 Commits
master
...
drzewa_Szy
Author | SHA1 | Date | |
---|---|---|---|
3a6d0b9465 | |||
f9505a932a | |||
cf7bb6590d | |||
77f8acbdd8 | |||
81977d051f | |||
e5ad6c7ab2 | |||
bf2253580d | |||
4917bd457d | |||
95df84c69e | |||
2388576cc1 | |||
85eefa0954 | |||
fd5f23258b | |||
d99f57ce41 | |||
92b10ab523 | |||
e1336ab5c9 | |||
70908a51ba | |||
1dbb64001f | |||
115670987d |
187
Raport- drzewa decyzyjne.md
Normal file
187
Raport- drzewa decyzyjne.md
Normal file
@ -0,0 +1,187 @@
|
||||
# Podprojekt indywidualny - Szymon Parafiński
|
||||
---
|
||||
W folderze Sklearn znajduje się wykorzystana baza, wygenerowane drzewo oraz reszta plików związana z podprojektem.
|
||||
|
||||
## Wykorzystana metoda uczenia
|
||||
|
||||
Do realizacji podprojektu wykorzystano drzewa decyzyjne do decydowania, co należy zrobić po najechaniu na konkretne pole.
|
||||
Drzewo decyduje na jakim etapie jest roślina analizując poszczególne stany danego pola:
|
||||
- Dopiero co zasiana (kiełek)
|
||||
- 0: "Nie_podejmuj_działania"
|
||||
- Roślinka kiełkująca (młoda)
|
||||
- 1: "Zastosuj_nawóz"
|
||||
- Roślina starzejąca się, bez środka ochrony
|
||||
- 2: "Zastosuj_środek"
|
||||
- Roślinka dojrzałam gotowa do zbioru
|
||||
- 4: "Zbierz"
|
||||
- Roślina zepsuta, nie nadaje się do użytku
|
||||
- 5: "Roślina_już_zgniła-zbierz_i_wyrzuć".
|
||||
|
||||
Do implementacji drzew decyzyjnych w Pythonie wykorzystane zostały biblioteki
|
||||
**sklearn** , **pandas**,**sys** oraz **pickle**.
|
||||
|
||||
## Uczenie modelu
|
||||
|
||||
#### loadLearningBase(): [python]
|
||||
Metoda **loadLearningBase** rozpoczyna od utworzenia zbioru uczącego na podstawie tabeli zawierającej informacje wszystkich możliwych stanach roślinki.
|
||||
|
||||
* *col_names* -> zawiera nagłówki poszczególnych kolumn
|
||||
* *feature_cols* -> zawiera nagłówki z kolumnami w których znajdują się dane do analizy
|
||||
```
|
||||
col_names = ['Warzywo', 'Nawoz', 'Srodek', 'Stan', 'Dzialanie']
|
||||
base = pd.read_csv("Database.csv", header=None, names=col_names)
|
||||
feature_cols = ['Warzywo', 'Nawoz', 'Srodek', 'Stan']
|
||||
""" print dataset"""
|
||||
# print(base.head())
|
||||
```
|
||||
Tutaj dzielimy podane kolumny na dwa typy zmiennych:
|
||||
* zmienne docelowe ---> y
|
||||
* i zmienne funkcyjne ---> X
|
||||
|
||||
Aby móc sprawdzić wydajność modelu, dzielę zestaw danych na zestaw szkoleniowy i zestaw testowy ---> za pomocą funkcji train_test_split ().
|
||||
|
||||
```
|
||||
X = base[feature_cols] # Features
|
||||
y = base.Dzialanie # Target variable
|
||||
|
||||
# Split dataset into training set and test set
|
||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,
|
||||
random_state=1) # 70% training and 30% test
|
||||
```
|
||||
Wywołanie funkcji odpowiedzialnej za wygenerowanie drzewa.
|
||||
```
|
||||
data = generateDecisionTree(X_train, X_test, y_train, y_test)
|
||||
```
|
||||
Dodatkowe elementy pozwalające na wizualizację stworzonego drzewa decyzyjnego poprzez wygenerowanie drzewa zależności if/else lub najpierw do pliku .dot, który następnie poddany odpowiedniej 'obróbce' utworzy obraz.
|
||||
```
|
||||
"""generate data for image"""
|
||||
# tree.export_graphviz(data, out_file='treeData.dot', filled=True, rounded=True, special_characters=True,
|
||||
# feature_names=feature_cols)
|
||||
|
||||
"""Printing if_styled tree to console"""
|
||||
# tree_to_code(data, feature_cols)
|
||||
|
||||
return data
|
||||
```
|
||||
---
|
||||
#### generateDecisionTree(): [python]
|
||||
Metoda **generateDecisionTree** generuje drzewo decyzyjne na podstawie dostarczonej bazy danych.
|
||||
|
||||
Do zmiennej *clf* zapisujemy drzewo decyzyjne z biblioteki **sklearn** utworzone za pomocą metody **DecisionTreeClassifier** z parametrem **criterion** ustawionym na **"entropy"**, który pozwala na uzyskiwanie informacji.
|
||||
Na drzewie wywołujemy metodę **fit**, która dopasowuje do drzewa zbiór uczący zadany w tablicach **X_train** i **y_train**.
|
||||
Po dopasowaniu danych możemy przewidzieć stan nowych przykładów, co robimy wywołując na drzewie metodę **predict** z parametrami, które zawierają informację o stanie danego pola.
|
||||
```
|
||||
def generateDecisionTree(X_train, X_test, y_train, y_test):
|
||||
# Create Decision Tree classifer object
|
||||
clf = DecisionTreeClassifier(criterion="entropy")
|
||||
|
||||
# Train Decision Tree Classifer
|
||||
clf = clf.fit(X_train, y_train)
|
||||
```
|
||||
Aby ocenić dokładność naszego modelu przewidujemy odpowiedzi dla naszego zestawu testowego, aby móc go porównać z zestawem y_test i otrzymać dokładność wygenerowanego modelu.
|
||||
```
|
||||
# Predict the response for test dataset
|
||||
y_pred = clf.predict(X_test)
|
||||
|
||||
"""Model Accuracy, how often is the classifier correct """
|
||||
# print("Accuracy:", metrics.accuracy_score(y_test, y_pred))
|
||||
```
|
||||
---
|
||||
#### main(): [python]
|
||||
Metoda main wywołuje pozostałe metody oraz zapisuje wygenerowany model do pliku .sav aby nie było trzeba ponownie generować drzewa, tylko wczytać już te wygenerowane.
|
||||
```
|
||||
generated = loadLearningBase()
|
||||
|
||||
# Save generated tree
|
||||
filename = 'decisionTree.sav'
|
||||
pickle.dump(generated, open(filename, 'wb'))
|
||||
```
|
||||
|
||||
## Implementacja w projekcie całościowym
|
||||
|
||||
Klasa wywoływana w **C++** nazywa się *injectCode*.
|
||||
Działanie polega na tym że, funkcja **stanPola** sprawdza jakie wartości ma dane pole i generuje odpowiednie polecenie do wykonania.
|
||||
#### stanPola(): [C++]
|
||||
|
||||
```
|
||||
void stanPola(int x, int y) {
|
||||
//[x][x][0] = 0 - brak chemii
|
||||
//[x][x][0] = 1 - tylko nawóz
|
||||
//[x][x][0] = 2 - tylko środek
|
||||
//[x][x][0] = 3 - środek i nawóz
|
||||
//[x][x][1] - wartość wzrostu rośliny
|
||||
|
||||
if (stan[x][y][0] == 0)
|
||||
polecenie.append("0 0 ");
|
||||
if (stan[x][y][0] == 1)
|
||||
polecenie.append("1 0 ");
|
||||
if (stan[x][y][0] == 2)
|
||||
polecenie.append("0 1 ");
|
||||
if (stan[x][y][0] == 3)
|
||||
polecenie.append("1 1 ");
|
||||
int w = (stan[x][y][1]);
|
||||
std::string s = std::to_string(w);
|
||||
polecenie.append(s);
|
||||
}
|
||||
```
|
||||
|
||||
Następnie funckja **decisionTree** wykonuje wygenerowane zapytanie.
|
||||
#### decisionTree(): [C++]
|
||||
|
||||
```
|
||||
void decisionTree(string polecenie) {
|
||||
|
||||
std::string str = polecenie;
|
||||
const char* c = str.c_str();
|
||||
system(c);
|
||||
}
|
||||
```
|
||||
#### injectCode(): [python]
|
||||
|
||||
```
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
|
||||
def prediction(warzywo, nawoz ,srodek, stan_wzrostu):
|
||||
filename = 'decisionTree.sav'
|
||||
tree = pickle.load(open(filename, 'rb'))
|
||||
val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]]))
|
||||
print(decision(val))
|
||||
|
||||
def decision(prediction):
|
||||
if prediction == 0:
|
||||
return "Nie_podejmuj_dzialania"
|
||||
elif prediction == 1:
|
||||
return "Zastosuj_nawoz"
|
||||
elif prediction == 2:
|
||||
return "Zastosuj_srodek"
|
||||
elif prediction == 4:
|
||||
return "Zbierz"
|
||||
elif prediction == 5:
|
||||
return "Roslina_juz_zgnila__zbierz_i_wyrzuc"
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Map command line arguments to function arguments.
|
||||
prediction(*sys.argv[1:])
|
||||
```
|
||||
Generowane polecenie wygląda w ten sposób:
|
||||
```
|
||||
python injectCode.py a b c d
|
||||
```
|
||||
Gdzie:
|
||||
* a -> rodzaj warzywa
|
||||
* 1: "burak"
|
||||
* b -> czy roślina była nawożona
|
||||
* 0: "nie"
|
||||
* 1: "tak"
|
||||
* c -> czy na roślinie był stosowany środek ochronny
|
||||
* 0: "nie"
|
||||
* 1: "tak"
|
||||
* d -> stan wzrostu w jakim znajduje się roślina
|
||||
* [1,20) - kiełek,
|
||||
* [20,45) - młoda roślina,
|
||||
* [45,85) - dojrzała,
|
||||
* [80,100] - starzejąca się.
|
8
Sklearn/.idea/Sklearn.iml
Normal file
8
Sklearn/.idea/Sklearn.iml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.8 (2)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
Sklearn/.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
Sklearn/.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
Sklearn/.idea/misc.xml
Normal file
4
Sklearn/.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (2)" project-jdk-type="Python SDK" />
|
||||
</project>
|
8
Sklearn/.idea/modules.xml
Normal file
8
Sklearn/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Sklearn.iml" filepath="$PROJECT_DIR$/.idea/Sklearn.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
136
Sklearn/.idea/workspace.xml
Normal file
136
Sklearn/.idea/workspace.xml
Normal file
@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e3fa4ad7-e8af-409f-b992-aa72ce556ebd" name="Default Changelist" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Python Script" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectId" id="1bp9AhDNNGUv3iYpuDmV1lNmkaN" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showExcludedFiles" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.load">
|
||||
<configuration name="Generate" type="PythonConfigurationType" factoryName="Python" temporary="true">
|
||||
<module name="Sklearn" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/Generate.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="load" type="PythonConfigurationType" factoryName="Python" temporary="true">
|
||||
<module name="Sklearn" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="C:\Users\Szymon\Desktop\Traktor_DrzewaDecyzyjne\Sklearn\Test.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Python.load" />
|
||||
<item itemvalue="Python.Generate" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="ServiceViewManager">
|
||||
<option name="viewStates">
|
||||
<list>
|
||||
<serviceView>
|
||||
<treeState>
|
||||
<expand />
|
||||
<select />
|
||||
</treeState>
|
||||
</serviceView>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="SvnConfiguration">
|
||||
<configuration />
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="e3fa4ad7-e8af-409f-b992-aa72ce556ebd" name="Default Changelist" comment="" />
|
||||
<created>1589318026471</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1589318026471</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="WindowStateProjectService">
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.bottom" timestamp="1589319874987">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.bottom/0.0.1676.902@0.0.1676.902" timestamp="1589319874987" />
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.center" timestamp="1589319874986">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.center/0.0.1676.902@0.0.1676.902" timestamp="1589319874986" />
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.left" timestamp="1589319874986">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.left/0.0.1676.902@0.0.1676.902" timestamp="1589319874986" />
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.right" timestamp="1589319874987">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state width="1654" height="236" key="GridCell.Tab.0.right/0.0.1676.902@0.0.1676.902" timestamp="1589319874987" />
|
||||
<state x="346" y="92" key="SettingsEditor" timestamp="1589318048454">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state x="346" y="92" key="SettingsEditor/0.0.1676.902@0.0.1676.902" timestamp="1589318048454" />
|
||||
<state x="537" y="273" key="com.intellij.ide.util.TipDialog" timestamp="1589328690450">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state x="537" y="273" key="com.intellij.ide.util.TipDialog/0.0.1676.902@0.0.1676.902" timestamp="1589328690450" />
|
||||
<state x="579" y="93" key="refactoring.ChangeSignatureDialog" timestamp="1589319743520">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state x="579" y="93" key="refactoring.ChangeSignatureDialog/0.0.1676.902@0.0.1676.902" timestamp="1589319743520" />
|
||||
<state x="500" y="190" width="672" height="678" key="search.everywhere.popup" timestamp="1589319325562">
|
||||
<screen x="0" y="0" width="1676" height="902" />
|
||||
</state>
|
||||
<state x="500" y="190" width="672" height="678" key="search.everywhere.popup/0.0.1676.902@0.0.1676.902" timestamp="1589319325562" />
|
||||
</component>
|
||||
</project>
|
415
Sklearn/Database.csv
Normal file
415
Sklearn/Database.csv
Normal file
@ -0,0 +1,415 @@
|
||||
1,0,0,1,0
|
||||
1,0,0,2,0
|
||||
1,0,0,3,0
|
||||
1,0,0,4,0
|
||||
1,0,0,5,0
|
||||
1,0,0,6,0
|
||||
1,0,0,7,0
|
||||
1,0,0,8,0
|
||||
1,0,0,9,0
|
||||
1,0,0,10,0
|
||||
|
||||
1,0,1,1,0
|
||||
1,0,1,2,0
|
||||
1,0,1,3,0
|
||||
1,0,1,4,0
|
||||
1,0,1,5,0
|
||||
1,0,1,6,0
|
||||
1,0,1,7,0
|
||||
1,0,1,8,0
|
||||
1,0,1,9,0
|
||||
1,0,1,10,0
|
||||
|
||||
1,1,0,1,0
|
||||
1,1,0,2,0
|
||||
1,1,0,3,0
|
||||
1,1,0,4,0
|
||||
1,1,0,5,0
|
||||
1,1,0,6,0
|
||||
1,1,0,7,0
|
||||
1,1,0,8,0
|
||||
1,1,0,9,0
|
||||
1,1,0,10,0
|
||||
|
||||
1,1,1,1,0
|
||||
1,1,1,2,0
|
||||
1,1,1,3,0
|
||||
1,1,1,4,0
|
||||
1,1,1,5,0
|
||||
1,1,1,6,0
|
||||
1,1,1,7,0
|
||||
1,1,1,8,0
|
||||
1,1,1,9,0
|
||||
1,1,1,10,0
|
||||
|
||||
1,0,0,11,1
|
||||
1,0,0,12,1
|
||||
1,0,0,13,1
|
||||
1,0,0,14,1
|
||||
1,0,0,15,1
|
||||
1,0,0,16,1
|
||||
1,0,0,17,1
|
||||
1,0,0,18,1
|
||||
1,0,0,19,1
|
||||
1,0,0,20,1
|
||||
1,0,0,21,1
|
||||
1,0,0,22,1
|
||||
1,0,0,23,1
|
||||
1,0,0,24,1
|
||||
1,0,0,25,1
|
||||
1,0,0,26,1
|
||||
1,0,0,27,1
|
||||
1,0,0,28,1
|
||||
1,0,0,29,1
|
||||
1,0,0,30,1
|
||||
1,0,0,31,1
|
||||
1,0,0,32,1
|
||||
1,0,0,33,1
|
||||
1,0,0,34,1
|
||||
1,0,0,35,1
|
||||
1,0,0,36,1
|
||||
1,0,0,37,1
|
||||
1,0,0,38,1
|
||||
1,0,0,39,1
|
||||
1,0,0,40,1
|
||||
|
||||
1,0,1,11,1
|
||||
1,0,1,12,1
|
||||
1,0,1,13,1
|
||||
1,0,1,14,1
|
||||
1,0,1,15,1
|
||||
1,0,1,16,1
|
||||
1,0,1,17,1
|
||||
1,0,1,18,1
|
||||
1,0,1,19,1
|
||||
1,0,1,20,1
|
||||
1,0,1,21,1
|
||||
1,0,1,22,1
|
||||
1,0,1,23,1
|
||||
1,0,1,24,1
|
||||
1,0,1,25,1
|
||||
1,0,1,26,1
|
||||
1,0,1,27,1
|
||||
1,0,1,28,1
|
||||
1,0,1,29,1
|
||||
1,0,1,30,1
|
||||
1,0,1,31,1
|
||||
1,0,1,32,1
|
||||
1,0,1,33,1
|
||||
1,0,1,34,1
|
||||
1,0,1,35,1
|
||||
1,0,1,36,1
|
||||
1,0,1,37,1
|
||||
1,0,1,38,1
|
||||
1,0,1,39,1
|
||||
1,0,1,40,1
|
||||
|
||||
1,1,0,11,0
|
||||
1,1,0,12,0
|
||||
1,1,0,13,0
|
||||
1,1,0,14,0
|
||||
1,1,0,15,0
|
||||
1,1,0,16,0
|
||||
1,1,0,17,0
|
||||
1,1,0,18,0
|
||||
1,1,0,19,0
|
||||
1,1,0,20,0
|
||||
1,1,0,21,0
|
||||
1,1,0,22,0
|
||||
1,1,0,23,0
|
||||
1,1,0,24,0
|
||||
1,1,0,25,0
|
||||
1,1,0,26,0
|
||||
1,1,0,27,0
|
||||
1,1,0,28,0
|
||||
1,1,0,29,0
|
||||
1,1,0,30,0
|
||||
1,1,0,31,0
|
||||
1,1,0,32,0
|
||||
1,1,0,33,0
|
||||
1,1,0,34,0
|
||||
1,1,0,35,0
|
||||
1,1,0,36,0
|
||||
1,1,0,37,0
|
||||
1,1,0,38,0
|
||||
1,1,0,39,0
|
||||
1,1,0,40,0
|
||||
|
||||
1,1,1,11,0
|
||||
1,1,1,12,0
|
||||
1,1,1,13,0
|
||||
1,1,1,14,0
|
||||
1,1,1,15,0
|
||||
1,1,1,16,0
|
||||
1,1,1,17,0
|
||||
1,1,1,18,0
|
||||
1,1,1,19,0
|
||||
1,1,1,20,0
|
||||
1,1,1,21,0
|
||||
1,1,1,22,0
|
||||
1,1,1,23,0
|
||||
1,1,1,24,0
|
||||
1,1,1,25,0
|
||||
1,1,1,26,0
|
||||
1,1,1,27,0
|
||||
1,1,1,28,0
|
||||
1,1,1,29,0
|
||||
1,1,1,30,0
|
||||
1,1,1,31,0
|
||||
1,1,1,32,0
|
||||
1,1,1,33,0
|
||||
1,1,1,34,0
|
||||
1,1,1,35,0
|
||||
1,1,1,36,0
|
||||
1,1,1,37,0
|
||||
1,1,1,38,0
|
||||
1,1,1,39,0
|
||||
1,1,1,40,0
|
||||
|
||||
1,0,0,41,4
|
||||
1,0,0,42,4
|
||||
1,0,0,43,4
|
||||
1,0,0,44,4
|
||||
1,0,0,45,4
|
||||
1,0,0,46,4
|
||||
1,0,0,47,4
|
||||
1,0,0,48,4
|
||||
1,0,0,49,4
|
||||
1,0,0,50,4
|
||||
1,0,0,51,4
|
||||
1,0,0,52,4
|
||||
1,0,0,53,4
|
||||
1,0,0,54,4
|
||||
1,0,0,55,4
|
||||
1,0,0,56,4
|
||||
1,0,0,57,4
|
||||
1,0,0,58,4
|
||||
1,0,0,59,4
|
||||
1,0,0,60,4
|
||||
1,0,0,61,4
|
||||
1,0,0,62,4
|
||||
1,0,0,63,4
|
||||
1,0,0,64,4
|
||||
1,0,0,65,4
|
||||
1,0,0,66,4
|
||||
1,0,0,67,4
|
||||
1,0,0,68,4
|
||||
1,0,0,69,4
|
||||
1,0,0,70,4
|
||||
1,0,0,71,4
|
||||
1,0,0,72,4
|
||||
1,0,0,73,4
|
||||
1,0,0,74,4
|
||||
1,0,0,75,4
|
||||
1,0,0,76,4
|
||||
1,0,0,77,4
|
||||
1,0,0,78,4
|
||||
1,0,0,79,4
|
||||
1,0,0,80,4
|
||||
|
||||
1,1,0,41,4
|
||||
1,1,0,42,4
|
||||
1,1,0,43,4
|
||||
1,1,0,44,4
|
||||
1,1,0,45,4
|
||||
1,1,0,46,4
|
||||
1,1,0,47,4
|
||||
1,1,0,48,4
|
||||
1,1,0,49,4
|
||||
1,1,0,50,4
|
||||
1,1,0,51,4
|
||||
1,1,0,52,4
|
||||
1,1,0,53,4
|
||||
1,1,0,54,4
|
||||
1,1,0,55,4
|
||||
1,1,0,56,4
|
||||
1,1,0,57,4
|
||||
1,1,0,58,4
|
||||
1,1,0,59,4
|
||||
1,1,0,60,4
|
||||
1,1,0,61,4
|
||||
1,1,0,62,4
|
||||
1,1,0,63,4
|
||||
1,1,0,64,4
|
||||
1,1,0,65,4
|
||||
1,1,0,66,4
|
||||
1,1,0,67,4
|
||||
1,1,0,68,4
|
||||
1,1,0,69,4
|
||||
1,1,0,70,4
|
||||
1,1,0,71,4
|
||||
1,1,0,72,4
|
||||
1,1,0,73,4
|
||||
1,1,0,74,4
|
||||
1,1,0,75,4
|
||||
1,1,0,76,4
|
||||
1,1,0,77,4
|
||||
1,1,0,78,4
|
||||
1,1,0,79,4
|
||||
1,1,0,80,4
|
||||
|
||||
1,0,1,41,4
|
||||
1,0,1,42,4
|
||||
1,0,1,43,4
|
||||
1,0,1,44,4
|
||||
1,0,1,45,4
|
||||
1,0,1,46,4
|
||||
1,0,1,47,4
|
||||
1,0,1,48,4
|
||||
1,0,1,49,4
|
||||
1,0,1,50,4
|
||||
1,0,1,51,4
|
||||
1,0,1,52,4
|
||||
1,0,1,53,4
|
||||
1,0,1,54,4
|
||||
1,0,1,55,4
|
||||
1,0,1,56,4
|
||||
1,0,1,57,4
|
||||
1,0,1,58,4
|
||||
1,0,1,59,4
|
||||
1,0,1,60,4
|
||||
1,0,1,61,4
|
||||
1,0,1,62,4
|
||||
1,0,1,63,4
|
||||
1,0,1,64,4
|
||||
1,0,1,65,4
|
||||
1,0,1,66,4
|
||||
1,0,1,67,4
|
||||
1,0,1,68,4
|
||||
1,0,1,69,4
|
||||
1,0,1,70,4
|
||||
1,0,1,71,4
|
||||
1,0,1,72,4
|
||||
1,0,1,73,4
|
||||
1,0,1,74,4
|
||||
1,0,1,75,4
|
||||
1,0,1,76,4
|
||||
1,0,1,77,4
|
||||
1,0,1,78,4
|
||||
1,0,1,79,4
|
||||
1,0,1,80,4
|
||||
|
||||
1,1,1,41,4
|
||||
1,1,1,42,4
|
||||
1,1,1,43,4
|
||||
1,1,1,44,4
|
||||
1,1,1,45,4
|
||||
1,1,1,46,4
|
||||
1,1,1,47,4
|
||||
1,1,1,48,4
|
||||
1,1,1,49,4
|
||||
1,1,1,50,4
|
||||
1,1,1,51,4
|
||||
1,1,1,52,4
|
||||
1,1,1,53,4
|
||||
1,1,1,54,4
|
||||
1,1,1,55,4
|
||||
1,1,1,56,4
|
||||
1,1,1,57,4
|
||||
1,1,1,58,4
|
||||
1,1,1,59,4
|
||||
1,1,1,60,4
|
||||
1,1,1,61,4
|
||||
1,1,1,62,4
|
||||
1,1,1,63,4
|
||||
1,1,1,64,4
|
||||
1,1,1,65,4
|
||||
1,1,1,66,4
|
||||
1,1,1,67,4
|
||||
1,1,1,68,4
|
||||
1,1,1,69,4
|
||||
1,1,1,70,4
|
||||
1,1,1,71,4
|
||||
1,1,1,72,4
|
||||
1,1,1,73,4
|
||||
1,1,1,74,4
|
||||
1,1,1,75,4
|
||||
1,1,1,76,4
|
||||
1,1,1,77,4
|
||||
1,1,1,78,4
|
||||
1,1,1,79,4
|
||||
1,1,1,80,4
|
||||
|
||||
1,0,0,81,2
|
||||
1,0,0,82,2
|
||||
1,0,0,83,2
|
||||
1,0,0,84,2
|
||||
1,0,0,85,2
|
||||
1,0,0,86,2
|
||||
1,0,0,87,2
|
||||
1,0,0,88,2
|
||||
1,0,0,89,2
|
||||
1,0,0,90,2
|
||||
1,0,0,91,2
|
||||
1,0,0,92,2
|
||||
1,0,0,93,2
|
||||
1,0,0,94,2
|
||||
1,0,0,95,2
|
||||
1,0,0,96,2
|
||||
1,0,0,97,2
|
||||
1,0,0,98,2
|
||||
1,0,0,99,2
|
||||
1,0,0,100,2
|
||||
|
||||
1,1,0,81,2
|
||||
1,1,0,82,2
|
||||
1,1,0,83,2
|
||||
1,1,0,84,2
|
||||
1,1,0,85,2
|
||||
1,1,0,86,2
|
||||
1,1,0,87,2
|
||||
1,1,0,88,2
|
||||
1,1,0,89,2
|
||||
1,1,0,90,2
|
||||
1,1,0,91,2
|
||||
1,1,0,92,2
|
||||
1,1,0,93,2
|
||||
1,1,0,94,2
|
||||
1,1,0,95,2
|
||||
1,1,0,96,2
|
||||
1,1,0,97,2
|
||||
1,1,0,98,2
|
||||
1,1,0,99,2
|
||||
1,1,0,100,2
|
||||
|
||||
1,0,1,81,5
|
||||
1,0,1,82,5
|
||||
1,0,1,83,5
|
||||
1,0,1,84,5
|
||||
1,0,1,85,5
|
||||
1,0,1,86,5
|
||||
1,0,1,87,5
|
||||
1,0,1,88,5
|
||||
1,0,1,89,5
|
||||
1,0,1,90,5
|
||||
1,0,1,91,5
|
||||
1,0,1,92,5
|
||||
1,0,1,93,5
|
||||
1,0,1,94,5
|
||||
1,0,1,95,5
|
||||
1,0,1,96,5
|
||||
1,0,1,97,5
|
||||
1,0,1,98,5
|
||||
1,0,1,99,5
|
||||
1,0,1,100,5
|
||||
|
||||
1,1,1,81,5
|
||||
1,1,1,82,5
|
||||
1,1,1,83,5
|
||||
1,1,1,84,5
|
||||
1,1,1,85,5
|
||||
1,1,1,86,5
|
||||
1,1,1,87,5
|
||||
1,1,1,88,5
|
||||
1,1,1,89,5
|
||||
1,1,1,90,5
|
||||
1,1,1,91,5
|
||||
1,1,1,92,5
|
||||
1,1,1,93,5
|
||||
1,1,1,94,5
|
||||
1,1,1,95,5
|
||||
1,1,1,96,5
|
||||
1,1,1,97,5
|
||||
1,1,1,98,5
|
||||
1,1,1,99,5
|
||||
1,1,1,100,5
|
|
86
Sklearn/Generate.py
Normal file
86
Sklearn/Generate.py
Normal file
@ -0,0 +1,86 @@
|
||||
# Load libraries
|
||||
import pickle
|
||||
import pandas as pd
|
||||
from sklearn import tree, metrics
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.tree import DecisionTreeClassifier, _tree
|
||||
|
||||
|
||||
def tree_to_code(tree, feature_names):
|
||||
# f = open('generatedTree.py', 'w')
|
||||
tree_ = tree.tree_
|
||||
feature_name = [
|
||||
feature_names[i] if i != _tree.TREE_UNDEFINED else "undefined!"
|
||||
for i in tree_.feature
|
||||
]
|
||||
# print("def tree({}):".format(", ".join(feature_names)), file=f)
|
||||
print("def tree({}):".format(", ".join(feature_names)))
|
||||
|
||||
def recurse(node, depth):
|
||||
indent = " " * depth
|
||||
if tree_.feature[node] != _tree.TREE_UNDEFINED:
|
||||
name = feature_name[node]
|
||||
threshold = tree_.threshold[node]
|
||||
# print("{}if {} <= {}:".format(indent, name, threshold), file=f)
|
||||
print("{}if {} <= {}:".format(indent, name, threshold))
|
||||
recurse(tree_.children_left[node], depth + 1)
|
||||
# print("{}else: # if {} > {}".format(indent, name, threshold), file=f)
|
||||
print("{}else: # if {} > {}".format(indent, name, threshold))
|
||||
recurse(tree_.children_right[node], depth + 1)
|
||||
else:
|
||||
# print("{}return {}".format(indent, tree_.value[node],), file=f)
|
||||
print("{}return {}".format(indent, tree_.value[node]))
|
||||
|
||||
recurse(0, 1)
|
||||
# f.close()
|
||||
|
||||
|
||||
def loadLearningBase():
|
||||
col_names = ['Warzywo', 'Nawoz', 'Srodek', 'Stan', 'Dzialanie']
|
||||
base = pd.read_csv("Database.csv", header=None, names=col_names)
|
||||
feature_cols = ['Warzywo', 'Nawoz', 'Srodek', 'Stan']
|
||||
|
||||
""" print dataset"""
|
||||
# print(base.head())
|
||||
|
||||
X = base[feature_cols] # Features
|
||||
y = base.Dzialanie # Target variable
|
||||
|
||||
# Split dataset into training set and test set
|
||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,
|
||||
random_state=1) # 70% training and 30% test
|
||||
|
||||
data = generateDecisionTree(X_train, X_test, y_train, y_test)
|
||||
|
||||
"""generate data for image"""
|
||||
# tree.export_graphviz(data, out_file='treeData.dot', filled=True, rounded=True, special_characters=True,
|
||||
# feature_names=feature_cols)
|
||||
|
||||
"""Printing if_styled tree to console"""
|
||||
# tree_to_code(data, feature_cols)
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def generateDecisionTree(X_train, X_test, y_train, y_test):
|
||||
# Create Decision Tree classifer object
|
||||
clf = DecisionTreeClassifier(criterion="entropy")
|
||||
|
||||
# Train Decision Tree Classifer
|
||||
clf = clf.fit(X_train, y_train)
|
||||
|
||||
# Predict the response for test dataset
|
||||
y_pred = clf.predict(X_test)
|
||||
|
||||
"""Model Accuracy, how often is the classifier correct """
|
||||
# print("Accuracy:", metrics.accuracy_score(y_test, y_pred))
|
||||
|
||||
return clf
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
generated = loadLearningBase()
|
||||
|
||||
# Save generated tree
|
||||
filename = 'decisionTree.sav'
|
||||
pickle.dump(generated, open(filename, 'wb'))
|
36
Sklearn/Test.py
Normal file
36
Sklearn/Test.py
Normal file
@ -0,0 +1,36 @@
|
||||
import pickle
|
||||
|
||||
|
||||
def decision(prediction):
|
||||
if prediction == 0:
|
||||
return "Nie_podejmuj_działania"
|
||||
elif prediction == 1:
|
||||
return "Zastosuj_nawóz"
|
||||
elif prediction == 2:
|
||||
return "Zastosuj_środek"
|
||||
elif prediction == 4:
|
||||
return "Zbierz"
|
||||
elif prediction == 5:
|
||||
return "Roślina_już_zgniła-zbierz_i_wyrzuć"
|
||||
|
||||
|
||||
def test():
|
||||
for n in range(0, 2):
|
||||
if n == 0:
|
||||
print("############# Nie ma nawozu #############")
|
||||
else:
|
||||
print("############# Zastosowano nawóz #############")
|
||||
for s in range(0, 2):
|
||||
if s == 0:
|
||||
print("############# Nie ma środka ochrony #############")
|
||||
else:
|
||||
print("############# Zastosowano środek ochrony #############")
|
||||
for st in range(0, 101):
|
||||
val = tree.predict([[1, n, s, st]])
|
||||
print("Stan roślinki: ", st, " ", decision(val))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
filename = 'decisionTree.sav'
|
||||
tree = pickle.load(open(filename, 'rb'))
|
||||
test()
|
BIN
Sklearn/decisionTree.sav
Normal file
BIN
Sklearn/decisionTree.sav
Normal file
Binary file not shown.
14
Sklearn/injectCode.py
Normal file
14
Sklearn/injectCode.py
Normal file
@ -0,0 +1,14 @@
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
|
||||
def prediction(warzywo, nawoz ,srodek, stan_wzrostu):
|
||||
filename = 'decisionTree.sav'
|
||||
tree = pickle.load(open(filename, 'rb'))
|
||||
print(tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]]))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Map command line arguments to function arguments.
|
||||
prediction(*sys.argv[1:])
|
25
Sklearn/treeData.dot
Normal file
25
Sklearn/treeData.dot
Normal file
@ -0,0 +1,25 @@
|
||||
digraph Tree {
|
||||
node [shape=box, style="filled, rounded", color="black", fontname=helvetica] ;
|
||||
edge [fontname=helvetica] ;
|
||||
0 [label=<Stan ≤ 40.5<br/>entropy = 2.092<br/>samples = 280<br/>value = [78, 41, 29, 108, 24]>, fillcolor="#e2e2fb"] ;
|
||||
1 [label=<Nawoz ≤ 0.5<br/>entropy = 0.929<br/>samples = 119<br/>value = [78, 41, 0, 0, 0]>, fillcolor="#f3c3a1"] ;
|
||||
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
|
||||
2 [label=<Stan ≤ 10.5<br/>entropy = 0.796<br/>samples = 54<br/>value = [13, 41, 0, 0, 0]>, fillcolor="#a5ed78"] ;
|
||||
1 -> 2 ;
|
||||
3 [label=<entropy = 0.0<br/>samples = 13<br/>value = [13, 0, 0, 0, 0]>, fillcolor="#e58139"] ;
|
||||
2 -> 3 ;
|
||||
4 [label=<entropy = 0.0<br/>samples = 41<br/>value = [0, 41, 0, 0, 0]>, fillcolor="#7be539"] ;
|
||||
2 -> 4 ;
|
||||
5 [label=<entropy = 0.0<br/>samples = 65<br/>value = [65, 0, 0, 0, 0]>, fillcolor="#e58139"] ;
|
||||
1 -> 5 ;
|
||||
6 [label=<Stan ≤ 80.5<br/>entropy = 1.241<br/>samples = 161<br/>value = [0, 0, 29, 108, 24]>, fillcolor="#8a88ef"] ;
|
||||
0 -> 6 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
|
||||
7 [label=<entropy = 0.0<br/>samples = 108<br/>value = [0, 0, 0, 108, 0]>, fillcolor="#3c39e5"] ;
|
||||
6 -> 7 ;
|
||||
8 [label=<Srodek ≤ 0.5<br/>entropy = 0.994<br/>samples = 53<br/>value = [0, 0, 29, 0, 24]>, fillcolor="#ddfbf5"] ;
|
||||
6 -> 8 ;
|
||||
9 [label=<entropy = 0.0<br/>samples = 29<br/>value = [0, 0, 29, 0, 0]>, fillcolor="#39e5c5"] ;
|
||||
8 -> 9 ;
|
||||
10 [label=<entropy = 0.0<br/>samples = 24<br/>value = [0, 0, 0, 0, 24]>, fillcolor="#e539c0"] ;
|
||||
8 -> 10 ;
|
||||
}
|
BIN
Sklearn/treeData.png
Normal file
BIN
Sklearn/treeData.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
@ -10,7 +10,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
const float maxFloat=FLT_MAX;
|
||||
const float maxFloat = FLT_MAX;
|
||||
const int ROW = 27;
|
||||
const int COL = 27;
|
||||
typedef pair<int, int> Pair;
|
||||
@ -22,6 +22,8 @@ struct cell
|
||||
};
|
||||
|
||||
char pole[27][27][2];
|
||||
int stan[27][27][2];
|
||||
string polecenie = "python injectCode.py 1 ";
|
||||
int pozycjaTraktoraX = 1, pozycjaTraktoraY = 1;
|
||||
char currentWay = 'S';
|
||||
|
||||
@ -98,7 +100,6 @@ void color(string foregroundColor, string backgroundColor)
|
||||
backgroundCode = 15;
|
||||
SetConsoleTextAttribute(hOut, foregroundCode + backgroundCode * 16);
|
||||
}
|
||||
|
||||
void SetWindow(int Width, int Height)
|
||||
{
|
||||
_COORD coord;
|
||||
@ -115,7 +116,6 @@ void SetWindow(int Width, int Height)
|
||||
SetConsoleScreenBufferSize(Handle, coord); // Set Buffer Size
|
||||
SetConsoleWindowInfo(Handle, TRUE, &Rect); // Set Window Size
|
||||
}
|
||||
|
||||
void updatePola()
|
||||
{
|
||||
system("cls");
|
||||
@ -154,41 +154,40 @@ void updatePola()
|
||||
color("white", "black");
|
||||
}
|
||||
}
|
||||
|
||||
void correctMovement(char wantedWay)
|
||||
{
|
||||
while (currentWay != wantedWay)
|
||||
{
|
||||
switch (currentWay)
|
||||
{
|
||||
case 'N':
|
||||
{
|
||||
if (wantedWay == 'S')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'W';
|
||||
}break;
|
||||
case 'S':
|
||||
{
|
||||
if (wantedWay == 'N')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'W';
|
||||
}break;
|
||||
case 'W':
|
||||
{
|
||||
if (wantedWay == 'E')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'N';
|
||||
}break;
|
||||
case 'E':
|
||||
{
|
||||
if (wantedWay == 'W')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'N';
|
||||
}break;
|
||||
case 'N':
|
||||
{
|
||||
if (wantedWay == 'S')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'W';
|
||||
}break;
|
||||
case 'S':
|
||||
{
|
||||
if (wantedWay == 'N')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'W';
|
||||
}break;
|
||||
case 'W':
|
||||
{
|
||||
if (wantedWay == 'E')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'N';
|
||||
}break;
|
||||
case 'E':
|
||||
{
|
||||
if (wantedWay == 'W')
|
||||
currentWay = wantedWay;
|
||||
else
|
||||
currentWay = 'N';
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,56 +196,55 @@ void Move(char kierunek)
|
||||
switch (kierunek)
|
||||
{
|
||||
//góra-(w)
|
||||
case 'w':
|
||||
case 'w':
|
||||
{
|
||||
if (pole[pozycjaTraktoraY - 1][pozycjaTraktoraX][0] != '#')
|
||||
{
|
||||
if (pole[pozycjaTraktoraY - 1][pozycjaTraktoraX][0] != '#')
|
||||
{
|
||||
correctMovement('N');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraY--;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
//dół-(s)
|
||||
case 's':
|
||||
correctMovement('N');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraY--;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
//dół-(s)
|
||||
case 's':
|
||||
{
|
||||
if (pole[pozycjaTraktoraY + 1][pozycjaTraktoraX][0] != '#')
|
||||
{
|
||||
if (pole[pozycjaTraktoraY + 1][pozycjaTraktoraX][0] != '#')
|
||||
{
|
||||
correctMovement('S');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraY++;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
//lewo-(a)
|
||||
case 'a':
|
||||
correctMovement('S');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraY++;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
//lewo-(a)
|
||||
case 'a':
|
||||
{
|
||||
if (pole[pozycjaTraktoraY][pozycjaTraktoraX - 1][0] != '#')
|
||||
{
|
||||
if (pole[pozycjaTraktoraY][pozycjaTraktoraX - 1][0] != '#')
|
||||
{
|
||||
correctMovement('W');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraX--;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
//prawo-(d)
|
||||
case 'd':
|
||||
correctMovement('W');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraX--;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
//prawo-(d)
|
||||
case 'd':
|
||||
{
|
||||
if (pole[pozycjaTraktoraY][pozycjaTraktoraX + 1][0] != '#')
|
||||
{
|
||||
if (pole[pozycjaTraktoraY][pozycjaTraktoraX + 1][0] != '#')
|
||||
{
|
||||
correctMovement('E');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraX++;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
correctMovement('E');
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = '.';
|
||||
pozycjaTraktoraX++;
|
||||
pole[pozycjaTraktoraY][pozycjaTraktoraX][0] = 'T';
|
||||
}
|
||||
updatePola();
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
bool isValid(int x, int y)
|
||||
{
|
||||
if (pole[x][y][0] != '#')
|
||||
@ -255,7 +253,7 @@ bool isValid(int x, int y)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isDestination(int x, int y,Pair dest)
|
||||
bool isDestination(int x, int y, Pair dest)
|
||||
{
|
||||
if (dest.first == x && dest.second == y)
|
||||
{
|
||||
@ -300,12 +298,12 @@ void tracePath(cell cellDetails[][COL], Pair dest)
|
||||
Move('w');
|
||||
|
||||
//printf("-> (%d,%d) ", p.first, p.second); //---- informacja wierzchołku
|
||||
Sleep(1000);
|
||||
//Sleep(1000);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
void aStarSearch(int grid[][COL],Pair src, Pair dest)
|
||||
void aStarSearch(int grid[][COL], Pair src, Pair dest)
|
||||
{
|
||||
bool closedList[ROW][COL];
|
||||
memset(closedList, false, sizeof(closedList));
|
||||
@ -345,7 +343,7 @@ void aStarSearch(int grid[][COL],Pair src, Pair dest)
|
||||
|
||||
double gNew, hNew, fNew;
|
||||
double waga = 1.0;
|
||||
waga = ((double)pole[j][i][1] - 48)*1.0;//----waga
|
||||
waga = ((double)pole[j][i][1] - 48) * 1.0;//----waga
|
||||
|
||||
//----------- 1st Successor (North) ------------
|
||||
if (isValid(i - 1, j) == true)
|
||||
@ -479,11 +477,10 @@ void aStarSearch(int grid[][COL],Pair src, Pair dest)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void gogo(int endX,int endY)
|
||||
void gogo(int endX, int endY)
|
||||
{
|
||||
updatePola();
|
||||
Sleep(1000);
|
||||
//Sleep(1000);
|
||||
int grid[27][27];
|
||||
for (int i = 0; i < 27; i++)
|
||||
{
|
||||
@ -497,6 +494,33 @@ void gogo(int endX,int endY)
|
||||
aStarSearch(grid, src, dest);
|
||||
}
|
||||
|
||||
void stanPola(int x, int y) {
|
||||
//[x][x][0] = 0 - brak chemii
|
||||
//[x][x][0] = 1 - tylko nawóz
|
||||
//[x][x][0] = 2 - tylko środek
|
||||
//[x][x][0] = 3 - środek i nawóz
|
||||
//[x][x][1] - wartość wzrostu rośliny
|
||||
|
||||
if (stan[x][y][0] == 0)
|
||||
polecenie.append("0 0 ");
|
||||
if (stan[x][y][0] == 1)
|
||||
polecenie.append("1 0 ");
|
||||
if (stan[x][y][0] == 2)
|
||||
polecenie.append("0 1 ");
|
||||
if (stan[x][y][0] == 3)
|
||||
polecenie.append("1 1 ");
|
||||
int w = (stan[x][y][1]);
|
||||
std::string s = std::to_string(w);
|
||||
polecenie.append(s);
|
||||
}
|
||||
|
||||
void decisionTree(string polecenie) {
|
||||
|
||||
std::string str = polecenie;
|
||||
const char* c = str.c_str();
|
||||
system(c);
|
||||
}
|
||||
|
||||
void test1()
|
||||
{
|
||||
pole[1][3][0] = 'B';
|
||||
@ -549,9 +573,64 @@ void start3()
|
||||
gogo(goalX, goalY);
|
||||
}
|
||||
|
||||
void testTree() {
|
||||
int x, y;
|
||||
x = 3;
|
||||
y = 3;
|
||||
//Nie podejmuj
|
||||
stan[x][y][0] = 0;
|
||||
stan[x][y][1] = 10;
|
||||
stanPola(x, y);
|
||||
}
|
||||
void testTree1() {
|
||||
int x, y;
|
||||
x = 3;
|
||||
y = 3;
|
||||
//Nawoz
|
||||
stan[x][y][0] = 0;
|
||||
stan[x][y][1] = 15;
|
||||
stanPola(x, y);
|
||||
}
|
||||
void testTree2() {
|
||||
int x, y;
|
||||
x = 3;
|
||||
y = 3;
|
||||
//Nie podejmuj
|
||||
stan[x][y][0] = 1;
|
||||
stan[x][y][1] = 20;
|
||||
stanPola(x, y);
|
||||
}
|
||||
void testTree3() {
|
||||
int x, y;
|
||||
x = 3;
|
||||
y = 3;
|
||||
//Zbierz
|
||||
stan[x][y][0] = 1;
|
||||
stan[x][y][1] = 41;
|
||||
stanPola(x, y);
|
||||
}
|
||||
void testTree4() {
|
||||
int x, y;
|
||||
x = 3;
|
||||
y = 3;
|
||||
//Nie podejmuj
|
||||
stan[x][y][0] = 1;
|
||||
stan[x][y][1] = 90;
|
||||
stanPola(x, y);
|
||||
}
|
||||
void testTree5() {
|
||||
int x, y;
|
||||
x = 3;
|
||||
y = 3;
|
||||
//Srodek
|
||||
stan[x][y][0] = 3;
|
||||
stan[x][y][1] = 90;
|
||||
stanPola(x, y);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
SetWindow(50, 30);
|
||||
//SetWindow(50, 30);
|
||||
//create pola//
|
||||
for (int i = 0; i < 27; i++)
|
||||
{
|
||||
@ -581,7 +660,26 @@ int main()
|
||||
|
||||
updatePola();
|
||||
|
||||
start3(); // testy start 1-3
|
||||
//start3(); // testy start 1-3
|
||||
testTree();
|
||||
decisionTree(polecenie);
|
||||
polecenie = "python injectCode.py 1 ";
|
||||
testTree1();
|
||||
decisionTree(polecenie);
|
||||
polecenie = "python injectCode.py 1 ";
|
||||
testTree2();
|
||||
decisionTree(polecenie);
|
||||
polecenie = "python injectCode.py 1 ";
|
||||
testTree3();
|
||||
decisionTree(polecenie);
|
||||
polecenie = "python injectCode.py 1 ";
|
||||
testTree4();
|
||||
decisionTree(polecenie);
|
||||
polecenie = "python injectCode.py 1 ";
|
||||
testTree5();
|
||||
decisionTree(polecenie);
|
||||
|
||||
|
||||
|
||||
//---------start---------//
|
||||
bool traktorDziala = true;
|
31
Traktor_DrzewaDecyzyjne.sln
Normal file
31
Traktor_DrzewaDecyzyjne.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29503.13
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Traktor_DrzewaDecyzyjne", "Traktor_DrzewaDecyzyjne.vcxproj", "{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Debug|x64.Build.0 = Debug|x64
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Release|x64.ActiveCfg = Release|x64
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Release|x64.Build.0 = Release|x64
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {891B470F-58C4-41E4-A102-A1D8CBB6BD64}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
163
Traktor_DrzewaDecyzyjne.vcxproj
Normal file
163
Traktor_DrzewaDecyzyjne.vcxproj
Normal file
@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<ProjectGuid>{C2FF0872-AC9D-4BD9-A46D-DC65A728BFF5}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>TraktorDrzewaDecyzyjne</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Traktor_DrzewaDecyzyjne.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\AI_Traktor\decisionTree.sav" />
|
||||
<None Include="..\AI_Traktor\injectCode.py" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
BIN
decisionTree.sav
Normal file
BIN
decisionTree.sav
Normal file
Binary file not shown.
BIN
images/Tree/StanPola.jpg
Normal file
BIN
images/Tree/StanPola.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
BIN
images/Tree/wydaniePolecenia.jpg
Normal file
BIN
images/Tree/wydaniePolecenia.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
27
injectCode.py
Normal file
27
injectCode.py
Normal file
@ -0,0 +1,27 @@
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
|
||||
def prediction(warzywo, nawoz ,srodek, stan_wzrostu):
|
||||
filename = 'decisionTree.sav'
|
||||
tree = pickle.load(open(filename, 'rb'))
|
||||
val = (tree.predict([[warzywo, nawoz, srodek, stan_wzrostu]]))
|
||||
print(decision(val))
|
||||
|
||||
def decision(prediction):
|
||||
if prediction == 0:
|
||||
return "Nie_podejmuj_dzialania"
|
||||
elif prediction == 1:
|
||||
return "Zastosuj_nawoz"
|
||||
elif prediction == 2:
|
||||
return "Zastosuj_srodek"
|
||||
elif prediction == 4:
|
||||
return "Zbierz"
|
||||
elif prediction == 5:
|
||||
return "Roslina_juz_zgnila__zbierz_i_wyrzuc"
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Map command line arguments to function arguments.
|
||||
prediction(*sys.argv[1:])
|
@ -5,10 +5,11 @@
|
||||
[80,100] - przejrzała
|
||||
|
||||
nawóz przyśpiesza wzrost (czas * stałaPrzyrosuNawozu) poleInt[0]=1
|
||||
użyty tylko kiedy kiełek lub młoda (ale max 1)
|
||||
brak nawozu poleInt[0]=0
|
||||
użyty tylko kiedy młoda (ale max 1)
|
||||
|
||||
środek zmienia granice rośliny poleInt[0]=2
|
||||
użyty zawsze (ale max 1)
|
||||
środek sprawia że roślina starzejąca uzdatnia roślinę do zbioru poleInt[0]=2
|
||||
używany tylko jak starzejąca (ale max 1)
|
||||
|
||||
użyty środek i nawóz poleInt[0]=3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user