added xgboost model, some new sprites and code refactors
@ -5,7 +5,7 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (ai-project)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
55
assets/data/test.csv
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
stan_nawodnienia,rodzaj_gleby,stan_nawiezienia,stopien_rozwoju,rodzaj_rosliny,rodzaj_nawozu,to_water
|
||||||
|
0.32,piaszczyste,0.06,0.40,ziemniak,mineralny,1
|
||||||
|
0.60,piaszczyste,0.72,0.79,kaktus,sztuczny,0
|
||||||
|
0.76,czarnoziemy,0.49,0.57,pszenica,organiczny,0
|
||||||
|
0.66,czarnoziemy,0.49,0.57,brak,organiczny,0
|
||||||
|
0.25,brunatne,0.18,0.23,ziemniak,sztuczny,1
|
||||||
|
0.39,czarnoziemy,0.88,0.85,kaktus,organiczny,0
|
||||||
|
0.02,brunatne,0.58,0.85,kaktus,sztuczny,1
|
||||||
|
0.96,piaszczyste,0.70,0.51,ziemniak,organiczny,0
|
||||||
|
0.32,brunatne,0.69,0.23,pszenica,sztuczny,1
|
||||||
|
0.50,piaszczyste,0.52,0.39,kaktus,sztuczny,0
|
||||||
|
0.45,brunatne,0.91,0.93,ziemniak,organiczny,0
|
||||||
|
0.31,czarnoziemy,0.82,0.74,ziemniak,mineralny,1
|
||||||
|
0.21,piaszczyste,0.64,0.24,pszenica,sztuczny,1
|
||||||
|
0.69,brunatne,0.82,0.65,ziemniak,mineralny,0
|
||||||
|
0.44,piaszczyste,0.38,0.84,pszenica,organiczny,1
|
||||||
|
0.11,brunatne,0.22,0.79,kaktus,organiczny,1
|
||||||
|
0.83,czarnoziemy,0.64,0.74,pszenica,mineralny,0
|
||||||
|
0.73,brunatne,0.54,0.94,ziemniak,mineralny,0
|
||||||
|
0.90,piaszczyste,0.35,0.23,pszenica,mineralny,0
|
||||||
|
0.78,piaszczyste,0.5,0.66,ziemniak,organiczny,0
|
||||||
|
0.31,czarnoziemy,0.42,0.34,ziemniak,mineralny,1
|
||||||
|
0.76,czarnoziemy,0.49,0.57,brak,sztuczny,0
|
||||||
|
0.71,czarnoziemy,0.67,0.50,pszenica,sztuczny,0
|
||||||
|
0.75,piaszczyste,0.53,0.35,kaktus,mineralny,0
|
||||||
|
0.41,czarnoziemy,0.12,0.05,ziemniak,sztuczny,1
|
||||||
|
0.85,czarnoziemy,0.64,0.36,pszenica,organiczny,0
|
||||||
|
0.77,czarnoziemy,0.34,0.65,ziemniak,sztuczny,0
|
||||||
|
0.85,brunatne,0.25,0.0,brak,sztuczny,0
|
||||||
|
0.68,czarnoziemy,0.66,0.77,pszenica,organiczny,0
|
||||||
|
0.28,czarnoziemy,0.55,0,brak,sztuczny,1
|
||||||
|
0.63,brunatne,0.88,0.85,ziemniak,mineralny,0
|
||||||
|
0.56,brunatne,0.88,0.75,pszenica,organiczny,0
|
||||||
|
0.45,piaszczyste,0.77,0.65,kaktus,organiczny,0
|
||||||
|
0.83,brunatne,0.66,0.41,ziemniak,mineralny,0
|
||||||
|
0.34,piaszczyste,0.72,0.53,pszenica,mineralny,1
|
||||||
|
0.64,piaszczyste,0.79,0.33,pszenica,sztuczny,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
55
assets/data/test.csv.bak
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
stan_nawodnienia,rodzaj_gleby,stan_nawiezienia,stopien_rozwoju,rodzaj_rosliny,rodzaj_nawozu,to_water
|
||||||
|
0.32,piaszczyste,0.06,0.40,ziemniak,mineralny,1
|
||||||
|
0.60,piaszczyste,0.72,0.79,kaktus,sztuczny,0
|
||||||
|
0.76,czarnoziemy,0.49,0.57,pszenica,organiczny,0
|
||||||
|
0.66,czarnoziemy,0.49,0.57,brak,organiczny,0
|
||||||
|
0.25,brunatne,0.18,0.23,ziemniak,sztuczny,1
|
||||||
|
0.39,czarnoziemy,0.88,0.85,kaktus,organiczny,0
|
||||||
|
0.02,brunatne,0.38,0.85,kaktus,sztuczny,1
|
||||||
|
0.96,piaszczyste,0.70,0.51,ziemniak,organiczny,0
|
||||||
|
0.32,brunatne,0.69,0.23,pszenica,sztuczny,1
|
||||||
|
0.50,piaszczyste,0.52,0.39,kaktus,sztuczny,0
|
||||||
|
0.45,brunatne,0.91,0.93,ziemniak,organiczny,0
|
||||||
|
0.31,czarnoziemy,0.82,0.74,ziemniak,mineralny,1
|
||||||
|
0.21,piaszczyste,0.64,0.24,pszenica,sztuczny,1
|
||||||
|
0.69,brunatne,0.82,0.65,ziemniak,mineralny,0
|
||||||
|
0.44,piaszczyste,0.38,0.84,pszenica,organiczny,1
|
||||||
|
0.11,brunatne,0.22,0.79,kaktus,organiczny,1
|
||||||
|
0.83,czarnoziemy,0.64,0.74,pszenica,mineralny,0
|
||||||
|
0.73,brunatne,0.54,0.94,ziemniak,mineralny,0
|
||||||
|
0.90,piaszczyste,0.35,0.23,pszenica,mineralny,0
|
||||||
|
0.78,piaszczyste,0.5,0.66,ziemniak,organiczny,0
|
||||||
|
0.31,czarnoziemy,0.42,0.34,ziemniak,mineralny,1
|
||||||
|
0.76,czarnoziemy,0.49,0.57,brak,sztuczny,0
|
||||||
|
0.71,czarnoziemy,0.67,0.50,pszenica,sztuczny,0
|
||||||
|
0.75,piaszczyste,0.53,0.35,kaktus,mineralny,0
|
||||||
|
0.41,czarnoziemy,0.12,0.05,ziemniak,sztuczny,1
|
||||||
|
0.85,czarnoziemy,0.64,0.36,pszenica,organiczny,0
|
||||||
|
0.77,czarnoziemy,0.34,0.65,ziemniak,sztuczny,0
|
||||||
|
0.85,brunatne,0.25,0.0,brak,sztuczny,0
|
||||||
|
0.68,czarnoziemy,0.66,0.77,pszenica,organiczny,0
|
||||||
|
0.28,czarnoziemy,0.55,0,brak,sztuczny,1
|
||||||
|
0.63,brunatne,0.88,0.85,ziemniak,mineralny,0
|
||||||
|
0.56,brunatne,0.88,0.75,pszenica,organiczny,0
|
||||||
|
0.45,piaszczyste,0.77,0.65,kaktus,organiczny,0
|
||||||
|
0.83,brunatne,0.66,0.41,ziemniak,mineralny,0
|
||||||
|
0.34,piaszczyste,0.72,0.53,pszenica,mineralny,1
|
||||||
|
0.64,piaszczyste,0.79,0.33,pszenica,sztuczny,0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
178
assets/data/train.csv
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
stan_nawodnienia,rodzaj_gleby,stan_nawiezienia,stopien_rozwoju,rodzaj_rosliny,rodzaj_nawozu,to_water
|
||||||
|
0.32,brunatne,0.01,0.75,ziemniak,mineralny,1
|
||||||
|
0.38,brunatne,0.15,0.85,pszenica,organiczny,1
|
||||||
|
0.17,piaszczyste,0.22,0.13,brak,organiczny,1
|
||||||
|
0.67,czarnoziemy,0.64,0.55,pszenica,sztuczny,0
|
||||||
|
0.45,brunatne,0.16,0.16,brak,organiczny,1
|
||||||
|
0.25,czarnoziemy,0.16,0.23,pszenica,organiczny,1
|
||||||
|
0.10,brunatne,0.02,0.17,brak,mineralny,1
|
||||||
|
0.25,brunatne,0.39,0.17,kaktus,organiczny,1
|
||||||
|
0.92,brunatne,0.68,0.77,ziemniak,sztuczny,0
|
||||||
|
0.70,piaszczyste,0.72,0.79,kaktus,sztuczny,0
|
||||||
|
0.54,czarnoziemy,0.95,0.59,ziemniak,organiczny,0
|
||||||
|
0.21,piaszczyste,0.05,0.03,brak,mineralny,1
|
||||||
|
0.23,brunatne,0.11,0.86,ziemniak,organiczny,1
|
||||||
|
0.61,czarnoziemy,0.76,0.76,ziemniak,sztuczny,0
|
||||||
|
0.87,brunatne,0.53,0.85,pszenica,organiczny,0
|
||||||
|
0.21,brunatne,0.01,0.26,kaktus,mineralny,1
|
||||||
|
0.32,piaszczyste,0.06,0.40,ziemniak,mineralny,1
|
||||||
|
0.76,czarnoziemy,0.79,0.67,pszenica,mineralny,0
|
||||||
|
0.30,brunatne,0.21,0.10,brak,mineralny,1
|
||||||
|
0.66,piaszczyste,0.93,0.95,kaktus,sztuczny,0
|
||||||
|
0.71,brunatne,0.52,0.62,ziemniak,mineralny,0
|
||||||
|
0.43,piaszczyste,0.38,0.35,pszenica,sztuczny,1
|
||||||
|
0.66,brunatne,0.72,0.63,pszenica,organiczny,0
|
||||||
|
0.21,piaszczyste,0.47,0.96,brak,sztuczny,1
|
||||||
|
0.78,brunatne,0.59,0.68,pszenica,organiczny,0
|
||||||
|
0.85,piaszczyste,0.77,0.64,pszenica,organiczny,0
|
||||||
|
0.84,piaszczyste,0.75,0.86,ziemniak,sztuczny,0
|
||||||
|
0.71,czarnoziemy,0.72,0.74,ziemniak,mineralny,1
|
||||||
|
0.75,piaszczyste,0.77,0.74,ziemniak,sztuczny,0
|
||||||
|
0.76,piaszczyste,0.75,0.81,pszenica,mineralny,0
|
||||||
|
0.72,brunatne,0.74,0.84,kaktus,sztuczny,0
|
||||||
|
0.59,brunatne,0.82,0.88,pszenica,organiczny,0
|
||||||
|
0.48,czarnoziemy,0.15,0.27,ziemniak,organiczny,0
|
||||||
|
0.04,piaszczyste,0.90,0.8,pszenica,organiczny,0
|
||||||
|
0.23,brunatne,0.12,0.56,brak,organiczny,1
|
||||||
|
0.02,piaszczyste,0.20,0.18,brak,organiczny,1
|
||||||
|
0.02,piaszczyste,0.35,0.24,ziemniak,mineralny,1
|
||||||
|
0.76,piaszczyste,0.78,0.85,ziemniak,mineralny,0
|
||||||
|
0.72,czarnoziemy,0.67,0.76,brak,mineralny,0
|
||||||
|
0.06,brunatne,0.02,0.71,ziemniak,mineralny,1
|
||||||
|
0.96,czarnoziemy,0.66,0.80,ziemniak,sztuczny,0
|
||||||
|
0.34,brunatne,0.22,0.15,kaktus,mineralny,0
|
||||||
|
0.78,piaszczyste,0.62,0.68,pszenica,mineralny,0
|
||||||
|
0.01,czarnoziemy,0.22,0.05,pszenica,sztuczny,1
|
||||||
|
0.02,czarnoziemy,0.31,0.80,pszenica,sztuczny,1
|
||||||
|
0.11,piaszczyste,0.14,0.14,pszenica,organiczny,1
|
||||||
|
0.95,piaszczyste,0.61,0.94,brak,sztuczny,0
|
||||||
|
0.78,brunatne,0.86,0.63,pszenica,organiczny,0
|
||||||
|
0.03,brunatne,0.27,0.25,pszenica,sztuczny,1
|
||||||
|
0.62,czarnoziemy,0.75,0.75,ziemniak,sztuczny,0
|
||||||
|
0.24,piaszczyste,0.02,0.23,pszenica,organiczny,1
|
||||||
|
0.46,czarnoziemy,0.79,0.27,ziemniak,sztuczny,0
|
||||||
|
0.24,piaszczyste,0.74,0.53,pszenica,mineralny,1
|
||||||
|
0.82,czarnoziemy,0.77,0.86,ziemniak,mineralny,0
|
||||||
|
0.25,brunatne,0.18,0.23,pszenica,sztuczny,1
|
||||||
|
0.73,czarnoziemy,0.94,0.54,brak,organiczny,0
|
||||||
|
0.63,piaszczyste,0.84,0.92,kaktus,sztuczny,0
|
||||||
|
0.78,czarnoziemy,0.75,0.94,brak,sztuczny,0
|
||||||
|
0.84,piaszczyste,0.79,0.80,pszenica,sztuczny,0
|
||||||
|
0.78,czarnoziemy,0.95,0.63,pszenica,mineralny,0
|
||||||
|
0.43,brunatne,0.38,0.52,pszenica,organiczny,1
|
||||||
|
0.88,piaszczyste,0.84,0.78,ziemniak,sztuczny,0
|
||||||
|
0.69,brunatne,0.86,0.55,ziemniak,organiczny,0
|
||||||
|
0.77,piaszczyste,0.78,0.55,ziemniak,organiczny,0
|
||||||
|
0.26,brunatne,0.24,0.12,ziemniak,mineralny,1
|
||||||
|
0.75,czarnoziemy,0.64,0.73,brak,mineralny,0
|
||||||
|
0.14,piaszczyste,0.38,0.44,pszenica,sztuczny,1
|
||||||
|
0.84,czarnoziemy,0.85,0.67,ziemniak,organiczny,0
|
||||||
|
0.33,brunatne,0.11,0.12,brak,organiczny,1
|
||||||
|
0.89,brunatne,0.67,0.88,brak,organiczny,0
|
||||||
|
0.15,brunatne,0.21,0.23,pszenica,mineralny,1
|
||||||
|
0.07,piaszczyste,0.24,0.67,brak,sztuczny,1
|
||||||
|
0.29,czarnoziemy,0.10,0.14,ziemniak,sztuczny,1
|
||||||
|
0.99,piaszczyste,0.99,0.75,kaktus,mineralny,0
|
||||||
|
0.62,piaszczyste,0.65,0.75,brak,organiczny,0
|
||||||
|
0.33,czarnoziemy,0.23,0.23,brak,sztuczny,1
|
||||||
|
0.16,brunatne,0.28,0.38,brak,organiczny,1
|
||||||
|
0.35,piaszczyste,0.18,0.13,ziemniak,mineralny,0
|
||||||
|
0.85,czarnoziemy,0.64,0.74,pszenica,sztuczny,0
|
||||||
|
0.78,czarnoziemy,0.59,0.72,ziemniak,organiczny,0
|
||||||
|
0.24,czarnoziemy,0.14,0.18,brak,organiczny,1
|
||||||
|
0.25,czarnoziemy,0.13,0.16,pszenica,sztuczny,1
|
||||||
|
0.87,czarnoziemy,0.87,0.76,pszenica,mineralny,0
|
||||||
|
0.28,brunatne,0.44,0.27,brak,mineralny,1
|
||||||
|
0.47,brunatne,0.09,0.05,ziemniak,mineralny,1
|
||||||
|
0.68,piaszczyste,0.72,0.67,brak,sztuczny,0
|
||||||
|
0.23,czarnoziemy,0.27,0.25,pszenica,sztuczny,1
|
||||||
|
0.05,piaszczyste,0.11,0.16,brak,organiczny,1
|
||||||
|
0.12,piaszczyste,0.21,0.22,brak,mineralny,1
|
||||||
|
0.86,brunatne,0.55,0.67,ziemniak,organiczny,0
|
||||||
|
0.68,brunatne,0.76,0.87,pszenica,organiczny,0
|
||||||
|
0.04,brunatne,0.32,0.26,kaktus,sztuczny,1
|
||||||
|
0.73,piaszczyste,0.73,0.73,pszenica,sztuczny,0
|
||||||
|
0.01,czarnoziemy,0.42,0.34,ziemniak,mineralny,1
|
||||||
|
0.96,piaszczyste,0.70,0.71,ziemniak,organiczny,0
|
||||||
|
0.74,piaszczyste,0.66,0.79,kaktus,mineralny,0
|
||||||
|
0.75,brunatne,0.66,0.82,pszenica,mineralny,0
|
||||||
|
0.70,brunatne,0.69,0.63,pszenica,organiczny,0
|
||||||
|
0.66,brunatne,0.85,0.72,brak,sztuczny,0
|
||||||
|
0.73,piaszczyste,0.58,0.95,ziemniak,mineralny,0
|
||||||
|
0.36,brunatne,0.14,0.02,brak,mineralny,0
|
||||||
|
0.61,piaszczyste,0.70,0.66,pszenica,mineralny,0
|
||||||
|
0.83,piaszczyste,0.68,0.75,ziemniak,sztuczny,0
|
||||||
|
0.55,brunatne,0.68,0.79,ziemniak,sztuczny,0
|
||||||
|
0.75,czarnoziemy,0.64,0.58,kaktus,organiczny,0
|
||||||
|
0.99,brunatne,0.57,0.82,pszenica,organiczny,0
|
||||||
|
0.88,czarnoziemy,0.68,0.65,brak,sztuczny,0
|
||||||
|
0.58,czarnoziemy,0.68,0.71,ziemniak,organiczny,1
|
||||||
|
0.14,piaszczyste,0.46,0.17,brak,sztuczny,1
|
||||||
|
0.06,czarnoziemy,0.23,0.25,kaktus,sztuczny,1
|
||||||
|
0.56,brunatne,0.88,0.65,ziemniak,organiczny,0
|
||||||
|
0.32,brunatne,0.39,0.23,pszenica,organiczny,1
|
||||||
|
0.64,piaszczyste,0.85,0.99,ziemniak,mineralny,0
|
||||||
|
0.25,czarnoziemy,0.26,0.45,kaktus,organiczny,0
|
||||||
|
0.78,piaszczyste,0.85,0.92,brak,mineralny,0
|
||||||
|
0.14,brunatne,0.09,0.13,pszenica,organiczny,1
|
||||||
|
0.82,brunatne,0.81,0.80,brak,mineralny,0
|
||||||
|
0.65,piaszczyste,0.58,0.78,pszenica,mineralny,0
|
||||||
|
0.32,piaszczyste,0.25,0.04,ziemniak,organiczny,1
|
||||||
|
0.33,czarnoziemy,0.12,0.46,kaktus,sztuczny,0
|
||||||
|
0.58,czarnoziemy,0.76,0.66,pszenica,mineralny,0
|
||||||
|
0.01,czarnoziemy,0.32,0.33,ziemniak,mineralny,1
|
||||||
|
0.65,brunatne,0.88,0.66,ziemniak,organiczny,0
|
||||||
|
0.12,czarnoziemy,0.16,0.13,brak,mineralny,1
|
||||||
|
0.86,brunatne,0.98,0.88,brak,sztuczny,0
|
||||||
|
0.23,brunatne,0.15,0.15,ziemniak,mineralny,1
|
||||||
|
0.24,piaszczyste,0.37,0.34,kaktus,mineralny,0
|
||||||
|
0.05,brunatne,0.18,0.39,ziemniak,mineralny,1
|
||||||
|
0.23,czarnoziemy,0.26,0.35,ziemniak,organiczny,1
|
||||||
|
0.55,czarnoziemy,0.78,0.89,brak,organiczny,0
|
||||||
|
0.25,czarnoziemy,0.13,0.47,brak,mineralny,1
|
||||||
|
0.62,czarnoziemy,0.82,0.68,brak,sztuczny,0
|
||||||
|
0.85,czarnoziemy,0.64,0.56,brak,mineralny,0
|
||||||
|
0.58,piaszczyste,0.94,0.74,brak,sztuczny,0
|
||||||
|
0.17,piaszczyste,0.34,0.15,ziemniak,mineralny,1
|
||||||
|
0.26,czarnoziemy,0.21,0.15,pszenica,mineralny,1
|
||||||
|
0.22,czarnoziemy,0.35,0.45,pszenica,mineralny,1
|
||||||
|
0.21,piaszczyste,0.26,0.26,pszenica,organiczny,1
|
||||||
|
0.38,piaszczyste,0.36,0.14,pszenica,mineralny,1
|
||||||
|
0.17,piaszczyste,0.38,0.27,pszenica,organiczny,1
|
||||||
|
0.11,piaszczyste,0.21,0.23,pszenica,sztuczny,1
|
||||||
|
0.48,czarnoziemy,0.29,0.28,kaktus,organiczny,0
|
||||||
|
0.16,czarnoziemy,0.21,0.56,ziemniak,organiczny,1
|
||||||
|
0.22,piaszczyste,0.22,0.19,ziemniak,sztuczny,1
|
||||||
|
0.63,czarnoziemy,0.87,0.77,pszenica,mineralny,0
|
||||||
|
0.69,piaszczyste,0.85,0.78,brak,mineralny,0
|
||||||
|
0.55,brunatne,0.50,0.79,brak,organiczny,0
|
||||||
|
0.14,piaszczyste,0.14,0.35,ziemniak,mineralny,1
|
||||||
|
0.95,czarnoziemy,0.82,0.92,pszenica,organiczny,0
|
||||||
|
0.68,piaszczyste,0.57,0.62,pszenica,mineralny,0
|
||||||
|
0.60,brunatne,0.66,0.85,ziemniak,mineralny,0
|
||||||
|
0.50,brunatne,0.91,0.83,ziemniak,organiczny,0
|
||||||
|
0.36,piaszczyste,0.08,0.75,kaktus,mineralny,0
|
||||||
|
0.13,brunatne,0.26,0.38,kaktus,sztuczny,1
|
||||||
|
0.32,piaszczyste,0.25,0.24,ziemniak,sztuczny,1
|
||||||
|
0.84,brunatne,0.54,0.50,brak,mineralny,0
|
||||||
|
0.31,czarnoziemy,0.49,0.14,pszenica,organiczny,1
|
||||||
|
0.62,piaszczyste,0.74,0.85,kaktus,sztuczny,0
|
||||||
|
0.85,czarnoziemy,0.67,0.74,brak,organiczny,0
|
||||||
|
0.74,piaszczyste,0.69,0.98,ziemniak,organiczny,0
|
||||||
|
0.16,piaszczyste,0.16,0.36,pszenica,mineralny,1
|
||||||
|
0.01,czarnoziemy,0.12,0.29,ziemniak,organiczny,1
|
||||||
|
0.55,brunatne,0.67,0.74,brak,sztuczny,0
|
||||||
|
0.75,czarnoziemy,0.86,0.90,ziemniak,sztuczny,0
|
||||||
|
0.42,czarnoziemy,0.25,0.39,kaktus,sztuczny,0
|
||||||
|
0.25,brunatne,0.30,0.24,ziemniak,organiczny,1
|
||||||
|
0.12,czarnoziemy,0.20,0.49,ziemniak,mineralny,1
|
||||||
|
0.75,brunatne,0.75,0.54,pszenica,organiczny,0
|
||||||
|
0.65,czarnoziemy,0.82,0.76,pszenica,mineralny,0
|
||||||
|
0.79,czarnoziemy,0.66,0.77,pszenica,sztuczny,0
|
||||||
|
0.62,brunatne,0.78,0.84,brak,mineralny,0
|
||||||
|
0.05,czarnoziemy,0.19,0.17,brak,organiczny,1
|
||||||
|
0.22,czarnoziemy,0.24,0.25,kaktus,organiczny,1
|
||||||
|
0.17,brunatne,0.31,0.35,ziemniak,mineralny,1
|
||||||
|
0.91,brunatne,0.58,0.89,ziemniak,sztuczny,0
|
||||||
|
0.07,brunatne,0.27,0.27,ziemniak,organiczny,1
|
||||||
|
0.32,piaszczyste,0.12,0.68,brak,organiczny,1
|
|
178
assets/data/train.csv.bak
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
stan_nawodnienia,rodzaj_gleby,stan_nawiezienia,stopien_rozwoju,rodzaj_rosliny,rodzaj_nawozu,to_water
|
||||||
|
0.32,brunatne,0.01,0.75,ziemniak,mineralny,1
|
||||||
|
0.38,brunatne,0.15,0.85,pszenica,organiczny,1
|
||||||
|
0.17,piaszczyste,0.22,0.13,brak,organiczny,1
|
||||||
|
0.67,czarnoziemy,0.64,0.55,pszenica,sztuczny,0
|
||||||
|
0.45,brunatne,0.16,0.16,brak,organiczny,1
|
||||||
|
0.25,czarnoziemy,0.16,0.23,pszenica,organiczny,1
|
||||||
|
0.10,brunatne,0.02,0.17,brak,mineralny,1
|
||||||
|
0.25,brunatne,0.39,0.17,kaktus,organiczny,1
|
||||||
|
0.92,brunatne,0.68,0.77,ziemniak,sztuczny,0
|
||||||
|
0.70,piaszczyste,0.72,0.79,kaktus,sztuczny,0
|
||||||
|
0.54,czarnoziemy,0.95,0.59,ziemniak,organiczny,0
|
||||||
|
0.21,piaszczyste,0.05,0.03,brak,mineralny,1
|
||||||
|
0.23,brunatne,0.11,0.86,ziemniak,organiczny,1
|
||||||
|
0.61,czarnoziemy,0.76,0.76,ziemniak,sztuczny,0
|
||||||
|
0.87,brunatne,0.53,0.85,pszenica,organiczny,0
|
||||||
|
0.21,brunatne,0.01,0.26,kaktus,mineralny,1
|
||||||
|
0.32,piaszczyste,0.06,0.40,ziemniak,mineralny,1
|
||||||
|
0.76,czarnoziemy,0.79,0.67,pszenica,mineralny,0
|
||||||
|
0.30,brunatne,0.21,0.10,brak,mineralny,1
|
||||||
|
0.66,piaszczyste,0.93,0.95,kaktus,sztuczny,0
|
||||||
|
0.71,brunatne,0.52,0.62,ziemniak,mineralny,0
|
||||||
|
0.43,piaszczyste,0.38,0.35,pszenica,sztuczny,1
|
||||||
|
0.66,brunatne,0.72,0.63,pszenica,organiczny,0
|
||||||
|
0.21,piaszczyste,0.47,0.96,brak,sztuczny,1
|
||||||
|
0.78,brunatne,0.59,0.68,pszenica,organiczny,0
|
||||||
|
0.85,piaszczyste,0.77,0.64,pszenica,organiczny,0
|
||||||
|
0.84,piaszczyste,0.75,0.86,ziemniak,sztuczny,0
|
||||||
|
0.71,czarnoziemy,0.72,0.74,ziemniak,mineralny,1
|
||||||
|
0.75,piaszczyste,0.77,0.74,ziemniak,sztuczny,0
|
||||||
|
0.76,piaszczyste,0.75,0.81,pszenica,mineralny,0
|
||||||
|
0.72,brunatne,0.74,0.84,kaktus,sztuczny,0
|
||||||
|
0.59,brunatne,0.82,0.88,pszenica,organiczny,0
|
||||||
|
0.48,czarnoziemy,0.15,0.27,ziemniak,organiczny,0
|
||||||
|
0.04,piaszczyste,0.90,0.8,pszenica,organiczny,0
|
||||||
|
0.23,brunatne,0.12,0.56,brak,organiczny,1
|
||||||
|
0.02,piaszczyste,0.20,0.18,brak,organiczny,1
|
||||||
|
0.02,piaszczyste,0.35,0.24,ziemniak,mineralny,1
|
||||||
|
0.76,piaszczyste,0.78,0.85,ziemniak,mineralny,0
|
||||||
|
0.72,czarnoziemy,0.67,0.76,brak,mineralny,0
|
||||||
|
0.06,brunatne,0.02,0.71,ziemniak,mineralny,1
|
||||||
|
0.96,czarnoziemy,0.66,0.80,ziemniak,sztuczny,0
|
||||||
|
0.34,brunatne,0.22,0.15,kaktus,mineralny,0
|
||||||
|
0.78,piaszczyste,0.62,0.68,pszenica,mineralny,0
|
||||||
|
0.01,czarnoziemy,0.22,0.05,pszenica,sztuczny,1
|
||||||
|
0.02,czarnoziemy,0.31,0.80,pszenica,sztuczny,1
|
||||||
|
0.11,piaszczyste,0.14,0.14,pszenica,organiczny,1
|
||||||
|
0.95,piaszczyste,0.61,0.94,brak,sztuczny,0
|
||||||
|
0.78,brunatne,0.86,0.63,pszenica,organiczny,0
|
||||||
|
0.03,brunatne,0.27,0.25,pszenica,sztuczny,1
|
||||||
|
0.62,czarnoziemy,0.75,0.75,ziemniak,sztuczny,0
|
||||||
|
0.24,piaszczyste,0.02,0.23,pszenica,organiczny,1
|
||||||
|
0.46,czarnoziemy,0.79,0.27,ziemniak,sztuczny,0
|
||||||
|
0.24,piaszczyste,0.74,0.53,pszenica,mineralny,1
|
||||||
|
0.82,czarnoziemy,0.77,0.86,ziemniak,mineralny,0
|
||||||
|
0.25,brunatne,0.18,0.23,pszenica,sztuczny,1
|
||||||
|
0.73,czarnoziemy,0.94,0.54,brak,organiczny,0
|
||||||
|
0.63,piaszczyste,0.84,0.92,kaktus,sztuczny,0
|
||||||
|
0.78,czarnoziemy,0.75,0.94,brak,sztuczny,0
|
||||||
|
0.84,piaszczyste,0.79,0.80,pszenica,sztuczny,0
|
||||||
|
0.78,czarnoziemy,0.95,0.63,pszenica,mineralny,0
|
||||||
|
0.43,brunatne,0.38,0.52,pszenica,organiczny,1
|
||||||
|
0.88,piaszczyste,0.84,0.78,ziemniak,sztuczny,0
|
||||||
|
0.69,brunatne,0.86,0.55,ziemniak,organiczny,0
|
||||||
|
0.77,piaszczyste,0.78,0.55,ziemniak,organiczny,0
|
||||||
|
0.26,brunatne,0.24,0.12,ziemniak,mineralny,1
|
||||||
|
0.75,czarnoziemy,0.64,0.73,brak,mineralny,0
|
||||||
|
0.14,piaszczyste,0.38,0.44,pszenica,sztuczny,1
|
||||||
|
0.84,czarnoziemy,0.85,0.67,ziemniak,organiczny,0
|
||||||
|
0.33,brunatne,0.11,0.12,brak,organiczny,1
|
||||||
|
0.89,brunatne,0.67,0.88,brak,organiczny,0
|
||||||
|
0.15,brunatne,0.21,0.23,pszenica,mineralny,1
|
||||||
|
0.07,piaszczyste,0.24,0.67,brak,sztuczny,1
|
||||||
|
0.29,czarnoziemy,0.10,0.14,ziemniak,sztuczny,1
|
||||||
|
0.99,piaszczyste,0.99,0.75,kaktus,mineralny,0
|
||||||
|
0.62,piaszczyste,0.65,0.75,brak,organiczny,0
|
||||||
|
0.33,czarnoziemy,0.23,0.23,brak,sztuczny,1
|
||||||
|
0.16,brunatne,0.28,0.38,brak,organiczny,1
|
||||||
|
0.35,piaszczyste,0.18,0.13,ziemniak,mineralny,0
|
||||||
|
0.85,czarnoziemy,0.64,0.74,pszenica,sztuczny,0
|
||||||
|
0.78,czarnoziemy,0.59,0.72,ziemniak,organiczny,0
|
||||||
|
0.24,czarnoziemy,0.14,0.18,brak,organiczny,1
|
||||||
|
0.25,czarnoziemy,0.13,0.16,pszenica,sztuczny,1
|
||||||
|
0.87,czarnoziemy,0.87,0.76,pszenica,mineralny,0
|
||||||
|
0.28,brunatne,0.44,0.27,brak,mineralny,1
|
||||||
|
0.47,brunatne,0.09,0.05,ziemniak,mineralny,1
|
||||||
|
0.68,piaszczyste,0.72,0.67,brak,sztuczny,0
|
||||||
|
0.23,czarnoziemy,0.27,0.25,pszenica,sztuczny,1
|
||||||
|
0.05,piaszczyste,0.11,0.16,brak,organiczny,1
|
||||||
|
0.12,piaszczyste,0.21,0.22,brak,mineralny,1
|
||||||
|
0.86,brunatne,0.55,0.67,ziemniak,organiczny,0
|
||||||
|
0.68,brunatne,0.76,0.87,pszenica,organiczny,0
|
||||||
|
0.04,brunatne,0.32,0.26,kaktus,sztuczny,1
|
||||||
|
0.73,piaszczyste,0.73,0.73,pszenica,sztuczny,0
|
||||||
|
0.01,czarnoziemy,0.42,0.34,ziemniak,mineralny,1
|
||||||
|
0.96,piaszczyste,0.70,0.71,ziemniak,organiczny,0
|
||||||
|
0.74,piaszczyste,0.66,0.79,kaktus,mineralny,0
|
||||||
|
0.75,brunatne,0.66,0.82,pszenica,mineralny,0
|
||||||
|
0.70,brunatne,0.69,0.63,pszenica,organiczny,0
|
||||||
|
0.66,brunatne,0.85,0.72,brak,sztuczny,0
|
||||||
|
0.73,piaszczyste,0.58,0.95,ziemniak,mineralny,0
|
||||||
|
0.36,brunatne,0.14,0.02,brak,mineralny,0
|
||||||
|
0.61,piaszczyste,0.70,0.66,pszenica,mineralny,0
|
||||||
|
0.83,piaszczyste,0.68,0.75,ziemniak,sztuczny,0
|
||||||
|
0.55,brunatne,0.68,0.79,ziemniak,sztuczny,0
|
||||||
|
0.75,czarnoziemy,0.64,0.58,kaktus,organiczny,0
|
||||||
|
0.99,brunatne,0.57,0.82,pszenica,organiczny,0
|
||||||
|
0.88,czarnoziemy,0.68,0.65,brak,sztuczny,0
|
||||||
|
0.58,czarnoziemy,0.68,0.71,ziemniak,organiczny,1
|
||||||
|
0.14,piaszczyste,0.46,0.17,brak,sztuczny,1
|
||||||
|
0.06,czarnoziemy,0.23,0.25,kaktus,sztuczny,1
|
||||||
|
0.56,brunatne,0.88,0.65,ziemniak,organiczny,0
|
||||||
|
0.32,brunatne,0.39,0.23,pszenica,organiczny,1
|
||||||
|
0.64,piaszczyste,0.85,0.99,ziemniak,mineralny,0
|
||||||
|
0.25,czarnoziemy,0.26,0.45,kaktus,organiczny,0
|
||||||
|
0.78,piaszczyste,0.85,0.92,brak,mineralny,0
|
||||||
|
0.14,brunatne,0.09,0.13,pszenica,organiczny,1
|
||||||
|
0.82,brunatne,0.81,0.80,brak,mineralny,0
|
||||||
|
0.65,piaszczyste,0.58,0.78,pszenica,mineralny,0
|
||||||
|
0.32,piaszczyste,0.25,0.04,ziemniak,organiczny,1
|
||||||
|
0.33,czarnoziemy,0.12,0.46,kaktus,sztuczny,0
|
||||||
|
0.58,czarnoziemy,0.76,0.66,pszenica,mineralny,0
|
||||||
|
0.01,czarnoziemy,0.32,0.33,ziemniak,mineralny,1
|
||||||
|
0.65,brunatne,0.88,0.66,ziemniak,organiczny,0
|
||||||
|
0.12,czarnoziemy,0.16,0.13,brak,mineralny,1
|
||||||
|
0.86,brunatne,0.98,0.88,brak,sztuczny,0
|
||||||
|
0.23,brunatne,0.15,0.15,ziemniak,mineralny,1
|
||||||
|
0.24,piaszczyste,0.37,0.34,kaktus,mineralny,0
|
||||||
|
0.05,brunatne,0.18,0.39,ziemniak,mineralny,1
|
||||||
|
0.23,czarnoziemy,0.26,0.35,ziemniak,organiczny,1
|
||||||
|
0.55,czarnoziemy,0.78,0.89,brak,organiczny,0
|
||||||
|
0.25,czarnoziemy,0.13,0.47,brak,mineralny,1
|
||||||
|
0.62,czarnoziemy,0.82,0.68,brak,sztuczny,0
|
||||||
|
0.85,czarnoziemy,0.64,0.56,brak,mineralny,0
|
||||||
|
0.58,piaszczyste,0.94,0.74,brak,sztuczny,0
|
||||||
|
0.17,piaszczyste,0.34,0.15,ziemniak,mineralny,1
|
||||||
|
0.26,czarnoziemy,0.21,0.15,pszenica,mineralny,1
|
||||||
|
0.22,czarnoziemy,0.35,0.45,pszenica,mineralny,1
|
||||||
|
0.21,piaszczyste,0.26,0.26,pszenica,organiczny,1
|
||||||
|
0.38,piaszczyste,0.36,0.14,pszenica,mineralny,1
|
||||||
|
0.17,piaszczyste,0.38,0.27,pszenica,organiczny,1
|
||||||
|
0.11,piaszczyste,0.21,0.23,pszenica,sztuczny,1
|
||||||
|
0.48,czarnoziemy,0.29,0.28,kaktus,organiczny,0
|
||||||
|
0.16,czarnoziemy,0.21,0.56,ziemniak,organiczny,1
|
||||||
|
0.22,piaszczyste,0.22,0.19,ziemniak,sztuczny,1
|
||||||
|
0.63,czarnoziemy,0.87,0.77,pszenica,mineralny,0
|
||||||
|
0.69,piaszczyste,0.85,0.78,brak,mineralny,0
|
||||||
|
0.55,brunatne,0.50,0.79,brak,organiczny,0
|
||||||
|
0.14,piaszczyste,0.14,0.35,ziemniak,mineralny,1
|
||||||
|
0.95,czarnoziemy,0.82,0.92,pszenica,organiczny,0
|
||||||
|
0.68,piaszczyste,0.57,0.62,pszenica,mineralny,0
|
||||||
|
0.60,brunatne,0.66,0.85,ziemniak,mineralny,0
|
||||||
|
0.50,brunatne,0.91,0.83,ziemniak,organiczny,0
|
||||||
|
0.36,piaszczyste,0.08,0.75,kaktus,mineralny,0
|
||||||
|
0.13,brunatne,0.26,0.38,kaktus,sztuczny,1
|
||||||
|
0.32,piaszczyste,0.25,0.24,ziemniak,sztuczny,1
|
||||||
|
0.84,brunatne,0.54,0.50,brak,mineralny,0
|
||||||
|
0.31,czarnoziemy,0.49,0.14,pszenica,organiczny,1
|
||||||
|
0.62,piaszczyste,0.74,0.85,kaktus,sztuczny,0
|
||||||
|
0.85,czarnoziemy,0.67,0.74,brak,organiczny,0
|
||||||
|
0.74,piaszczyste,0.69,0.98,ziemniak,organiczny,0
|
||||||
|
0.16,piaszczyste,0.16,0.36,pszenica,mineralny,1
|
||||||
|
0.01,czarnoziemy,0.12,0.29,ziemniak,organiczny,1
|
||||||
|
0.55,brunatne,0.67,0.74,brak,sztuczny,0
|
||||||
|
0.75,czarnoziemy,0.86,0.90,ziemniak,sztuczny,0
|
||||||
|
0.42,czarnoziemy,0.25,0.39,kaktus,sztuczny,0
|
||||||
|
0.25,brunatne,0.30,0.24,ziemniak,organiczny,1
|
||||||
|
0.12,czarnoziemy,0.20,0.49,ziemniak,mineralny,1
|
||||||
|
0.75,brunatne,0.75,0.54,pszenica,organiczny,0
|
||||||
|
0.65,czarnoziemy,0.82,0.76,pszenica,mineralny,0
|
||||||
|
0.79,czarnoziemy,0.66,0.77,pszenica,sztuczny,0
|
||||||
|
0.62,brunatne,0.78,0.84,brak,mineralny,0
|
||||||
|
0.05,czarnoziemy,0.19,0.17,brak,organiczny,1
|
||||||
|
0.22,czarnoziemy,0.24,0.25,kaktus,organiczny,1
|
||||||
|
0.17,brunatne,0.31,0.35,ziemniak,mineralny,1
|
||||||
|
0.91,brunatne,0.58,0.89,ziemniak,sztuczny,0
|
||||||
|
0.07,brunatne,0.27,0.27,ziemniak,organiczny,1
|
||||||
|
0.32,piaszczyste,0.12,0.18,brak,organiczny,1
|
BIN
assets/images/cactus.png
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
assets/images/dirt_cactus.jpg
Normal file
After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
BIN
assets/images/dirt_potato.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
assets/images/dirt_wheat.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
assets/images/farmland_cactus.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
assets/images/farmland_empty.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
assets/images/farmland_potato.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
assets/images/farmland_wheat.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
assets/images/potato.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
assets/images/wheat.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/model/xgboost_model.pkl
Normal file
77
main.py
@ -1,30 +1,31 @@
|
|||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
|
from src.utils.xgb_model import Model
|
||||||
from src.world import World
|
from src.world import World
|
||||||
from src.tractor import Tractor
|
from src.tractor import Tractor
|
||||||
from src.settings import Settings
|
from src.settings import Settings
|
||||||
from utils.astar import a_star_search
|
from src.utils.bfs import BFSSearcher
|
||||||
|
from src.constants import Constants as C
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
|
||||||
settings = Settings() # ustawienia pygame
|
settings = Settings()
|
||||||
world = World(settings) # stworzenie mapy na bazie ustawień pygame
|
model = Model()
|
||||||
tractor = Tractor("Spalinowy", "Nawóz 1", settings, 8 * settings.tile_size, 8 * settings.tile_size) # stworzenie traktora z podanymi argumentami
|
world = World(settings, model)
|
||||||
obstacles = [tile for tile in world.tiles if tile.type == 'rock'] # stworzenie listy z przeszkodami, kamień = przeszkoda
|
tractor = Tractor("Spalinowy", "Nawóz 1", settings, 0 * settings.tile_size, 0 * settings.tile_size, C.RIGHT)
|
||||||
|
plants_to_water = [tile for tile in world.tiles if tile.to_water == 1]
|
||||||
clock = pygame.time.Clock() # FPS purpose
|
clock = pygame.time.Clock() # FPS purpose
|
||||||
|
|
||||||
screen = pygame.display.set_mode((settings.screen_width, settings.screen_height)) # tworzenie ekranu
|
screen = pygame.display.set_mode((settings.screen_width, settings.screen_height))
|
||||||
pygame.display.set_caption('TRAKTOHOLIK') # nazwa okna
|
pygame.display.set_caption('TRAKTOHOLIK')
|
||||||
|
|
||||||
start_cords = (8, 1)
|
|
||||||
goals = [(8, 7), (7, 7), (0, 0)]
|
|
||||||
end_cords = goals[0]
|
|
||||||
start_dir = tractor.curr_direction # przypisanie początkowego ustawienia traktora do zmiennej
|
|
||||||
# path = BFSSearcher().search(start_cords, end_cords, start_dir) # wygenerowanie listy ruchów na bazie BFS
|
|
||||||
path = a_star_search(start_cords, end_cords, start_dir, world) # generowanie ścieżki za pomocą A*
|
|
||||||
|
|
||||||
|
start_cords = tractor.curr_position
|
||||||
|
goals = [plant.position for plant in plants_to_water]
|
||||||
|
cords_idx = tractor.find_nearest_cords(tractor.curr_position, goals)
|
||||||
|
end_cords = goals[cords_idx]
|
||||||
|
start_dir = tractor.curr_direction
|
||||||
|
path = BFSSearcher().search(start_cords, end_cords, start_dir)
|
||||||
|
|
||||||
run = True
|
run = True
|
||||||
while run:
|
while run:
|
||||||
@ -37,22 +38,46 @@ def main():
|
|||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
run = False
|
run = False
|
||||||
|
|
||||||
# iteracja przez listę ruchów
|
|
||||||
if path:
|
if path:
|
||||||
action = path.pop(0) # pobranie pierwszego ruchu z listy
|
action = path.pop(0)
|
||||||
tractor.update(action) # wykonanie ruchu przez traktor
|
tractor.update(action)
|
||||||
else:
|
else:
|
||||||
if len(goals) > 1: # sprawdzenie czy są inne cele
|
tractor.water_plant(world, end_cords)
|
||||||
new_start = goals.pop(0) # pobierz współrzędne pierwszego celu i ustaw jako początkowe
|
if len(goals) > 1:
|
||||||
end_cords = goals[0] # ustaw kolejny cel
|
start_cord = goals.pop(cords_idx)
|
||||||
start_dir = tractor.curr_direction # aktualizacja kierunku traktora
|
cords_idx = tractor.find_nearest_cords(tractor.curr_position, goals)
|
||||||
# path = BFSSearcher().search(start_cord, end_cords, start_dir) # generacja nowej ścieżki
|
end_cords = goals[cords_idx]
|
||||||
path = a_star_search(new_start, end_cords, start_dir, world)
|
start_dir = tractor.curr_direction
|
||||||
|
path = BFSSearcher().search(start_cord, end_cords, start_dir)
|
||||||
|
|
||||||
pygame.time.wait(settings.freeze_time)
|
pygame.time.wait(settings.freeze_time)
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
# if __name__ == '__main__':
|
||||||
main()
|
#
|
||||||
|
# # inicjalizacja array z zerami
|
||||||
|
# rows = 10
|
||||||
|
# cols = 10
|
||||||
|
# field = np.zeros((rows, cols), dtype=int)
|
||||||
|
#
|
||||||
|
# # tworzenie ścian w array
|
||||||
|
# for i in range(0, 9):
|
||||||
|
# field[1, i] = 1
|
||||||
|
#
|
||||||
|
# field[2, 8] = 1
|
||||||
|
# field[3, 8] = 1
|
||||||
|
# field[3, 7] = 1
|
||||||
|
# field[3, 6] = 1
|
||||||
|
#
|
||||||
|
# print(field)
|
||||||
|
#
|
||||||
|
# start = (0, 0)
|
||||||
|
# goals = [(2, 7)]
|
||||||
|
# while goals:
|
||||||
|
# goal = goals.pop(0)
|
||||||
|
# path = a_star(field, start, goal)
|
||||||
|
# print(path)
|
||||||
|
|
||||||
|
main()
|
@ -10,6 +10,9 @@ class Settings:
|
|||||||
self.screen_width = 700
|
self.screen_width = 700
|
||||||
self.screen_height = 700
|
self.screen_height = 700
|
||||||
|
|
||||||
|
# World settings
|
||||||
|
self.world_size = 10
|
||||||
|
|
||||||
# Tile settings
|
# Tile settings
|
||||||
self.tile_size = 70
|
self.tile_size = 70
|
||||||
|
|
||||||
|
22
src/tile.py
@ -4,7 +4,8 @@ from pygame.sprite import Sprite
|
|||||||
class Tile(Sprite):
|
class Tile(Sprite):
|
||||||
""" Class to represent single board tile """
|
""" Class to represent single board tile """
|
||||||
|
|
||||||
def __init__(self, type, row_id, col_id, image, rect, cost):
|
def __init__(self, type, row_id, col_id, image, rect, cost, stan_nawodnienia, rodzaj_gleby,
|
||||||
|
stan_nawiezienia, stopien_rozwoju, rodzaj_rosliny, rodzaj_nawozu, to_water):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.type = type
|
self.type = type
|
||||||
self.row_id = row_id
|
self.row_id = row_id
|
||||||
@ -13,18 +14,15 @@ class Tile(Sprite):
|
|||||||
self.image = image
|
self.image = image
|
||||||
self.rect = rect
|
self.rect = rect
|
||||||
self.cost = cost
|
self.cost = cost
|
||||||
self.plant = None
|
|
||||||
self.hydration = 0
|
|
||||||
self.fertilizer = None
|
|
||||||
self.is_fertilized = False
|
|
||||||
|
|
||||||
def add_plant(self, plant):
|
|
||||||
self.plant = plant
|
|
||||||
|
|
||||||
def remove_plant(self):
|
|
||||||
self.plant = None
|
|
||||||
|
|
||||||
|
|
||||||
|
# nwm, ten kod po polsku moze kiedys do zmiany, póki co mi sie nie chce
|
||||||
|
self.stan_nawodnienia = stan_nawodnienia
|
||||||
|
self.rodzaj_gleby = rodzaj_gleby
|
||||||
|
self.stan_nawiezienia = stan_nawiezienia
|
||||||
|
self.stopien_rozwoju = stopien_rozwoju
|
||||||
|
self.rodzaj_rosliny = rodzaj_rosliny
|
||||||
|
self.rodzaj_nawozu = rodzaj_nawozu
|
||||||
|
self.to_water = to_water
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
import pygame
|
import pygame
|
||||||
|
import numpy as np
|
||||||
|
from scipy import spatial
|
||||||
from pygame.sprite import Sprite
|
from pygame.sprite import Sprite
|
||||||
from constants import Constants as C
|
from constants import Constants as C
|
||||||
|
|
||||||
|
|
||||||
class Tractor(Sprite):
|
class Tractor(Sprite):
|
||||||
""" Class to represent our agent """
|
""" Class to represent our agent """
|
||||||
|
|
||||||
def __init__(self, engine, fertilizer, settings, x, y):
|
def __init__(self, engine, fertilizer, settings, initial_x, initial_y, initial_direction):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.image = pygame.transform.scale(pygame.image.load('assets/images/tractor/tractor-transparent-up.png'),
|
self.image = pygame.transform.scale(pygame.image.load('assets/images/tractor/tractor-transparent-right.png'),
|
||||||
(self.settings.tile_size, self.settings.tile_size))
|
(self.settings.tile_size - 1, self.settings.tile_size - 1))
|
||||||
self.rect = self.image.get_rect()
|
self.rect = self.image.get_rect()
|
||||||
self.rect.x = x
|
self.rect.x = initial_x
|
||||||
self.rect.y = y
|
self.rect.y = initial_y
|
||||||
self.curr_direction = C.UP # wektor w ukladzie wspolrzednych wskazujacy kierunek traktora
|
self.curr_position = (round(self.rect.x / self.settings.tile_size),
|
||||||
|
self.settings.world_size - round(self.rect.y / self.settings.tile_size) - 1)
|
||||||
|
self.curr_direction = initial_direction # wektor w ukladzie wspolrzednych wskazujacy kierunek traktora
|
||||||
self.engine = engine
|
self.engine = engine
|
||||||
self.fertilizer = fertilizer
|
self.fertilizer = fertilizer
|
||||||
|
|
||||||
@ -80,15 +85,56 @@ class Tractor(Sprite):
|
|||||||
|
|
||||||
pygame.time.wait(self.settings.freeze_time) # bez tego sie kreci jak hot-wheels
|
pygame.time.wait(self.settings.freeze_time) # bez tego sie kreci jak hot-wheels
|
||||||
|
|
||||||
def check_collision(self, obstacles):
|
def water_plant(self, world, position):
|
||||||
if pygame.sprite.spritecollideany(self, obstacles):
|
plant = world.get_tile(position[0], position[1])
|
||||||
print('yes')
|
|
||||||
self.rect.x -= self.curr_direction[0] * self.settings.tile_size # no to troche prymitywne jest, ale
|
if plant.rodzaj_rosliny == 'brak':
|
||||||
self.rect.y += self.curr_direction[1] * self.settings.tile_size # jak wejdzie na kolizje to cofamy ruch
|
plant.image = pygame.transform.scale(world.farmland_empty,
|
||||||
|
(self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif plant.rodzaj_rosliny == 'kaktus':
|
||||||
|
plant.image = pygame.transform.scale(world.farmland_cactus,
|
||||||
|
(self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif plant.rodzaj_rosliny == 'pszenica':
|
||||||
|
plant.image = pygame.transform.scale(world.farmland_wheat,
|
||||||
|
(self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif plant.rodzaj_rosliny == 'ziemniak':
|
||||||
|
plant.image = pygame.transform.scale(world.farmland_potato,
|
||||||
|
(self.settings.tile_size, self.settings.tile_size))
|
||||||
|
|
||||||
|
def find_nearest_cords(self, curr_cords, cords_lst):
|
||||||
|
# source https://stackoverflow.com/questions/39107896/efficiently-finding-the-closest-coordinate-pair-from-a-set-in-python
|
||||||
|
tree = spatial.KDTree(cords_lst)
|
||||||
|
return tree.query(curr_cords)[1]
|
||||||
|
|
||||||
|
# moze sie jeszcze kiedys przyda
|
||||||
|
# def water_plants(self, plants, plants_lst, goals, world):
|
||||||
|
# hit_list = pygame.sprite.spritecollide(sprite=self, group=plants, dokill=False)
|
||||||
|
#
|
||||||
|
# print(goals)
|
||||||
|
#
|
||||||
|
# for plant in hit_list:
|
||||||
|
# if plant.rodzaj_rosliny == 'brak':
|
||||||
|
# plant.image = pygame.transform.scale(world.farmland_empty, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
# elif plant.rodzaj_rosliny == 'kaktus':
|
||||||
|
# plant.image = pygame.transform.scale(world.farmland_cactus, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
# elif plant.rodzaj_rosliny == 'pszenica':
|
||||||
|
# plant.image = pygame.transform.scale(world.farmland_wheat, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
# elif plant.rodzaj_rosliny == 'ziemniak':
|
||||||
|
# plant.image = pygame.transform.scale(world.farmland_potato, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
#
|
||||||
|
# if plant.position in goals:
|
||||||
|
# goals.remove(plant.position)
|
||||||
|
|
||||||
|
|
||||||
|
# if pygame.sprite.spritecollideany(self, obstacles):
|
||||||
|
# print(len(obstacles))
|
||||||
|
# self.rect.x -= self.curr_direction[0] * self.settings.tile_size # no to troche prymitywne jest, ale
|
||||||
|
# self.rect.y += self.curr_direction[1] * self.settings.tile_size # jak wejdzie na kolizje to cofamy ruch
|
||||||
# w przyszlosci mozna zmienic
|
# w przyszlosci mozna zmienic
|
||||||
|
|
||||||
def update(self, action):
|
def update(self, action):
|
||||||
|
self.curr_position = (round(self.rect.x / self.settings.tile_size),
|
||||||
|
self.settings.world_size - round(self.rect.y / self.settings.tile_size) - 1)
|
||||||
if action == C.ROTATE_RIGHT and self.rect.x:
|
if action == C.ROTATE_RIGHT and self.rect.x:
|
||||||
self.turn_right()
|
self.turn_right()
|
||||||
elif action == C.ROTATE_LEFT:
|
elif action == C.ROTATE_LEFT:
|
||||||
|
7123
src/utils/.ipynb_checkpoints/create_model-checkpoint.ipynb
Normal file
22011
src/utils/create_model.html
Normal file
7123
src/utils/create_model.ipynb
Normal file
27
src/utils/xgb_model.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import pickle
|
||||||
|
import xgboost
|
||||||
|
|
||||||
|
|
||||||
|
class Model:
|
||||||
|
""" Class to represent trained XGBoost model that predicts data on our board """
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.input_path = 'assets/data/test.csv'
|
||||||
|
self.df = pd.read_csv(self.input_path)
|
||||||
|
self.model = pickle.load(open('assets/model/xgboost_model.pkl', 'rb'))
|
||||||
|
self.X_test = None
|
||||||
|
self.y_test = None
|
||||||
|
self.parse_input()
|
||||||
|
self.predict_data()
|
||||||
|
|
||||||
|
def parse_input(self):
|
||||||
|
self.y_test = self.df['to_water']
|
||||||
|
self.df = self.df.drop('to_water', axis=1)
|
||||||
|
self.X_test = pd.get_dummies(self.df)
|
||||||
|
|
||||||
|
def predict_data(self):
|
||||||
|
prediction = self.model.predict(self.X_test)
|
||||||
|
# print(self.y_test[self.y_test != prediction])
|
||||||
|
self.df['to_water'] = prediction
|
||||||
|
|
94
src/world.py
@ -5,40 +5,85 @@ from src.tile import Tile
|
|||||||
class World:
|
class World:
|
||||||
""" Class to represent complete game board, storing Tile classes inside Sprite Group """
|
""" Class to represent complete game board, storing Tile classes inside Sprite Group """
|
||||||
|
|
||||||
def __init__(self, settings):
|
def __init__(self, settings, model):
|
||||||
self.world_data = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
||||||
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
|
|
||||||
self.dirt_image = pygame.image.load('assets/images/dirt.jpeg')
|
|
||||||
self.rock_image = pygame.image.load('assets/images/cobblestone.jpg')
|
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
self.model = model
|
||||||
|
self.world_data = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
||||||
|
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
||||||
|
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
||||||
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
||||||
|
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
||||||
|
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
||||||
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
|
||||||
|
self.rock = pygame.image.load('assets/images/cobblestone.jpg')
|
||||||
|
self.dirt_empty = pygame.image.load('assets/images/dirt_empty.jpeg')
|
||||||
|
self.dirt_cactus = pygame.image.load('assets/images/dirt_cactus.jpg')
|
||||||
|
self.dirt_wheat = pygame.image.load('assets/images/dirt_wheat.jpg')
|
||||||
|
self.dirt_potato = pygame.image.load('assets/images/dirt_potato.jpg')
|
||||||
|
self.farmland_empty = pygame.image.load('assets/images/farmland_empty.png')
|
||||||
|
self.farmland_cactus = pygame.image.load('assets/images/farmland_cactus.jpg')
|
||||||
|
self.farmland_wheat = pygame.image.load('assets/images/farmland_wheat.jpg')
|
||||||
|
self.farmland_potato = pygame.image.load('assets/images/farmland_potato.jpg')
|
||||||
self.tiles = pygame.sprite.Group() # mamy tiles jako Sprite Group, to sie przyda potem do kolizji itp.
|
self.tiles = pygame.sprite.Group() # mamy tiles jako Sprite Group, to sie przyda potem do kolizji itp.
|
||||||
self.create_tiles()
|
self.create_tiles()
|
||||||
|
|
||||||
def create_tiles(self):
|
def create_tiles(self):
|
||||||
row_count = 0
|
row_count = 0
|
||||||
|
df_idx = 0
|
||||||
for row in self.world_data:
|
for row in self.world_data:
|
||||||
col_count = 0
|
col_count = 0
|
||||||
for tile in row:
|
for tile in row:
|
||||||
if tile == 1:
|
if tile == 1:
|
||||||
img = pygame.transform.scale(self.dirt_image, (self.settings.tile_size, self.settings.tile_size))
|
type = 'dirt' # type dirt mówimy nam ogólnie, ze jest to pole uprawne, szczegóły rośliny potem
|
||||||
type = 'dirt'
|
cost = 0
|
||||||
cost = 1
|
stan_nawodnienia = self.model.df.iloc[df_idx]['stan_nawodnienia']
|
||||||
|
rodzaj_gleby = self.model.df.iloc[df_idx]['rodzaj_gleby']
|
||||||
|
stan_nawiezienia = self.model.df.iloc[df_idx]['stan_nawiezienia']
|
||||||
|
stopien_rozwoju = self.model.df.iloc[df_idx]['stopien_rozwoju']
|
||||||
|
rodzaj_rosliny = self.model.df.iloc[df_idx]['rodzaj_rosliny']
|
||||||
|
rodzaj_nawozu = self.model.df.iloc[df_idx]['rodzaj_nawozu']
|
||||||
|
to_water = self.model.df.iloc[df_idx]['to_water']
|
||||||
|
|
||||||
|
if to_water == 0 and rodzaj_rosliny == 'brak':
|
||||||
|
img = pygame.transform.scale(self.farmland_empty, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif to_water == 0 and rodzaj_rosliny == 'kaktus':
|
||||||
|
img = pygame.transform.scale(self.farmland_cactus, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif to_water == 0 and rodzaj_rosliny == 'pszenica':
|
||||||
|
img = pygame.transform.scale(self.farmland_wheat, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif to_water == 0 and rodzaj_rosliny == 'ziemniak':
|
||||||
|
img = pygame.transform.scale(self.farmland_potato, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
if to_water == 1 and rodzaj_rosliny == 'brak':
|
||||||
|
img = pygame.transform.scale(self.dirt_empty, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif to_water == 1 and rodzaj_rosliny == 'kaktus':
|
||||||
|
img = pygame.transform.scale(self.dirt_cactus, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif to_water == 1 and rodzaj_rosliny == 'pszenica':
|
||||||
|
img = pygame.transform.scale(self.dirt_wheat, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
elif to_water == 1 and rodzaj_rosliny == 'ziemniak':
|
||||||
|
img = pygame.transform.scale(self.dirt_potato, (self.settings.tile_size, self.settings.tile_size))
|
||||||
|
df_idx += 1
|
||||||
|
|
||||||
elif tile == 0:
|
elif tile == 0:
|
||||||
img = pygame.transform.scale(self.rock_image, (self.settings.tile_size, self.settings.tile_size))
|
img = pygame.transform.scale(self.rock, (self.settings.tile_size, self.settings.tile_size))
|
||||||
type = 'rock'
|
type = 'rock' # podobnie j.w., na polu rock nie mamy upraw
|
||||||
cost = 1000
|
cost = 100
|
||||||
|
|
||||||
|
stan_nawodnienia = None
|
||||||
|
rodzaj_gleby = None
|
||||||
|
stan_nawiezienia = None
|
||||||
|
stopien_rozwoju = None
|
||||||
|
rodzaj_rosliny = None
|
||||||
|
rodzaj_nawozu = None
|
||||||
|
to_water = None
|
||||||
|
|
||||||
img_rect = img.get_rect()
|
img_rect = img.get_rect()
|
||||||
img_rect.x = col_count * self.settings.tile_size
|
img_rect.x = col_count * self.settings.tile_size
|
||||||
img_rect.y = row_count * self.settings.tile_size
|
img_rect.y = row_count * self.settings.tile_size
|
||||||
tile = Tile(type, col_count, len(self.world_data) - row_count - 1, img, img_rect, cost)
|
tile = Tile(type, col_count, len(self.world_data) - row_count - 1, img, img_rect, cost,
|
||||||
|
stan_nawodnienia, rodzaj_gleby, stan_nawiezienia, stopien_rozwoju, rodzaj_rosliny,
|
||||||
|
rodzaj_nawozu, to_water)
|
||||||
self.tiles.add(tile)
|
self.tiles.add(tile)
|
||||||
col_count += 1
|
col_count += 1
|
||||||
row_count += 1
|
row_count += 1
|
||||||
@ -53,9 +98,12 @@ class World:
|
|||||||
pygame.draw.line(screen, (255, 255, 255), (line * self.settings.tile_size, 0),
|
pygame.draw.line(screen, (255, 255, 255), (line * self.settings.tile_size, 0),
|
||||||
(line * self.settings.tile_size, self.settings.screen_height))
|
(line * self.settings.tile_size, self.settings.screen_height))
|
||||||
|
|
||||||
|
def get_tile(self, x, y):
|
||||||
|
for tile in self.tiles:
|
||||||
|
if tile.position == (x, y):
|
||||||
|
return tile
|
||||||
|
|
||||||
def get_tile_cost(self, x, y):
|
def get_tile_cost(self, x, y):
|
||||||
for tile in self.tiles:
|
for tile in self.tiles:
|
||||||
if tile.position == (x, y):
|
if tile.position == (x, y):
|
||||||
return tile.cost
|
return tile.cost
|
||||||
|
|
||||||
|
|