Skip to content

Commit

Permalink
(v1.3) | master : fixed randomized quick sort
Browse files Browse the repository at this point in the history
description: fixed an issue with the implementation of randomized quick sort where, previously, due to an erroneous implementation, the randomized quick sort did not work properly and the whole pareto front could not be captured as the final output.
  • Loading branch information
sajib-acharya committed May 28, 2018
1 parent fb529ed commit 408d930
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified src/.DS_Store
Binary file not shown.
Binary file modified src/main/.DS_Store
Binary file not shown.
Binary file modified src/main/java/.DS_Store
Binary file not shown.
Binary file modified src/main/java/io/.DS_Store
Binary file not shown.
Binary file modified src/main/java/io/onclave/.DS_Store
Binary file not shown.
Binary file modified src/main/java/io/onclave/nsga/.DS_Store
Binary file not shown.
Binary file modified src/main/java/io/onclave/nsga/ii/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion src/main/java/io/onclave/nsga/ii/api/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ private static int randomizedPartition(ParetoObject[] paretoArray, int head, int
*/
private static void randomizedQuickSort(ParetoObject[] paretoArray, int head, int tail, IObjectiveFunction objective) {

if(tail < head) {
if(head < tail) {

int pivot = randomizedPartition(paretoArray, head, tail, objective);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
*/
public class Configuration {

private static final int POPULATION_SIZE = 1000;
private static final int POPULATION_SIZE = 800;
private static final int GENERATIONS = 50;
private static final int CHROMOSOME_LENGTH = 30;
private static final int CHROMOSOME_LENGTH = 20;
private static final float CROSSOVER_PROBABILITY = 0.7f;
private static final float MUTATION_PROBABILITY = 0.03f;
private static List<IObjectiveFunction> objectives = null;
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/io/onclave/nsga/ii/objectivefunction/ZDT1_1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* This code file and the codebase/software containing it is
* explicitely licensed to Mr. Debabrata Acharya (@onclave)
* unauthorized use and access of the codebase, parts of the
* codebase, software or parts of this software is not allowed.
*/
package io.onclave.nsga.ii.objectivefunction;

import io.onclave.nsga.ii.Interface.IObjectiveFunction;
import io.onclave.nsga.ii.datastructure.Chromosome;
import io.onclave.nsga.ii.datastructure.ParetoObject;

/**
*
* @author sajib
*/
public class ZDT1_1 implements IObjectiveFunction {

private static final String AXIS_TITLE = "x1";

@Override
public double objectiveFunction(double geneVaue) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public double objectiveFunction(Chromosome chromosome) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public double objectiveFunction(ParetoObject paretoObject) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public String getAxisTitle() {
return AXIS_TITLE;
}

}
46 changes: 46 additions & 0 deletions src/main/java/io/onclave/nsga/ii/objectivefunction/ZDT1_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This code file and the codebase/software containing it is
* explicitely licensed to Mr. Debabrata Acharya (@onclave)
* unauthorized use and access of the codebase, parts of the
* codebase, software or parts of this software is not allowed.
*/
package io.onclave.nsga.ii.objectivefunction;

import io.onclave.nsga.ii.Interface.IObjectiveFunction;
import io.onclave.nsga.ii.datastructure.Chromosome;
import io.onclave.nsga.ii.datastructure.ParetoObject;

/**
*
* @author sajib
*/
public class ZDT1_2 implements IObjectiveFunction {

private static final String AXIS_TITLE = "g(x)[1 - sqrt(x1/g(x))]";
private static final int N = 30;

@Override
public double objectiveFunction(double geneVaue) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public double objectiveFunction(Chromosome chromosome) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public double objectiveFunction(ParetoObject paretoObject) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

private double g_x() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

@Override
public String getAxisTitle() {
return AXIS_TITLE;
}

}

0 comments on commit 408d930

Please sign in to comment.