📄 michalewicz_g1.java
字号:
/**
* Description: Benchmark function (Michalewicz's G1).
* X*(Optimal point):
* X1~X9, X13: 1
* X10~X12: 3
* Y*(Optimal value)
* Y1=15
*
* @ Author Create/Modi Note
* Xiaofeng Xie Dec 28, 2001
* Xiaofeng Xie Mar 01, 2003
* Xiaofeng Xie May 11, 2004
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* Please acknowledge the author(s) if you use this code in any way.
*
* @version 1.0
* @Since MAOS1.0
*
* @References:
* [1] Floundas C, Pardalos P. A Collection of Test Problems for Constrained
* Global Optimization. Springer-Verlag, LNCS, 1987, 455
* [2] Koziel S, Michalewicz Z. Evolutionary algorithms, homomorphous
* mappings, and constrained parameter optimization. Evolutionary Computation,
* 1999, 7: 19-44
*/
package problem.constrained;
import problem.*;
import Global.*;
public class Michalewicz_G1 extends ProblemEncoder {
public Michalewicz_G1() throws Exception {
super(13, 10); //13: number of varibles; 10: number of objectives (include constraints)
for(int i=0; i<9; i++) {
setDefaultXAt(i, 0, 1); //Parameter range: [0, 1]
}
for(int i=9; i<12; i++) {
setDefaultXAt(i, 0, 100); //Parameter range: [0, 100]
}
setDefaultXAt(12, 0, 1); //Parameter range: [0, 1]
setDefaultYAt(0, BasicBound.MINDOUBLE, BasicBound.MINDOUBLE); // Minimize Objective
for(int i=1; i<4; i++) {
setDefaultYAt(i, BasicBound.MINDOUBLE, 10); //Lessthan constraints (<10)
}
for(int i=4; i<10; i++) {
setDefaultYAt(i, BasicBound.MINDOUBLE, 0); //Lessthan constraints (<0)
}
}
protected double calcTargetAt(int index, double[] VX) {
double value = 0;
switch(index) {
case 0:
value = 5*(VX[0]+VX[1]+VX[2]+VX[3])-5*(VX[0]*VX[0]+VX[1]*VX[1]+VX[2]*VX[2]+VX[3]*VX[3])-(VX[4]+VX[5]+VX[6]+VX[7]+VX[8]+VX[9]+VX[10]+VX[11]+VX[12]);
break;
case 1:
value = 2*VX[0]+2*VX[1]+VX[9]+VX[10]-10;
break;
case 2:
value = 2*VX[0]+2*VX[2]+VX[9]+VX[11]-10;
break;
case 3:
value = 2*VX[1]+2*VX[2]+VX[10]+VX[11]-10;
break;
case 4:
value = -8*VX[0]+VX[9];
break;
case 5:
value = -8*VX[1]+VX[10];
break;
case 6:
value = -8*VX[2]+VX[11];
break;
case 7:
value = -2*VX[3]-VX[4]+VX[9];
break;
case 8:
value = -2*VX[5]-VX[6]+VX[10];
break;
case 9:
value = -2*VX[7]-VX[8]+VX[11];
break;
default:
return Double.NaN;
}
return value;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -