This repository has been archived by the owner on Jan 17, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a822e5a
Showing
8 changed files
with
613 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.settings/ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>gd</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
0.3955015487758877 0.8968388029151738 0.19813804910100438 | ||
0.8398759744065881 0.4546470492917495 0.29648677573357246 | ||
0.6575804859467268 0.7159818526359304 0.23443099453375926 | ||
0.45455568608227864 0.5993275495321888 0.6589276262397947 | ||
0.3309593847280786 0.8999124185235489 0.2839428193272524 | ||
0.5350232405531994 0.8396747661532288 0.09325459320309025 | ||
0.6491217190277713 0.6461883391973844 0.4013497529235033 | ||
0.8967023662625628 0.341322049614317 0.281822860652223 | ||
0.341002314811078 0.2779357839398977 0.8980362583432815 | ||
0.6517856820250706 0.26283293221873366 0.7114030323581818 | ||
0.7197894335064525 0.3523757715033633 0.5981090929503328 | ||
0.8375187558805097 0.38055540787681746 0.39209681850797046 | ||
0.5945647484003959 0.46338532037725455 0.6570896474747134 | ||
0.010596158547416915 0.9999036201264029 0.00897061213922291 | ||
0.6428278949804777 0.0055716401316797445 0.7659903747836595 | ||
0.2575360636100446 0.7078089129528853 0.657785465546859 | ||
0.5379978832932746 0.5950284905805819 0.5970756844566276 | ||
0.23834163827671956 0.15557436938154254 0.9586395981050985 | ||
0.5969536199775428 0.594941819701065 0.5382291396482476 | ||
0.47932014497306163 0.4100778380844449 0.775943532310819 | ||
0.9595958250961338 0.22948957719027813 0.16282010446838974 | ||
0.5857005206564531 0.39124506988307767 0.7098465999037719 | ||
0.8347606574129667 0.2825396877878992 0.4725949319027746 | ||
0.8986922154758862 0.2860770749688764 0.3324337663660165 | ||
0.155075332183405 0.41208032282060264 0.8978538015135173 | ||
0.0016093182645505024 0.45970372844320123 0.8880708823906698 | ||
0.9999075776070253 0.012343264630896177 0.005699128205460634 | ||
0.39009619978553806 0.6461479318530647 0.6559861317702446 | ||
0.008940978739817904 0.8229190021999863 0.568088351154425 | ||
0.20208253679716823 0.5924577187766283 0.7798438944965939 | ||
0.7188995010509277 0.4552994293388987 0.525248452670163 | ||
0.0018667535470563313 0.5711026319179426 0.8208765431217983 | ||
0.457439002676651 0.5246628491676907 0.7179682817043048 | ||
0.5776951761017083 0.816166710568455 0.011839935332762563 | ||
0.0076282792399037175 0.6345918271790589 0.7728098228111373 | ||
0.5366968717454277 0.09529264236304191 0.8383768723969796 | ||
0.44800602779830023 7.867067314582477E-4 0.8940301897301385 | ||
0.2723792102226376 0.34074509201745257 0.8998346226415774 | ||
0.8341947200560272 0.5389426579103059 0.11687591931283954 | ||
0.9582072930156356 0.2860747793410087 6.508948497827774E-5 | ||
0.008327759857075852 0.9554022196918892 0.29519018788498724 | ||
0.7677385209373639 0.6406991057972437 0.009067485843448334 | ||
0.23126358566631305 0.6544457299558596 0.7198735586804824 | ||
0.7799176926093916 0.472183239375897 0.4108179416813816 | ||
0.7102235838980736 0.584039579600987 0.3930397312416117 | ||
0.39091850471543826 0.8381147824832471 0.38045542978659846 | ||
0.5722154956531571 0.001449595754020678 0.8201020212184346 | ||
0.5251121642541302 0.7120281862717057 0.4661256020719829 | ||
4.896517706045277E-5 7.138126474976427E-5 0.9999999962535633 | ||
0.7072583549632001 0.7069495258463994 0.0028261706068652883 | ||
0.8896141701671768 2.8394628169995344E-4 0.456712762699133 | ||
0.45061107306014564 0.7195983715061821 0.5283255100420903 | ||
0.3598572480395501 0.4181624618263732 0.8340521066172717 | ||
0.08032879699537536 0.5385819786021534 0.8387352005837512 | ||
0.2732955730753264 0.4729239065491741 0.837647007009335 | ||
0.28314517789279886 0.005001577905328243 0.9590640189552062 | ||
0.8359900847340909 0.10626667281907784 0.5383567334716365 | ||
0.1674587660518311 0.8984834396927389 0.40581408338092767 | ||
0.656303597741188 0.5335335683038529 0.5334861939028328 | ||
0.6428152504360765 0.59786800603621 0.47889706740080434 | ||
0.5859760464602881 0.7077247949536825 0.3946614847974631 | ||
0.8993450101626113 0.4100003600825243 0.1519152968855114 | ||
0.0052807242984734045 0.7715150936251169 0.6361891025941191 | ||
0.9592379798537064 0.16776685407390649 0.22741323769808316 | ||
0.7781523954036859 0.34780421045249515 0.5229828684756531 | ||
0.2025549604965031 0.7784423436091736 0.5941371943032326 | ||
0.22227385727577098 0.9589804534077658 0.17592845805493246 | ||
0.00689298421978497 0.8868688015262133 0.46196992937636505 | ||
0.4692011988744236 0.6528427527957844 0.5946819108538832 | ||
0.5986508005499782 0.656575617535847 0.45883077213531703 | ||
0.4716451999063881 0.837604828763275 0.2756246655103783 | ||
0.00307307734580522 0.28190513695385166 0.9594373611417563 | ||
0.5299938536558705 0.777579893414258 0.33834305733215647 | ||
0.3361510112033106 0.5298922537794198 0.778599188961534 | ||
0.7642986455990692 0.004552538331120125 0.6448463807219297 | ||
0.6576401982470117 0.4665495953476732 0.5914734522618521 | ||
0.8990506425605709 0.14333523948752244 0.4137184443948313 | ||
0.4712883371289088 0.779512466407148 0.41261073423035544 | ||
0.2816431591836398 0.9594349342534145 0.012717618456486978 | ||
0.2669072614630653 0.8378914913411778 0.4761285147062124 | ||
0.35389450224419694 0.7756958472132534 0.5225462983291005 | ||
0.7791107578566927 0.1954074019045907 0.5956528974771027 | ||
0.7185227010424989 0.6551229925026154 0.23353584902753124 | ||
0.07732800249727152 0.8390622951948972 0.5385116942203328 | ||
0.5948030672590569 0.19845028242929622 0.7789908835043903 | ||
0.5981040664847707 0.7716018795599465 0.21656884612967509 | ||
0.38917617607291743 0.7134142471767054 0.5827366608533876 | ||
0.7156812684630316 0.23281293988774923 0.658481933686847 | ||
0.7790104800795785 0.5974487075814703 0.19025696763959907 | ||
0.2928165417333865 0.896790551391688 0.33170043687323086 | ||
0.896377212581244 0.44328573669726473 0.0023766375076081756 | ||
0.009977611245395023 0.7109746245437589 0.7031468769245133 | ||
0.8280104501979171 0.5606115379252159 0.010648845391247363 | ||
0.3922161046934152 0.5860316283182079 0.7090369932731534 | ||
0.6504188495874305 0.759575666878537 3.555100410989047E-4 | ||
0.5346998781832527 0.5317976507468055 0.6567246751348644 | ||
0.7796629738974626 0.5347375468295819 0.3258548804975082 | ||
0.4057044327082952 0.4790158316997778 0.778426455268454 | ||
0.6453800456730773 0.4043458769695593 0.6480655896008789 | ||
0.4664371643447679 0.28044351243157056 0.8389206208295606 | ||
0.713415425067671 0.5312220237851808 0.4569918956842575 | ||
0.5329244657922193 0.3345163935921461 0.7772324595500255 | ||
0.4183312800708757 0.14986003400994902 0.895846476981854 | ||
0.8221713259804387 0.0113265909093364 0.5691274190143538 | ||
0.4422549209850242 0.8968889006297106 9.406337008420132E-4 | ||
0.9547366718163965 0.05983237318198179 0.2913725701028881 | ||
0.6963985566741285 0.005675120929893703 0.7176328053152403 | ||
0.5276866263456081 0.4597733521627107 0.7142515586381695 | ||
0.1506487410298615 0.23773474448592782 0.9595765462381458 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.moeaframework</groupId> | ||
<artifactId>gd</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.moeaframework</groupId> | ||
<artifactId>moeaframework</artifactId> | ||
<version>3.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>colt</groupId> | ||
<artifactId>colt</artifactId> | ||
<version>1.2.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.joptimizer</groupId> | ||
<artifactId>joptimizer</artifactId> | ||
<version>5.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.13.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
package org.moeaframework.gd; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.moeaframework.Analyzer; | ||
import org.moeaframework.Executor; | ||
import org.moeaframework.algorithm.MOEAD; | ||
import org.moeaframework.core.Algorithm; | ||
import org.moeaframework.core.FrameworkException; | ||
import org.moeaframework.core.Initialization; | ||
import org.moeaframework.core.Population; | ||
import org.moeaframework.core.PopulationIO; | ||
import org.moeaframework.core.Problem; | ||
import org.moeaframework.core.Solution; | ||
import org.moeaframework.core.Variation; | ||
import org.moeaframework.core.operator.RandomInitialization; | ||
import org.moeaframework.core.spi.AlgorithmFactory; | ||
import org.moeaframework.core.spi.OperatorFactory; | ||
import org.moeaframework.core.spi.RegisteredAlgorithmProvider; | ||
import org.moeaframework.util.TypedProperties; | ||
import org.moeaframework.util.weights.NormalBoundaryDivisions; | ||
import org.moeaframework.util.weights.NormalBoundaryIntersectionGenerator; | ||
import org.moeaframework.util.weights.WeightGenerator; | ||
|
||
public class Example { | ||
|
||
public static void main(String[] args) { | ||
AlgorithmFactory.getInstance().addProvider(new RegisteredAlgorithmProvider() { | ||
|
||
{ | ||
register(Example::newGDMOEAD, "GD-MOEAD", "GD-MOEA/D"); | ||
} | ||
|
||
}); | ||
|
||
Executor executor = new Executor() | ||
.withProblem("DTLZ2_3") | ||
.withMaxEvaluations(10000); | ||
|
||
Analyzer analyzer = new Analyzer() | ||
.withSameProblemAs(executor) | ||
.includeHypervolume() | ||
.includeGenerationalDistance() | ||
.showStatisticalSignificance(); | ||
|
||
// collect data for regular MOEA/D | ||
analyzer.addAll("MOEA/D", executor | ||
.withAlgorithm("MOEA/D") | ||
.runSeeds(50)); | ||
|
||
// collect data for MOEA/D with Generalized Decomposition - by targeting the Pareto front | ||
// points, we should get extremely close to the optimum | ||
analyzer.addAll("GD-MOEA/D", executor | ||
.withAlgorithm("GD-MOEA/D") | ||
.withProperty("operator", "de+pm") // this is the default for MOEA/D | ||
.withProperty("targets", "DTLZ2.3D.pf") | ||
.runSeeds(50)); | ||
|
||
analyzer.printAnalysis(); | ||
|
||
} | ||
|
||
private static Algorithm newGDMOEAD(TypedProperties properties, Problem problem) { | ||
int populationSize; | ||
|
||
//provide weights | ||
WeightGenerator weightGenerator = null; | ||
|
||
if (properties.contains("targets")) { | ||
try { | ||
Population population = PopulationIO.readObjectives( | ||
new File(properties.getString("targets", null))); | ||
|
||
List<double[]> targets = new ArrayList<double[]>(); | ||
|
||
for (Solution solution : population) { | ||
targets.add(solution.getObjectives()); | ||
} | ||
|
||
populationSize = targets.size(); | ||
weightGenerator = new GeneralizedDecomposition(targets); | ||
} catch (IOException e) { | ||
throw new FrameworkException("failed to load targets", e); | ||
} | ||
} else { | ||
NormalBoundaryDivisions divisions = NormalBoundaryDivisions.fromProperties(properties, problem); | ||
|
||
populationSize = divisions.getNumberOfReferencePoints(problem); | ||
weightGenerator = new GeneralizedDecomposition(new NormalBoundaryIntersectionGenerator( | ||
problem.getNumberOfObjectives(), divisions)); | ||
} | ||
|
||
//enforce population size lower bound | ||
if (populationSize < problem.getNumberOfObjectives()) { | ||
System.err.println("increasing MOEA/D population size"); | ||
populationSize = problem.getNumberOfObjectives(); | ||
} | ||
|
||
Initialization initialization = new RandomInitialization(problem, populationSize); | ||
Variation variation = OperatorFactory.getInstance().getVariation(null, properties, problem); | ||
|
||
int neighborhoodSize = 20; | ||
int eta = 2; | ||
|
||
if (properties.contains("neighborhoodSize")) { | ||
neighborhoodSize = Math.max(2, | ||
(int)(properties.getDouble("neighborhoodSize", 0.1) * populationSize)); | ||
} | ||
|
||
if (neighborhoodSize > populationSize) { | ||
neighborhoodSize = populationSize; | ||
} | ||
|
||
if (properties.contains("eta")) { | ||
eta = Math.max(2, (int)(properties.getDouble("eta", 0.01) * populationSize)); | ||
} | ||
|
||
return new MOEAD( | ||
problem, | ||
neighborhoodSize, | ||
weightGenerator, | ||
initialization, | ||
variation, | ||
properties.getDouble("delta", 0.9), | ||
eta, | ||
(int)properties.getDouble("updateUtility", -1)); | ||
} | ||
|
||
} |
Oops, something went wrong.