I'm getting an error saying that "org.moeaframework.core.Solution cannot be cast to SensorsSolution". SensorsSolution is a class that extends Solution. Does MOEA allow this? It's a recomended practice?
The reason i'm extending it, is because i need each individual to store information about sensors locations. After evaluating the use of the attributes HashMap of this class and realizing that it's data erases after each evaluation i decided it was the best option. But now i'm facing this problem.
Heres the code that corresponds to the error line:
@Override
public void evaluate(Solution solution) {
System.out.println("class= "+solution.getClass()); //Returning "class SensorsSolution"
SensorsSolution sensorsSolution = (SensorsSolution) solution;
...
}
Thanks.
It sounds like what you want is to save extra information about each function evaluation, information that is computed but not included in the objectives or constraints. This is a frequent request by users of MOEAs. You're on the right track modifying the
evaluatemethod to do something, but I suspect you'd be better off writing the extra information to a SQLite database, HDF5 file, or even a text file. Generally you want to look this information up at the end of the run -- it's not going to do much for you during the run.