Skip to content

Commit

Permalink
Update with the latest 5.0-SNAPSHOT changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Nov 10, 2024
1 parent 5d4a592 commit 6106c7a
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import org.moeaframework.algorithm.Algorithm;
import org.moeaframework.algorithm.AlgorithmException;
import org.moeaframework.algorithm.extension.Extension;
import org.moeaframework.algorithm.extension.Extensions;
import org.moeaframework.core.Settings;
import org.moeaframework.core.Solution;
import org.moeaframework.core.TypedProperties;
import org.moeaframework.core.population.NondominatedPopulation;
Expand All @@ -50,6 +50,8 @@ public class JMetalAlgorithmAdapter<T extends org.uma.jmetal.solution.Solution<?
* The max evaluations the algorithm is run.
*/
private final int maxEvaluations;

private final Extensions extensions;

/**
* The JMetal solution set.
Expand All @@ -69,9 +71,14 @@ public JMetalAlgorithmAdapter(
ProblemAdapter<T> problem) {
super();
this.algorithm = algorithm;
this.maxEvaluations = (int)properties.getDouble("maxEvaluations",
Settings.DEFAULT_MAX_FUNCTION_EVALUATIONS);
this.maxEvaluations = properties.getTruncatedInt("maxEvaluations");
this.problem = problem;
this.extensions = new JMetalExtensions(this);
}

@Override
public String getName() {
return algorithm.name();
}

@Override
Expand Down Expand Up @@ -145,7 +152,20 @@ public void terminate() {

@Override
public Extensions getExtensions() {
throw new UnsupportedOperationException();
return extensions;
}

private static class JMetalExtensions extends Extensions {

public JMetalExtensions(Algorithm algorithm) {
super(algorithm);
}

@Override
public void add(Extension extension) {
throw new UnsupportedOperationException("JMetal does not support extensions");
}

}

}

0 comments on commit 6106c7a

Please sign in to comment.