public stressConstraint(double[,] stateVars, candidate c, GearEvaluator gt) { this.stateVars = stateVars; this.gt = gt; this.c = c; this.findDerivBy = differentiate.Central2; }
public outputSpeedConstraint(double[,] stateVars, GearEvaluator gt) { this.gt = gt; this.outputSpeed = gt.udg.outputSpeed; this.stateVars = stateVars; this.findDerivBy = differentiate.Central2; }
public outputLocationConstraint(double[,] stateVars, candidate c, GearEvaluator gt) { this.gt = gt; this.c = c; this.stateVars = stateVars; this.findDerivBy = differentiate.Central2; this.xtarget = gt.udg.outputLocation[0, 3]; this.ytarget = gt.udg.outputLocation[1, 3]; this.ztarget = gt.udg.outputLocation[2, 3]; this.theta1t = gt.udg.outputLocation[0, 2]; this.theta2t = gt.udg.outputLocation[1, 2]; this.theta3t = gt.udg.outputLocation[2, 2]; }
public static void runSearchProcess() { userDefinedGoals udg = new userDefinedGoals(); Form2 inputBox = new Form2(udg); //inputBox.ShowDialog(); ruleSet.loadAndCompileSourceFiles(rulesets, Program.settings.recompileRules, Program.settings.compiledparamRules, Program.settings.execDir); List <candidate> candidates = new List <candidate>(); candidate current = null; candidate seedCandidate = new candidate(seed, Program.settings.numOfRuleSets); Boolean found = false; candidates.Add(seedCandidate); GearEvaluator ge = new GearEvaluator(udg); Guidance.PNormProportionalPopulationSelection GuidanceApproach = new Guidance.PNormProportionalPopulationSelection(0, Guidance.optimize.minimize, true, true, 1); int maxPop = 10000; while (!found && (candidates.Count != 0)) { current = candidates[0]; candidates.RemoveAt(0); SearchIO.iteration = current.recipe.Count; //RECOGNIZE List <option> ruleChoices = rulesets[0].recognize(current.graph); SearchIO.miscObject = candidates.Count; // if (current.recipe.Count >= 2) { found = isCurrentTheGoal(current, udg); if (found == true) { ge.evalGT(current); break; } } //else current.f0 = double.PositiveInfinity; for (int i = 0; i != ruleChoices.Count; i++) { candidate child = current.copy(); ruleChoices = rulesets[0].recognize(child.graph); ruleChoices[i].apply(child.graph, null); child.addToRecipe(ruleChoices[i]); child.f0 = double.NaN; child.f1 = double.NaN; child.f2 = double.NaN; ge.evalGT(child); child.f3 = (child.f0) / 100 + child.f1; //1 efficiency //2 mass //3 combination addChildToSortedCandList(candidates, child, 3); //candidates.Add(child); } } Program.addAndShowGraphDisplay(current.graph, "Here is your gear train!!!"); candidate.saveToXml(current, "testTuned", settings.outputDirectory); }