Skip to content

Commit

Permalink
Merge branch 'island-model'
Browse files Browse the repository at this point in the history
  • Loading branch information
fmvb committed Oct 10, 2017
2 parents da2fb6a + 8ffa538 commit 4ec7c14
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 7 additions & 1 deletion IslandModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ public IslandModel(int populationSize, Options opt, Random rnd)
int subPopulationSize = populationSize / NUM_POPULATIONS;

for (int i = 0; i < NUM_POPULATIONS; i++) {
populations[i] = new Population(subPopulationSize, opt, rnd);
if (i % 2 == 0) {
opt.parentSelection = Options.ParentSelection.EXPONENTIAL_RANKING;
} else {
opt.parentSelection = Options.ParentSelection.LINEAR_RANKING;
}

populations[i] = new Population(subPopulationSize, new Options(opt), rnd);
}
}

Expand Down
10 changes: 10 additions & 0 deletions Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ public Options()
survivorSelection = SurvivorSelection.MU_PLUS_LAMBDA;
}

public Options(Options opt)
{
this.crowding = opt.crowding;
this.subPopulations = opt.subPopulations;
this.parentSelection = opt.parentSelection;
this.recombination = opt.recombination;
this.mutation = opt.mutation;
this.survivorSelection = opt.survivorSelection;
}

public void setDeterministicCrowding()
{
crowding = true;
Expand Down
11 changes: 6 additions & 5 deletions player50.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public player50()
{
name = "evolutamine";
rnd = new Random();
populationSize = 100;
populationSize = 50;
}

public void setSeed(long seed)
Expand Down Expand Up @@ -53,15 +53,16 @@ public void setEvaluation(ContestEvaluation evaluation)
if (isMultimodal) {
System.out.println("Function is Multimodal.");

populationSize = 1000;
populationSize = 500;
if (!hasStructure) {
Options.subPopulations = 20;
Options.subPopulations = 10;
}
}

if (hasStructure) {
System.out.println("Function has structure.");
Options.subPopulations = 4;
Options.subPopulations = 1;
populationSize = 1000;
}
if (isSeparable) {
System.out.println("Function is separable.");
Expand Down Expand Up @@ -93,7 +94,7 @@ public void run()

while (evals > 0) {
if (islandModel) {
if (cycle % 25 == 0) {
if (cycle % 50 == 0) {
((IslandModel) population).exchangeIndividuals();
}
}
Expand Down

0 comments on commit 4ec7c14

Please sign in to comment.