public float Evaluate(Vector <float> input) { if (this.isDirty) { var logger = new FishLogger(); var useSim = true; if (useSim) { //start new simulation to get trajactory var body = GeometryFunctions.Load(); var problem = new FishSimulatorOffline.Problem(body, this.activationData); var dt = new IterationDelta(); var sim = new FishSimulatorOffline(problem, dt); sim.TryToRun(); // wait to finish var sol = sim.CurrentSolution as FishSimulatorOffline.Solution; while (sol.IsDone == false) { } logger = sol.logger.DeepCopy(); sim.Dispose(); } var e = GetCurrentE(logger, this.activationData); this.LatestE = e; this.isDirty = false; // Debug.Log("end with e = " + this.LatestE); } //cal new E from RandomX2FDiscreteFunction and trajactory return(this.LatestE); }
protected void Start() { this.fish = this.GetComponent <FishBody>(); this.fish.Init(); this.InitActivations(); this.UpdateAnimationCurves(); this.problem = new FishSimulatorOffline.Problem(this.fish, this.GetCurrentMC()); this.delta = new IterationDelta(); this.sim = new FishSimulatorOffline(problem, this.delta); this.sim.TryToRun(); }
protected void Start() { this.fish = this.GetComponent <FishBody>(); this.fish.Init(); this.runtimeList = this.fish.modelData.FishGraph.Nodes.ToList(); this.InitActivations(); this.UpdateAnimationCurves(); this.problem = new FishSimulatorOffline.Problem(this.fish.modelData, this.activationData); this.delta = new IterationDelta(); this.sim = new FishSimulatorOffline(problem, this.delta); this.sim.TryToRun(); }
protected void Start() { this.body = this.GetComponent <FishBody>(); this.body.Init(); // this.activationData = new FishActivationDataSwimming(this.interval, this.sampleNum); //this.activationData.RandomActivation(); this.activationData = FishActivationData.Load(); this.interval = this.activationData.Interval; this.sampleNum = this.activationData.SampleNum; this.curves = this.activationData.ToAnimationCurves(); this.activations = this.activationData.ToActivationList(); var problem = new FishSimulatorOffline.Problem(this.body.modelData, this.activationData); var dt = new IterationDelta(); var sim = new FishSimulatorOffline(problem, dt); sim.TryToRun(); }