MATP1
package momfo.problems.benchmarks;
import java.io.IOException;
import momfo.core.Problem;
import momfo.core.ProblemSet;
import momfo.problems.base.*;
public class MATP1 {
public static ProblemSet getProblem() throws IOException {
int taskNumber=50;
ProblemSet problemSet = new ProblemSet(taskNumber);
for(int i=1;i<=taskNumber;i++)
problemSet.add(getT(i).get(0));
return problemSet;
}
public static ProblemSet getT(int taskID) throws IOException {
ProblemSet problemSet = new ProblemSet(1);
MMDTLZ prob = new MMDTLZ(2, 50, 1, -100,100);
prob.setGType("sphere");
double[][] matrix = IO.readMatrixFromFile("MData/M1/M1_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S1/S1_"+taskID+".txt");
prob.setRotationMatrix(matrix);
prob.setShiftValues(shiftValues);
((Problem)prob).setName("MATP1-"+taskID);
problemSet.add(prob);
return problemSet;
}
}
int taskNumber=50;
表示 MATP1 问题设置的任务个数是 50,初始化 problemSet 作为一个容器以承载每一个被初始化后的实际 MATP1 问题。 problemSet.add(getT(i).get(0));
意味着此时需要关注的是getT
函数,从MMDTLZ prob = new MMDTLZ(2, 50, 1, -100,100);
prob.setGType("sphere");
看出 MATP_1 是一个双目标的问题,并且决策变量个数为 50,决策变量最小值为-100,最大值为 100,而 G 函数的类型为sphere
,而只要是双目标的函数使用的 H 函数都是circle
// MMDTLZ
if (numberOfObjectives == 2)
hType_ = "circle";
else
hType_ = "sphere";
double[][] matrix = IO.readMatrixFromFile("MData/M1/M1_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S1/S1_"+taskID+".txt");
sphere
和alpha
值 1。(后期通关观察得知,alpha 值是用于计算 cos 函数的)public class MATP2 {
public static ProblemSet getProblem() throws IOException {
int taskNumber=50;
ProblemSet problemSet = new ProblemSet(taskNumber);
for(int i=1;i<=taskNumber;i++)
problemSet.add(getT(i).get(0));
return problemSet;
}
public static ProblemSet getT(int taskID) throws IOException {
ProblemSet problemSet = new ProblemSet(1);
MMZDT prob = new MMZDT(50, 1, -100,100);
prob.setGType("mean");
prob.setHType("concave");
double[][] matrix = IO.readMatrixFromFile("MData/M2/M2_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S2/S2_"+taskID+".txt");
prob.setRotationMatrix(matrix);
prob.setShiftValues(shiftValues);
((Problem)prob).setName("MATP2-"+taskID);
problemSet.add(prob);
return problemSet;
}
}
mean
,设置 H 函数为concave
,最终形状为concave
并且是根据ZDT
问题改编的,而不是DTLZ
问题,表示有 50 个变量,并且 K 值为 1,根据ZDT
问题的默认函数来看,ZDT
问题构造的都是双目标问题。public MMZDT(int numberOfVariables, int k, double lg, double ug) {
numberOfObjectives_ = 2;
numberOfVariables_ = numberOfVariables;
k_ = k;
gType_ = "sphere";
f1Type_ = "linear";
hType_ = "convex";
package momfo.problems.benchmarks;
import java.io.IOException;
import momfo.core.Problem;
import momfo.core.ProblemSet;
import momfo.problems.base.*;
public class MATP3 {
public static ProblemSet getProblem() throws IOException {
int taskNumber=50;
ProblemSet problemSet = new ProblemSet(taskNumber);
for(int i=1;i<=taskNumber;i++)
problemSet.add(getT(i).get(0));
return problemSet;
}
public static ProblemSet getT(int taskID) throws IOException {
ProblemSet problemSet = new ProblemSet(1);
MMZDT prob = new MMZDT(10, 1, -5,5);
prob.setGType("rosenbrock");
prob.setHType("concave");
double[][] matrix = IO.readMatrixFromFile("MData/M3/M3_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S3/S3_"+taskID+".txt");
prob.setRotationMatrix(matrix);
prob.setShiftValues(shiftValues);
((Problem)prob).setName("MATP3-"+taskID);
problemSet.add(prob);
return problemSet;
}
}
rosenbrock
,设置 H 函数为concave
,最终形状为concave
并且是根据ZDT
问题改编的,而不是DTLZ
问题,表示有 50 个这样的任务,并且 K 值为 1,根据ZDT
问题的默认函数来看,ZDT
问题构造的都是双目标问题,与 MATP2 问题不同的是使用 10 个变量,并且变量范围为[-5,5]而不是[-50,50]import java.io.IOException;
import momfo.core.Problem;
import momfo.core.ProblemSet;
import momfo.problems.base.*;
public class MATP4 {
public static ProblemSet getProblem() throws IOException {
int taskNumber=50;
ProblemSet problemSet = new ProblemSet(taskNumber);
for(int i=1;i<=taskNumber;i++)
problemSet.add(getT(i).get(0));
return problemSet;
}
public static ProblemSet getT(int taskID) throws IOException {
ProblemSet problemSet = new ProblemSet(1);
MMDTLZ prob = new MMDTLZ(2, 50, 1, -2,2);
prob.setGType("rastrigin");
double[][] matrix = IO.readMatrixFromFile("MData/M4/M4_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S4/S4_"+taskID+".txt");
prob.setRotationMatrix(matrix);
prob.setShiftValues(shiftValues);
((Problem)prob).setName("MATP4-"+taskID);
problemSet.add(prob);
return problemSet;
}
}
MATP4
使用的是 DTLZ 函数其中具有两个目标函数,具有 50 个决策变量,alpha 值为 1,上界为 2 下界为-2.使用的 G 函数为rastrigin
,使用的 H 函数为sphere
//MMDTLZ
if (numberOfObjectives == 2)
hType_ = "circle";
else
hType_ = "sphere";
package momfo.problems.benchmarks;
import java.io.IOException;
import momfo.core.Problem;
import momfo.core.ProblemSet;
import momfo.problems.base.*;
public class MATP5 {
public static ProblemSet getProblem() throws IOException {
int taskNumber=50;
ProblemSet problemSet = new ProblemSet(taskNumber);
for(int i=1;i<=taskNumber;i++)
problemSet.add(getT(i).get(0));
return problemSet;
}
public static ProblemSet getT(int taskID) throws IOException {
ProblemSet problemSet = new ProblemSet(1);
MMZDT prob = new MMZDT(50, 1, -1,1);
prob.setGType("ackley");
prob.setHType("convex");
double[][] matrix = IO.readMatrixFromFile("MData/M5/M5_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S5/S5_"+taskID+".txt");
prob.setRotationMatrix(matrix);
prob.setShiftValues(shiftValues);
((Problem)prob).setName("MATP5-"+taskID);
problemSet.add(prob);
return problemSet;
}
}
ackley
,H 函数为convex
package momfo.problems.benchmarks;
import java.io.IOException;
import momfo.core.Problem;
import momfo.core.ProblemSet;
import momfo.problems.base.*;
public class MATP6 {
public static ProblemSet getProblem() throws IOException {
int taskNumber=50;
ProblemSet problemSet = new ProblemSet(taskNumber);
for(int i=1;i<=taskNumber;i++)
problemSet.add(getT(i).get(0));
return problemSet;
}
public static ProblemSet getT(int taskID) throws IOException {
ProblemSet problemSet = new ProblemSet(1);
MMDTLZ prob = new MMDTLZ(2, 50, 1, -50,50);
prob.setGType("griewank");
double[][] matrix = IO.readMatrixFromFile("MData/M6/M6_"+taskID+".txt");
double shiftValues[] = IO.readShiftValuesFromFile("SVData/S6/S6_"+taskID+".txt");
prob.setRotationMatrix(matrix);
prob.setShiftValues(shiftValues);
((Problem)prob).setName("MATP6-"+taskID);
problemSet.add(prob);
return problemSet;
}
}
griewank
,H 函数为circle
float[] rgb1 = {0, 0, 0};//黑色-circle
float[] rgb2 = {(float) 0, (float) 0, (float) 139};//蓝黑-concave
float[] rgb3 = {(float) 255, (float) 0, (float) 0};//红色-concave
float[] rgb4 = {(float) 0, (float) 255, (float) 0};//绿色-circle
float[] rgb5 = {(float) 255, (float) 255, (float) 0};//黄色-convex
float[] rgb6 = {(float) 139, (float) 69, (float) 19};//巧克力色-circle
float alpha = (float) 1;
Scatter scatter1 = tools.Setpoint(TruePFT1_Matrix, rgb1, alpha, 20);
Scatter scatter2 = tools.Setpoint(TruePFT2_Matrix, rgb2, alpha, 15);
Scatter scatter3 = tools.Setpoint(TruePFT3_Matrix, rgb3, alpha, 8);
Scatter scatter4 = tools.Setpoint(TruePFT4_Matrix, rgb4, alpha, 10);
Scatter scatter5 = tools.Setpoint(TruePFT5_Matrix, rgb5, alpha, 6);
Scatter scatter6 = tools.Setpoint(TruePFT6_Matrix, rgb6, alpha, 5);
[1]
地址可以下载: http://www.bdsc.site/websites/MTO/MO-ManyTask-Benchmarks.rar