void SetupNewExperiment() { experiment = new SimpleExperiment(); XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("experiment.config"); xmlConfig.LoadXml(textAsset.text); experiment.SetOptimizer(this); experiment.Initialize("test1", xmlConfig.DocumentElement, NUM_INPUTS, NUM_OUTPUTS); }
// Use this for initialization void Start() { Utility.DebugLog = true; experiment = new SimpleExperiment(); XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("experiment.config"); xmlConfig.LoadXml(textAsset.text); experiment.SetOptimizer(this); // Calculate number of inputs numInputs = 0; AttributesController unitAttrs = Unit.GetComponent <AttributesController>(); SectorSensor[] sectorSensors = Unit.GetComponents <SectorSensor>(); DistanceSensor[] distanceSensors = Unit.GetComponents <DistanceSensor>(); MovementController movement = Unit.GetComponent <MovementController>(); if (unitAttrs != null) { numInputs += unitAttrs.needsFood ? 1 : 0; numInputs += unitAttrs.needsWater ? 1 : 0; } if (movement != null) { numInputs += movement.senseSpeed ? 1 : 0; numInputs += movement.senseSwimming ? 1 : 0; } if (sectorSensors.Length > 0) { foreach (SectorSensor sectorSensor in sectorSensors) { //numInputs += sectorSensor.senseAngles ? sectorSensor.numSectors * 2 : sectorSensor.numSectors; numInputs += sectorSensor.NumSenses; } } if (distanceSensors.Length > 0) { foreach (DistanceSensor distanceSensor in distanceSensors) { numInputs += distanceSensor.numSensors; } } experiment.Initialize("Car Experiment", xmlConfig.DocumentElement, numInputs, NumOutputs); champFileSavePath = Application.persistentDataPath + string.Format("/{0}.champ.xml", SaveFileName); popFileSavePath = Application.persistentDataPath + string.Format("/{0}.pop.xml", SaveFileName); print(champFileSavePath); }
void SetupNewMAPExperiment() { map = new Dictionary <int, NeatGenome> ();//NeatGenome[10]; experiment = new SimpleExperiment(); XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("experiment.config"); xmlConfig.LoadXml(textAsset.text); experiment.SetOptimizer(this); experiment.Initialize("test1", xmlConfig.DocumentElement, NUM_INPUTS, NUM_OUTPUTS); loadMap(); }
// Use this for initialization void Start() { Utility.DebugLog = true; experiment = new SimpleExperiment(); XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("experiment.config"); xmlConfig.LoadXml(textAsset.text); experiment.SetOptimizer(this); experiment.Initialize("Car Experiment", xmlConfig.DocumentElement, NUM_INPUTS, NUM_OUTPUTS); champFileSavePath = Application.persistentDataPath + string.Format("/{0}.champ.xml", "car"); popFileSavePath = Application.persistentDataPath + string.Format("/{0}.pop.xml", "car"); print(champFileSavePath); }
public string trainedObjectName = "bob"; //name of file to use / create // Use this for initialization void Start() { accum = 0; Utility.DebugLog = showDebugger; experiment = new SimpleExperiment(); XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("experiment.config"); xmlConfig.LoadXml(textAsset.text); experiment.SetOptimizer(this); experiment.Initialize(trainedObjectName + " Experiment", xmlConfig.DocumentElement, NUM_INPUTS, NUM_OUTPUTS); champFileSavePath = string.Format("{0}/{1}.champ", "AIAgents", trainedObjectName); popFileSavePath = string.Format("{0}/{1}.pop", "IAgents", trainedObjectName); if (Utility.DebugLog) { Utility.Log(champFileSavePath); } }