forked from s425077/PotatoPlan
ml implement
This commit is contained in:
parent
6bb5073048
commit
e406823e47
@ -22,8 +22,8 @@ class Crops
|
||||
SoilProperties soilProperties = new SoilProperties();
|
||||
private float ProductionRate;
|
||||
private float tempRain;
|
||||
public DayNightCycle Time { get; set; }
|
||||
|
||||
private DayNightCycle Time = new DayNightCycle();
|
||||
|
||||
|
||||
|
||||
public void updateCrop(Vector2 newSize, float Rain, DayNightCycle nTime)
|
||||
@ -328,6 +328,28 @@ class Crops
|
||||
|
||||
public float getProductionRate(CropTypes Sample)
|
||||
{
|
||||
float predProd = 1.0f;
|
||||
if (Status > 1)
|
||||
{
|
||||
bool correctSeason = false;
|
||||
foreach (string i in Sample.Season)
|
||||
{
|
||||
if (i == Time.getTimeOfYear() || i == "Whole Year")
|
||||
{
|
||||
correctSeason = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (correctSeason)
|
||||
{
|
||||
predProd = Game1.Sources.ML_Joel.Engine.PredictProductionwithRainfall(soilProperties, Time);
|
||||
predProd = (predProd / soilProperties.Area) / 2;
|
||||
}
|
||||
else
|
||||
predProd = 0.20f;
|
||||
}
|
||||
|
||||
ProductionRate = 1;
|
||||
float min = 1.0f;
|
||||
if (DataSet != null)
|
||||
@ -366,7 +388,7 @@ class Crops
|
||||
ProductionRate = ProductionRate / 1.5f;
|
||||
}
|
||||
ProductionRate = (float)Math.Pow(ProductionRate, 2.5f);
|
||||
return ProductionRate;
|
||||
return ProductionRate * predProd;
|
||||
}
|
||||
|
||||
public float getProductionRate()
|
||||
|
@ -35,13 +35,13 @@ namespace Game1.Sources.ML_Joel
|
||||
PredictionEngineArea = Model.CreateEngineArea();
|
||||
}
|
||||
|
||||
public static float PredictProductionwithRainfall(Crops crop, CropTypes cropTypes)
|
||||
public static float PredictProductionwithRainfall(SoilProperties soilProperties, DayNightCycle Time)
|
||||
{
|
||||
InputArea modelInput = new InputArea
|
||||
{
|
||||
//Season = crop.
|
||||
//Area = crop.getSoilProperties().Area,
|
||||
Rainfall = crop.getSoilProperties().Humidity,
|
||||
Season = Time.getTimeOfYear(),
|
||||
Area = soilProperties.Area,
|
||||
Rainfall = soilProperties.Humidity,
|
||||
};
|
||||
|
||||
return PredictionEngineArea.Predict(modelInput).Score;
|
||||
|
@ -16,7 +16,7 @@ class SmartTractor
|
||||
//What to do next
|
||||
public Path returnChoice()
|
||||
{
|
||||
//System.Threading.St
|
||||
//System.Threading.ThreadStart tractorThread = new System.Threading.ThreadStart(farm.UpdatePreferedCrops);
|
||||
ai.update(farm, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation);
|
||||
farm.UpdatePreferedCrops(Size);
|
||||
farm = ai.changeCropStatus();
|
||||
|
Loading…
Reference in New Issue
Block a user