1
我正在使用MOEA框架,並且在實施解決方法方面存在問題。我寫了下面的代碼:MOEA框架 - 執行方法的問題
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;
}
然而,該方法不接受電導率矩陣作爲輸入,我有以下錯誤:The method newSolution(double[]) of type Optimization_Problem must override or implement a supertype method
有什麼建議?
這裏真正的問題是,你的主類或者擴展了抽象的東西或者實現了一個接口,而'newSolution'的簽名與你的不同。你能否提供你正在使用的類聲明? – Makoto
感謝您的回覆我正在考慮調整org.moeaframework.core中的Solution方法;要這樣的公共解(INT numberOfVariables,INT numberOfObjectives, \t \t \t INT numberOfConstraints,雙[]電導率){ \t \t變量=新變量[numberOfVariables]; \t \t goals = new double [numberOfObjectives]; \t \t constraints = new double [numberOfConstraints]; \t \t attributes = new HashMap(); \t} –