/** * Evaluates a solution * @param solution The solution to evaluate */ void ZDT1::evaluate(Solution *solution) { XReal * x = new XReal(solution); fx_[0] = x->getValue(0) ; double g = evalG(x) ; double h = evalH(fx_[0], g) ; fx_[1] = h * g ; solution->setObjective(0,fx_[0]); solution->setObjective(1,fx_[1]); delete x ; } // evaluate
/** * Evaluates a solution * @param solution The solution to evaluate */ void ZDT6::evaluate(Solution *solution) { XReal * x = new XReal(solution); double x1 = x->getValue(0) ; fx_[0] = 1.0 - exp(-4.0*x1) * pow(sin(6.0*PI*x1), 6.0) ; double g = evalG(x) ; double h = evalH(fx_[0], g) ; fx_[1] = h * g ; solution->setObjective(0,fx_[0]); solution->setObjective(1,fx_[1]); delete x ; } // evaluate
/** * Evaluates a solution * @param solution The solution to evaluate */ void ZDT5::evaluate(Solution *solution) { Binary * variable ; int counter ; variable = (Binary *)(solution->getDecisionVariables()[0]) ; fx_[0] = 1 + variable->cardinality(); double g = evalG(solution) ; double h = evalH(fx_[0],g) ; fx_[1] = h * g ; solution->setObjective(0,fx_[0]); solution->setObjective(1,fx_[1]); } // evaluate
objectives eval(const variables vars) { double g = evalG(vars); double h = evalH(vars[0], g); return objectives{vars[0], g * h}; }