Skip to content

Commit

Permalink
Factory HS
Browse files Browse the repository at this point in the history
incluyo los Factory para HS y variantes
  • Loading branch information
danielpusil committed Mar 20, 2018
1 parent 457c177 commit c26c1ca
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import org.uma.jmetal.problem.DoubleProblem;
import org.uma.jmetal.solution.DoubleSolution;
import org.uma.jmetal.util.AlgorithmBuilder;
import org.uma.jmetal.util.evaluator.SolutionListEvaluator;
import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator;

/**
*
* @author Daniel Pusil <[email protected]>
*/
public class GHSBuilder {
public class GHSBuilder implements AlgorithmBuilder<GHS> {

private DoubleProblem problem;
private int maxEvaluations;//Maximum number of evaluations of the objective function
Expand All @@ -36,6 +37,7 @@ public GHSBuilder(DoubleProblem problem) {
this.evaluator = new SequentialSolutionListEvaluator<>();
}

@Override
public GHS build() {
GHS hs = new GHS(problem, maxEvaluations, HMS, HMCR, PARMIN, PARMAX, evaluator);
return hs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public HS(DoubleProblem problem, int maxEvaluations, int hms,
setComparator(comparator);
this.PAR = PAR;
this.BW = BW;
this.HMCR = HMCR;
this.HMCR = HMCR;
if (randomGenerator == null) {
randomGenerator = JMetalRandom.getInstance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

import org.uma.jmetal.problem.DoubleProblem;
import org.uma.jmetal.solution.DoubleSolution;
import org.uma.jmetal.util.AlgorithmBuilder;
import org.uma.jmetal.util.evaluator.SolutionListEvaluator;
import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator;

/**
*
* @author Daniel Pusil <[email protected]>
*/
public class HSBuilder {
public class HSBuilder
implements AlgorithmBuilder<HS> {

/**
* Parameters
Expand All @@ -35,6 +37,7 @@ public HSBuilder(DoubleProblem problem) {
/**
* @return HarmonySearch algorithm
*/
@Override
public HS build() {
return new HS(problem, maxEvaluations, HMS, HMCR, PAR, BW, evaluator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import org.uma.jmetal.problem.DoubleProblem;
import org.uma.jmetal.solution.DoubleSolution;
import org.uma.jmetal.util.AlgorithmBuilder;
import org.uma.jmetal.util.evaluator.SolutionListEvaluator;
import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator;

/**
*
* @author Daniel Pusil <[email protected]>
*/
public class IHSBuilder {
public class IHSBuilder implements AlgorithmBuilder<IHS> {

private DoubleProblem problem;
private int maxEvaluations;
Expand All @@ -36,6 +37,7 @@ public IHSBuilder(DoubleProblem problem) {
this.evaluator = new SequentialSolutionListEvaluator<>();
}

@Override
public IHS build() {
IHS hs = new IHS(problem, maxEvaluations, HMS, HMCR, PARMIN, PARMAX, BWMIN, BWMAX, evaluator);
return hs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.uma.jmetal.problem.DoubleProblem;
import org.uma.jmetal.solution.DoubleSolution;
import org.uma.jmetal.util.comparator.FitnessNorma2Comparator;
import org.uma.jmetal.util.comparator.ObjectiveComparator;
import org.uma.jmetal.util.evaluator.SolutionListEvaluator;
import org.uma.jmetal.util.pseudorandom.JMetalRandom;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import org.uma.jmetal.problem.DoubleProblem;
import org.uma.jmetal.solution.DoubleSolution;
import org.uma.jmetal.util.AlgorithmBuilder;
import org.uma.jmetal.util.evaluator.SolutionListEvaluator;
import org.uma.jmetal.util.evaluator.impl.SequentialSolutionListEvaluator;

/**
*
* @author Daniel Pusil <[email protected]>
*/
public class NGHSBuilder {
public class NGHSBuilder implements AlgorithmBuilder<NGHS>{

private DoubleProblem problem;
private int maxEvaluations;
Expand All @@ -24,6 +25,7 @@ public NGHSBuilder(DoubleProblem problem) {
this.evaluator = new SequentialSolutionListEvaluator<>();
}

@Override
public NGHS build() {
NGHS hs = new NGHS(problem, maxEvaluations, HMS, PM, evaluator);
return hs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ public int compare(S solution1, S solution2) {
if (fitness1 > fitness2) {
return 1;
}
if (solution1.getAttribute("norm2") != null && solution2.getAttribute("norm2") != null) {
if (solution1.getAttribute("B") != null && solution2.getAttribute("B") != null) {
return compareNorma(solution1, solution2);
}

return 0;
}

private int compareNorma(S solution1, S solution2) {
double norm2Solution1 = (double) solution1.getAttribute("norm2");
double norm2Solution2 = (double) solution2.getAttribute("norm2");
if (norm2Solution1 < norm2Solution2) {
double BSolution1 = (double) solution1.getAttribute("B");
double BSolution2 = (double) solution2.getAttribute("B");
if (BSolution1 < BSolution2) {
return -1;
}

if (norm2Solution1 > norm2Solution2) {
if (BSolution1 > BSolution2) {
return 1;
}
return 0;
Expand Down
174 changes: 46 additions & 128 deletions jMetal-jmetal-5.2/unicauca-ann/jMetal.log
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2018-02-15T14:24:21</date>
<millis>1518722661125</millis>
<date>2018-03-19T19:47:40</date>
<millis>1521506860335</millis>
<sequence>0</sequence>
<logger>org.uma.jmetal.util.JMetalLogger</logger>
<level>INFO</level>
Expand All @@ -13,8 +13,8 @@
<message>Loggers configured with null</message>
</record>
<record>
<date>2018-02-15T14:24:21</date>
<millis>1518722661182</millis>
<date>2018-03-19T19:47:40</date>
<millis>1521506860419</millis>
<sequence>1</sequence>
<logger>org.uma.jmetal.util.JMetalLogger</logger>
<level>SEVERE</level>
Expand All @@ -23,7 +23,7 @@
<thread>1</thread>
<message>Class.forName() did not recognized the name of the class</message>
<exception>
<message>java.lang.ClassNotFoundException: co.edu.unicauca.problem.cross_validation.9834</message>
<message>java.lang.ClassNotFoundException: co.edu.unicauca.problem.cross_validation.Iri</message>
<frame>
<class>java.net.URLClassLoader</class>
<method>findClass</method>
Expand Down Expand Up @@ -61,144 +61,62 @@
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>readDataSet</method>
<line>122</line>
<line>113</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>readConfigurationExecution</method>
<line>59</line>
<line>54</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>main</method>
<line>36</line>
<line>33</line>
</frame>
</exception>
</record>
<record>
<date>2018-02-15T14:24:40</date>
<millis>1518722680127</millis>
<date>2018-03-19T19:47:45</date>
<millis>1521506865944</millis>
<sequence>2</sequence>
<logger>org.uma.jmetal.util.JMetalLogger</logger>
<level>SEVERE</level>
<class>org.uma.jmetal.util.JMetalException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>Class.forName() did not recognized the name of the class</message>
<exception>
<message>java.lang.ClassNotFoundException: co.edu.unicauca.problem.cross_validation.ajksdlñfj</message>
<frame>
<class>java.net.URLClassLoader</class>
<method>findClass</method>
<line>381</line>
</frame>
<frame>
<class>java.lang.ClassLoader</class>
<method>loadClass</method>
<line>424</line>
</frame>
<frame>
<class>sun.misc.Launcher$AppClassLoader</class>
<method>loadClass</method>
<line>335</line>
</frame>
<frame>
<class>java.lang.ClassLoader</class>
<method>loadClass</method>
<line>357</line>
</frame>
<frame>
<class>java.lang.Class</class>
<method>forName0</method>
</frame>
<frame>
<class>java.lang.Class</class>
<method>forName</method>
<line>264</line>
</frame>
<frame>
<class>org.uma.jmetal.util.ProblemUtils</class>
<method>loadProblem</method>
<line>23</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>readDataSet</method>
<line>122</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>readConfigurationExecution</method>
<line>59</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>main</method>
<line>36</line>
</frame>
</exception>
<logger>com.github.fommil.netlib.BLAS</logger>
<level>WARNING</level>
<class>com.github.fommil.netlib.BLAS</class>
<method>&lt;clinit&gt;</method>
<thread>11</thread>
<message>Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS</message>
</record>
<record>
<date>2018-02-15T14:24:41</date>
<millis>1518722681659</millis>
<date>2018-03-19T19:47:47</date>
<millis>1521506867065</millis>
<sequence>3</sequence>
<logger>org.uma.jmetal.util.JMetalLogger</logger>
<level>SEVERE</level>
<class>org.uma.jmetal.util.JMetalException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>Class.forName() did not recognized the name of the class</message>
<exception>
<message>java.lang.ClassNotFoundException: co.edu.unicauca.problem.cross_validation.08324</message>
<frame>
<class>java.net.URLClassLoader</class>
<method>findClass</method>
<line>381</line>
</frame>
<frame>
<class>java.lang.ClassLoader</class>
<method>loadClass</method>
<line>424</line>
</frame>
<frame>
<class>sun.misc.Launcher$AppClassLoader</class>
<method>loadClass</method>
<line>335</line>
</frame>
<frame>
<class>java.lang.ClassLoader</class>
<method>loadClass</method>
<line>357</line>
</frame>
<frame>
<class>java.lang.Class</class>
<method>forName0</method>
</frame>
<frame>
<class>java.lang.Class</class>
<method>forName</method>
<line>264</line>
</frame>
<frame>
<class>org.uma.jmetal.util.ProblemUtils</class>
<method>loadProblem</method>
<line>23</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>readDataSet</method>
<line>122</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>readConfigurationExecution</method>
<line>59</line>
</frame>
<frame>
<class>co.edu.unicauca.exec.Run</class>
<method>main</method>
<line>36</line>
</frame>
</exception>
<logger>com.github.fommil.jni.JniLoader</logger>
<level>INFO</level>
<class>com.github.fommil.jni.JniLoader</class>
<method>liberalLoad</method>
<thread>11</thread>
<message>successfully loaded C:\Users\Daniel\AppData\Local\Temp\jniloader5971280112330389898netlib-native_ref-win-x86_64.dll</message>
</record>
<record>
<date>2018-03-19T19:47:47</date>
<millis>1521506867658</millis>
<sequence>4</sequence>
<logger>com.github.fommil.netlib.LAPACK</logger>
<level>WARNING</level>
<class>com.github.fommil.netlib.LAPACK</class>
<method>&lt;clinit&gt;</method>
<thread>11</thread>
<message>Failed to load implementation from: com.github.fommil.netlib.NativeSystemLAPACK</message>
</record>
<record>
<date>2018-03-19T19:47:47</date>
<millis>1521506867717</millis>
<sequence>5</sequence>
<logger>com.github.fommil.jni.JniLoader</logger>
<level>INFO</level>
<class>com.github.fommil.jni.JniLoader</class>
<method>load</method>
<thread>11</thread>
<message>already loaded netlib-native_ref-win-x86_64.dll</message>
</record>
</log>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public AbstractBuilderFactory(AbstractParametersFactory parametersFactory)
{
this.parametersFactory = parametersFactory;
}

public abstract AlgorithmBuilder getAlgorithm(String name, AbstractELMEvaluator.EvaluatorType evaluatorType,
DoubleProblem problem) throws Exception;

Expand Down
Loading

0 comments on commit c26c1ca

Please sign in to comment.