I would suggest looking at some of the example problems in src/org/moeaframework/problem/. Below is an example reading the real value from decision variables:
@Override
public void evaluate(Solution solution) {
double x = EncodingUtils.getReal(solution.getVariable(0));
double y = EncodingUtils.getReal(solution.getVariable(1));
double f1 = Math.pow(x, 2.0) + Math.pow(y, 2.0);
double f2 = Math.pow(x+2.0, 2.0) + Math.pow(y, 2.0);
solution.setObjective(0, f1);
solution.setObjective(1, f2);
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "feature-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Feature Requests"
I would suggest looking at some of the example problems in src/org/moeaframework/problem/. Below is an example reading the real value from decision variables: