Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes #7

Merged
merged 7 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor bug fixes
  • Loading branch information
danieledipompeo committed Jan 31, 2019
commit 40a40b3ce5844049fbca189181af8c003668f585
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
Expand All @@ -35,13 +34,23 @@
import org.uma.jmetal.operator.SelectionOperator;
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection;
import org.uma.jmetal.problem.Problem;
import org.uma.jmetal.qualityindicator.impl.Epsilon;
import org.uma.jmetal.qualityindicator.impl.GeneralizedSpread;
import org.uma.jmetal.qualityindicator.impl.GenerationalDistance;
import org.uma.jmetal.qualityindicator.impl.InvertedGenerationalDistance;
import org.uma.jmetal.qualityindicator.impl.InvertedGenerationalDistancePlus;
import org.uma.jmetal.qualityindicator.impl.Spread;
import org.uma.jmetal.qualityindicator.impl.hypervolume.PISAHypervolume;
import org.uma.jmetal.runner.AbstractAlgorithmRunner;
import org.uma.jmetal.util.comparator.RankingAndCrowdingDistanceComparator;
import org.uma.jmetal.util.evaluator.SolutionListEvaluator;
import org.uma.jmetal.util.experiment.Experiment;
import org.uma.jmetal.util.experiment.ExperimentBuilder;
import org.uma.jmetal.util.experiment.component.ExecuteAlgorithms;
import org.uma.jmetal.util.experiment.component.ComputeQualityIndicators;
import org.uma.jmetal.util.experiment.component.GenerateBoxplotsWithR;
import org.uma.jmetal.util.experiment.component.GenerateLatexTablesWithStatistics;
import org.uma.jmetal.util.experiment.component.GenerateReferenceParetoFront;
import org.uma.jmetal.util.experiment.component.GenerateWilcoxonTestTablesWithR;
import org.uma.jmetal.util.experiment.util.ExperimentAlgorithm;
import org.uma.jmetal.util.experiment.util.ExperimentProblem;
import org.uma.jmetal.util.pseudorandom.JMetalRandom;
Expand All @@ -54,6 +63,8 @@
import it.univaq.disim.sealab.metaheuristic.evolutionary.operator.RCrossover;
import it.univaq.disim.sealab.metaheuristic.evolutionary.operator.RMutation;
import it.univaq.disim.sealab.metaheuristic.evolutionary.operator.RSolutionListEvaluator;
import it.univaq.disim.sealab.metaheuristic.evolutionary.spea2.CustomSPEA2;
import it.univaq.disim.sealab.metaheuristic.evolutionary.spea2.CustomSPEA2Builder;
import it.univaq.disim.sealab.metaheuristic.managers.Manager;
import it.univaq.disim.sealab.metaheuristic.managers.MetamodelManager;
import it.univaq.disim.sealab.metaheuristic.managers.aemilia.AemiliaManager;
Expand Down Expand Up @@ -282,10 +293,13 @@ public void runExperiment() {
final int CORES = 1;

List<ExperimentProblem<RSolution>> problemList = new ArrayList<>();
RProblem p_BGCS = new RProblem(sourceBasePath, length, numberOfActions, allowedFailures, populationSize, this);
p_BGCS.setName("BGCS");
RProblem p_FTA = new RProblem(sourceBasePath, length, numberOfActions, allowedFailures, populationSize, this);
p_FTA.setName("FTA");

// RProblem p_BGCS = new RProblem(sourceBasePath, length, numberOfActions, allowedFailures, populationSize, this);
// p_BGCS.setName("BGCS");

problemList.add(new ExperimentProblem<>(p_BGCS));
problemList.add(new ExperimentProblem<>(p_FTA));

List<ExperimentAlgorithm<RSolution, List<RSolution>>> algorithmList = configureAlgorithmList(problemList);

Expand All @@ -295,20 +309,18 @@ public void runExperiment() {
.setAlgorithmList(algorithmList).setProblemList(problemList)
.setExperimentBaseDirectory(referenceFrontDirectory).setOutputParetoFrontFileName("FUN")
.setOutputParetoSetFileName("VAR").setReferenceFrontDirectory(referenceFrontDirectory)
// .setIndicatorList(Arrays.asList(new Epsilon<RSolution>(), new
// Spread<RSolution>(),
// new GenerationalDistance<RSolution>(), new PISAHypervolume<RSolution>(),
// new InvertedGenerationalDistance<RSolution>(), new
// GeneralizedSpread<RSolution>(),
// new InvertedGenerationalDistancePlus<RSolution>()))
.setIndicatorList(Arrays.asList(new Epsilon<RSolution>(), new Spread<RSolution>(),
new GenerationalDistance<RSolution>(), new PISAHypervolume<RSolution>(),
new InvertedGenerationalDistance<RSolution>(), new GeneralizedSpread<RSolution>(),
new InvertedGenerationalDistancePlus<RSolution>()))
.setIndependentRuns(INDEPENDENT_RUNS).setNumberOfCores(CORES).build();
try {
new RExecuteAlgorithms<RSolution, List<RSolution>>(experiment, this).run();
new GenerateReferenceParetoFront(experiment).run();
// new ComputeQualityIndicators<>(experiment).run();
// new GenerateWilcoxonTestTablesWithR<>(experiment).run();
// new GenerateBoxplotsWithR<>(experiment).run();
// new GenerateLatexTablesWithStatistics(experiment).run();
new ComputeQualityIndicators<>(experiment).run();
new GenerateWilcoxonTestTablesWithR<>(experiment).run();
new GenerateBoxplotsWithR<>(experiment).run();
new GenerateLatexTablesWithStatistics(experiment).run();
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -349,28 +361,23 @@ private List<ExperimentAlgorithm<RSolution, List<RSolution>>> configureAlgorithm
algorithms.add(exp);
}

// for (int i = 0; i < problemList.size(); i++) {
// @SuppressWarnings("unchecked")
// CustomSPEA2Builder<RSolution> spea2Builder = (CustomSPEA2Builder<RSolution>)
// new CustomSPEA2Builder(
// problemList.get(i).getProblem(), crossoverOperator, mutationOperator)
// .setSelectionOperator(selectionOpertor).setSolutionListEvaluator(solutionListEvaluator)
//// .setMaxIterations(Math.toIntExact(this.maxEvaluations /
// this.populationSize))
// .setMaxIterations(100)
// .setPopulationSize(this.populationSize);
//
// CustomSPEA2<RSolution> algorithm = (CustomSPEA2<RSolution>)
// spea2Builder.build();
// algorithm.setName("SPEA_2");
// ExperimentAlgorithm<RSolution, List<RSolution>> exp = new
// CustomExperimentAlgorithm<RSolution, List<RSolution>>(
// algorithm, problemList.get(i).getTag(), i);
// algorithms.add(exp);
// }
for (int i = 0; i < problemList.size(); i++) {
@SuppressWarnings("unchecked")
CustomSPEA2Builder<RSolution> spea2Builder = (CustomSPEA2Builder<RSolution>) new CustomSPEA2Builder(
problemList.get(i).getProblem(), crossoverOperator, mutationOperator)
.setSelectionOperator(selectionOpertor).setSolutionListEvaluator(solutionListEvaluator)
.setMaxIterations(Math.toIntExact(this.maxEvaluations / this.populationSize))
.setMaxIterations(100).setPopulationSize(this.populationSize);

CustomSPEA2<RSolution> algorithm = (CustomSPEA2<RSolution>) spea2Builder.build();
algorithm.setName("SPEA_2");
ExperimentAlgorithm<RSolution, List<RSolution>> exp = new CustomExperimentAlgorithm<RSolution, List<RSolution>>(
algorithm, problemList.get(i).getTag(), i);
algorithms.add(exp);
}
return algorithms;
}

public synchronized void generateAvailability() {
File availabilityDir = new File(availabilityFolder);
try {
Expand Down Expand Up @@ -800,9 +807,9 @@ public static void setSOR(final boolean sorValue) {
public static boolean isSor() {
return SOR;
}

public String getPermanentTmpFolder() {

return getProperties().getProperty("permanentTmpFolder");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public void run() {
}
}



private void prepareOutputDirectory() {
if (experimentDirectoryDoesNotExist()) {
createExperimentDirectory() ;
Expand Down