public virtual void Evaluate() { int objective_count = mProblem.GetObjectiveCount(); while (mObjectives.Count < objective_count) { mObjectives.Add(0); } for (int objective_index = 0; objective_index < objective_count; ++objective_index) { int sign = mProblem.IsMaximizing() ? (-1) : 1; mObjectives[objective_index] = sign * mProblem.CalcObjective(this, objective_index); } }
/// <summary> /// Implement IProblem.CalcObjective interface method /// </summary> /// <param name="s"></param> /// <param name="objective_index"></param> /// <returns></returns> public double CalcObjective(MOOSolution s, int objective_index) { S original_solution = Convert2SolutionForOriginalProblem(s as S); return(mOriginalProblem.CalcObjective(original_solution, mObjectiveIndex)); }