Manytasking optimization MATP
Manytasking Jmetal代码反向解析1_MATP测试函数集
觉得有用的话,欢迎一起讨论相互学习~Follow Me
- 这是我在写Manytask optimization时的笔记,代码地址可以下载
打开文件夹如下目录,选择benchmark中的任意一个测试函数集,此时我们选择
MATP1
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问题。for(int i=1;i<=taskNumber;i++) 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
```java
// 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");
``* 可知matrix[][]其中保存有旋转函数,根据taskID具有不同的旋转角度,shiftValues则保存了偏移向量,通过不同的旋转函数和偏移向量可以保证MATP问题中的不同任务即使具有相同的帕累托前沿,但是对应的决策变量距离和位置却完全不同。  ## 注意在MATP2中仅仅设置G函数的形状为sphere和alpha`值1。(后期通关观察得知,alpha值是用于计算cos函数的)
MATP2
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;
}
}
和MATP1问题不同的是MATP2问题设置G函数为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";

MATP3
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;
}
}
和MATP1以及MATP2问题不同的是MATP3问题设置G函数为rosenbrock,设置H函数为concave,最终形状为concave并且是根据ZDT问题改编的,而不是DTLZ问题,表示有50个这样的任务,并且K值为1,根据ZDT问题的默认函数来看,ZDT问题构造的都是双目标问题,与MATP2问题不同的是使用10个变量,并且变量范围为[-5,5]而不是[-50,50]

MATP4
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";

MATP5
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;
}
}
决策变量个数为50,k为1,变量最小范围为-1,变量最大范围为1,G函数为ackley,H函数为convex

MATP6
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;
}
}
目标函数2个,50个决策变量,alpha值设置为1,下边界为-50,上边界为50,G函数为griewank,H函数为circle

MATP算例总结
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);

Manytasking optimization MATP的更多相关文章
- theano scan optimization
selected from Theano Doc Optimizing Scan performance Minimizing Scan Usage performan as much of the ...
- [Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.
控制台输出的时候显示一串这样的信息:[Project Name] was compiled with optimization - stepping may behave oddly; variabl ...
- Mvc 之System.Web.Optimization 压缩合并如何让*.min.js 脚本不再压缩
最近项目中用到了easy ui ,但是在配置BundleConfig 的时候出现了问题,easy ui的脚本jquery.easyui.min.js 压缩后出现各种脚本错误,总是莫名其妙的 i标量错误 ...
- MySQL Range Optimization
8.2.1.3 Range Optimization MYSQL的Range Optimization的目的还是尽可能的使用索引 The range access method uses a sing ...
- 命名空间“System.Web”中不存在类型或命名空间名称“Optimization”(是否缺少程序集引用?)
今天,在.net4.5,mvc4下新建了个区域,运行起来就报这个错误: 命名空间"System.Web"中不存在类型或命名空间名称"Optimization"( ...
- [阅读笔记]Software optimization resources
http://www.agner.org/optimize/#manuals 阅读笔记Optimizing software in C++ 7. The efficiency of differe ...
- Tomcat APR & Linux Optimization
一.简介 APR(Apache portable Run-time libraries)模式:简单理解,就是从操作系统级别解决异步IO问题,大幅度的提高服务器的处理和响应性能, 也是Tomcat运行高 ...
- low-rank 的相关求解方法 (CODE) Low-Rank Matrix Recovery and Completion via Convex Optimization
(CODE) Low-Rank Matrix Recovery and Completion via Convex Optimization 这个是来自http://blog.sina.com.cn/ ...
- hdu 1232, disjoint set, linked list vs. rooted tree, a minor but substantial optimization for path c 分类: hdoj 2015-07-16 17:13 116人阅读 评论(0) 收藏
three version are provided. disjoint set, linked list version with weighted-union heuristic, rooted ...
随机推荐
- DateFormat与SimpleDateFormat区别和使用详解
DateFormat类 此类是一个日期的格式化类,用来格式化日期.具体日期可以通过java.util.Date类来获取. DateFormat类的定义:此类是定义在java.test包中的. publ ...
- PVE手册资料
PVE 软件源/etc/apt/souces.list apt-get update命令获取软件源中的软件包信息 企业版软件源 /etc/apt/sources.list.d/pve-enterpri ...
- python应用-彩票随机码的输出
""" 双色球-6个红色球(1-33)和一个蓝色球(1-16) """ from random import randint def sel ...
- python连接redis哨兵集群
一.redis集群模式有多种, 哨兵模式只是其中的一种实现方式, 其原理请自行谷歌或者百度 二.python 连接 redis 哨兵集群 1. 安装redis包 pip install redis 2 ...
- Convert PadLeft Bit Operate
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Cons ...
- 不用图片做的三角语言框效果,纯样式编写,css三角样式写法
2010-07-05 19:57:28 博主 回复 用户昵称 在秋日真的有轻柔吧. 上边效果与理想的有误差,代码布不上去,下边是源代码,另行保存后查看真正效果,下图是真正效果,区别在三角处,里面颜 ...
- EJS的个人总结
什么是模板引擎? 用于Web开发的模板引擎是为了使用用户界面与业务数据(内容)分离而产生的,使用模板语法编写的模板代码通常放在具有特的格式的文档中,经过模板引擎编译之后就会生成一个标准的HTML文档. ...
- Ubuntu使用小结(主要为后面部署K8s集群做基础铺垫)
包管理 dpkg -L libxml2 #查看libxml2安装了些什么文件 dpkg -s /usr/bin/ls #查看ls是那个包提供的 dpkg -c abc.deb #查看abc. ...
- javaScript 判断为false
JavaScript把null.undefined.0.NaN和空字符串''视为false,其他值一概视为true
- Ubuntu 14.04 安装python3.7
下载: https://www.python.org/ftp/python/3.7.4/ .tgz文件,解压后,进入该文件夹 编译./configuremakesudo make install 当 ...