Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
stgroup
ttc18
Commits
a2ca6428
Commit
a2ca6428
authored
Feb 22, 2019
by
Johannes Mey
Browse files
add simple main file for genetic solver
parent
3ac3a7e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
jastadd-mquat-solver-genetic/build.gradle
View file @
a2ca6428
apply
plugin:
'java'
apply
plugin:
'application'
sourceCompatibility
=
1.8
...
...
@@ -7,6 +8,16 @@ repositories {
mavenCentral
()
}
jar
{
manifest
{
attributes
"Main-Class"
:
'de.tudresden.inf.st.mquat.solving.genetic.GeneticMain'
}
from
{
configurations
.
compile
.
collect
{
it
.
isDirectory
()
?
it
:
zipTree
(
it
)
}
}
}
dependencies
{
compile
group:
'org.apache.logging.log4j'
,
name:
'log4j-api'
,
version:
'2.10.0'
compile
group:
'org.apache.logging.log4j'
,
name:
'log4j-core'
,
version:
'2.10.0'
...
...
jastadd-mquat-solver-genetic/src/main/java/de/tudresden/inf/st/mquat/solving/genetic/GeneticMain.java
0 → 100644
View file @
a2ca6428
package
de.tudresden.inf.st.mquat.solving.genetic
;
import
de.tudresden.inf.st.mquat.generator.ScenarioDescription
;
import
de.tudresden.inf.st.mquat.generator.ScenarioGenerator
;
import
de.tudresden.inf.st.mquat.jastadd.model.Root
;
import
de.tudresden.inf.st.mquat.jastadd.model.Solution
;
import
de.tudresden.inf.st.mquat.solving.BenchmarkableSolver
;
import
de.tudresden.inf.st.mquat.solving.SolvingException
;
import
java.util.concurrent.TimeUnit
;
public
class
GeneticMain
{
public
static
void
main
(
String
[]
args
)
{
ScenarioGenerator
generator
=
new
ScenarioGenerator
(
new
ScenarioDescription
(
1
,
1
,
0
,
1
,
0
,
2
,
10
,
10
,
1
,
1
,
0
));
Root
model
=
generator
.
generate
();
System
.
out
.
println
(
"Problem has an initial solution with objective "
+
generator
.
getInitialSolution
().
computeObjective
());
BenchmarkableSolver
solver
=
new
GeneticSolver
(
GeneticSolver
.
SelectorType
.
NSGA2
,
100
,
100
);
solver
.
setTimeout
(
30
,
TimeUnit
.
SECONDS
);
try
{
Solution
solution
=
solver
.
solve
(
model
);
System
.
out
.
println
(
"Solution is valid: "
+
solution
.
isValid
());
System
.
out
.
println
(
"Found solution with objective "
+
solution
.
computeObjective
());
}
catch
(
SolvingException
e
)
{
e
.
printStackTrace
();
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment