Skip to content

Commit c0ad029

Browse files
committed
Simplified GA for ISB added
Signed-off-by: facaraff <[email protected]>
1 parent cffd57c commit c0ad029

File tree

13 files changed

+748
-733
lines changed

13 files changed

+748
-733
lines changed

src/algorithms/specialOptions/BIAS/CMAESISB.java renamed to src/algorithms/specialOptions/BIAS/CMAES.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
/*
5252
* Covariance Matrix Adaptation Evolutionary Strategy
5353
*/
54-
public class CMAESISB extends AlgorithmBias
54+
public class CMAES extends AlgorithmBias
5555
{
5656

5757

@@ -65,8 +65,8 @@ public class CMAESISB extends AlgorithmBias
6565

6666
public void setCorrectionStrategy(char c) {this.setCorrection(c);}
6767

68-
public CMAESISB() {super();}
69-
public CMAESISB(char c) {super(); this.correction = c;}
68+
public CMAES() {super();}
69+
public CMAES(char c) {super(); this.correction = c;}
7070

7171

7272

src/algorithms/specialOptions/BIAS/ISBDE/DE.java renamed to src/algorithms/specialOptions/BIAS/DE.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
of the authors and should not be interpreted as representing official policies,
2727
either expressed or implied, of the FreeBSD Project.
2828
*/
29-
package algorithms.specialOptions.BIAS.ISBDE;
29+
package algorithms.specialOptions.BIAS;
3030

3131
import utils.random.RandUtilsISB;
3232

@@ -42,9 +42,6 @@
4242
import static utils.algorithms.operators.ISBOp.crossOverExp;
4343
import static utils.algorithms.operators.ISBOp.crossOverBin;
4444

45-
46-
47-
4845
import interfaces.AlgorithmBias;
4946
import interfaces.Problem;
5047
import utils.MatLab;
@@ -93,15 +90,15 @@ public FTrend execute(Problem problem, int maxEvaluations) throws Exception
9390
int i = 0;
9491

9592

96-
String FullName = getFullName("DE"+this.mutationStrategy+this.crossoverStrategy+this.correction,problem);
93+
String FullName = getFullName("DE"+this.mutationStrategy+this.crossoverStrategy+this.correction+"p"+populationSize,problem);
9794
Counter PRNGCounter = new Counter(0);
9895
createFile(FullName);
9996

10097
int[] ids = new int[populationSize]; //int prevID = -1;
10198
int newID = 0;
10299
int bestID = -1;
103100

104-
writeHeader(" pop "+populationSize+" F "+F+" CR "+CR, problem);
101+
writeHeader(" pop "+populationSize+" F "+F+" CR "+CR+" alpha "+alpha, problem);
105102

106103
String line = new String();
107104

@@ -218,37 +215,37 @@ else if(this.mutationStrategy.equals("bo") || this.mutationStrategy.equals("bt")
218215
{
219216
case "ro":
220217
// DE/rand/1
221-
// newPt = rand1(population, F, PRNGCounter);
222218
newPt = rand1(population[r1], population[r2], population[r3], F, PRNGCounter);
223219
s += ids[r2]+" "+ids[r3]+" "+ids[r1];
224220
break;
225221
case "ctbo":
226222
// DE/cur-to-best/1
227-
// newPt = currentToBest1(population, best, j, F, PRNGCounter);
228223
newPt = currentToBest1(currPt, population[indexBest], population[r1], population[r2], F, PRNGCounter);
229224
s += ids[j]+" "+ids[indexBest]+" "+ids[r1]+" "+ids[r2];
230225
break;
231226
case "rt":
232227
// DE/rand/2
233-
newPt = rand2(population, F, PRNGCounter);
228+
newPt = rand2(population[r1], population[r2], population[r3], population[r4], population[r5], F, PRNGCounter);
229+
s+= ids[r1]+" "+ids[r2]+" "+ids[r3]+" "+ids[r4]+" "+ids[r5];
234230
break;
235231
case "ctro":
236232
// DE/current-to-rand/1
237-
crossPt = currentToRand1(population, j, F,PRNGCounter);
233+
crossPt = currentToRand1(population[r1], population[r2], population[r3], currPt, F, PRNGCounter);
234+
s += ids[j]+" "+ids[r1]+" "+ids[r2]+" "+ids[r3];
238235
break;
239236
case "rtbt":
240237
// DE/rand-to-best/2
241238
newPt = randToBest2(population, best, F, PRNGCounter);
242239
break;
243240
case "bo":
244241
// DE/best/1
245-
// newPt = best1(population, best, F, PRNGCounter);
246242
newPt = best1(population[indexBest], population[r1], population[r2], F, PRNGCounter);
247243
s+= ids[indexBest]+" "+ids[r1]+" "+ids[r2];
248244
break;
249245
case "bt":
250246
// DE/best/2
251-
newPt = best2(population, best, F, PRNGCounter);
247+
newPt = best2(population[indexBest], population[r1], population[r2], population[r3], population[r4], F, PRNGCounter);
248+
s+= ids[indexBest]+" "+ids[r1]+" "+ids[r2]+" "+ids[r3]+" "+ids[r4];
252249
break;
253250
default:
254251
break;
@@ -277,13 +274,12 @@ else if (crossoverStrategy == 'x')
277274
{
278275
for (int n = 0; n < problemDimension; n++)
279276
temp[j][n] = crossPt[n];
280-
// newPop[j][n] = crossPt[n];
277+
281278
fitnesses[j] = crossFit;
282279

283280
temp2[j] = crossFit;
284281
idsTemp[j] = newID;
285282

286-
//line =""+newID+" "+ids[r2]+" "+ids[r3]+" "+ids[indexBest]+" "+formatter(fitnesses[j])+" "+i+" "+ids[j];
287283
line =""+newID+" "+s+" "+formatter(fitnesses[j])+" "+i+" "+ids[j];
288284
for(int n = 0; n < problemDimension; n++)
289285
line+=" "+formatter(population[j][n]);
@@ -324,7 +320,6 @@ else if (crossoverStrategy == 'x')
324320
idsTemp=null;
325321

326322
}
327-
328323

329324
closeAll();
330325
writeStats(FullName, (double) this.numberOfCorrections/maxEvaluations, PRNGCounter.getCounter(), "correctionsDE");

src/algorithms/specialOptions/BIAS/GAPaper2.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ else if(xover=='a')// WHOLE ARITHMETIC RECOMBINATION
238238

239239
}
240240
else
241-
System.out.println("FUCK OFF, NO ADMISSIBLE OXVER SELECTED");
241+
System.out.println("NO ADMISSIBLE OXVER SELECTED");
242242

243243
return output;
244244
}

src/algorithms/specialOptions/BIAS/GA.java renamed to src/algorithms/specialOptions/BIAS/ISBDE/kononova2015/GA.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package algorithms.specialOptions.BIAS;
1+
package algorithms.specialOptions.BIAS.ISBDE.kononova2015;
22

33

44
import java.text.DecimalFormat;

src/algorithms/specialOptions/BIAS/GA2.java renamed to src/algorithms/specialOptions/BIAS/ISBDE/kononova2015/GA2.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package algorithms.specialOptions.BIAS;
1+
package algorithms.specialOptions.BIAS.ISBDE.kononova2015;
22

33

44
import java.text.DecimalFormat;

src/algorithms/specialOptions/BIAS/simplifiedGA.java renamed to src/algorithms/specialOptions/BIAS/ISBDE/kononova2015/simplifiedGA.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package algorithms.specialOptions.BIAS;
1+
package algorithms.specialOptions.BIAS.ISBDE.kononova2015;
22

33
import static utils.algorithms.Misc.generateRandomSolution;
44

src/algorithms/specialOptions/BIAS/simplifiedGA2.java renamed to src/algorithms/specialOptions/BIAS/ISBDE/kononova2015/simplifiedGA2.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package algorithms.specialOptions.BIAS;
1+
package algorithms.specialOptions.BIAS.ISBDE.kononova2015;
22

33
import static utils.algorithms.Misc.generateRandomSolution;
44

@@ -130,7 +130,6 @@ public FTrend execute(Problem problem, int maxEvaluations) throws Exception
130130
population[rand][n] = xChild[n];
131131
fitnesses[rand] = fChild;
132132

133-
134133
line =""+newID+" "+indexParent1+" "+indexParent2+" "+formatter(fChild)+" "+i+" "+indexRand;
135134
for(int n = 0; n < problemDimension; n++)
136135
line+=" "+formatter(xChild[n]);

src/algorithms/specialOptions/BIAS/NelderMeadISB.java renamed to src/algorithms/specialOptions/BIAS/NelderMead.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/**
2929
* A Nelder-Mead simplex search.
3030
*/
31-
public final class NelderMeadISB extends AlgorithmBias {
31+
public final class NelderMead extends AlgorithmBias {
3232

3333
static String Dir = "/home/facaraff/Desktop/KONODATA/NelderMead/";
3434

0 commit comments

Comments
 (0)