I am working with the MOEA Framework, and I am having a problem in implementing a solution method. I wrote the following code:
public Solution newSolution(double[] Cond) {
Solution solution = new Solution(Input.General_Inputs.Num_Of_Ppes, Input.General_Inputs.Num_objectives, Input.General_Inputs.Num_Constraints);
for (int Num = 0; Num < Input.General_Inputs.Num_Of_Ppes; Num++) {
if (Cond[Num] > 3) {
solution.setVariable(Num, EncodingUtils.newInt(0, Input.General_Inputs.Num_Alt_Decision_variable[Num]));
}
}
return solution;
}
However, the method doesn't accept the Cond matrix as an input and I have the following error: The method newSolution(double[]) of type Optimization_Problem must override or implement a supertype method
Any suggestions?
The
newSolutionmethod as specified by the interfaceProblemdoesn't accept any arguments to it.It's difficult to say what you should do next, as I'm not sure of your use case, nor am I entirely familiar with the framework. There are two things you could do, though:
Overload the method and provide a default pass-through value to your custom
newSolutionmethod:Instead of passing through the array, try instead to attach it to an instance of it and use that where you need to: