-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSMTIBEA_Main.java
65 lines (51 loc) · 1.67 KB
/
SMTIBEA_Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Original Creator: Christopher Henard
* Date: 01/03/14
*
* Modifier: Jia Hui Liang & Jianmei Guo
* Date: April-May 2016
*
*/
package smtibea;
import jmetal.core.Algorithm;
import jmetal.core.Problem;
import jmetal.core.SolutionSet;
import jmetal.core.Variable;
import jmetal.encodings.variable.Binary;
import satibea.SATIBEA_Problem;
import satibea.SATIBEA_SettingsIBEA;
public class SMTIBEA_Main {
/**
* @param args
* the command line arguments
*/
public static void main(String[] args) throws Exception {
try {
String fm = args[0];
String augment = fm + ".augment";
String dead = fm + ".dead";
String mandatory = fm + ".mandatory";
String seed = fm + ".richseed";
int duration = Integer.parseInt(args[1]);
Problem p = new SMTIBEA_Problem(fm, augment, mandatory, dead, seed);
Algorithm a = new SMTIBEA_SettingsIBEA(p).configureSATIBEA(duration, fm,
((SMTIBEA_Problem) p).getNumFeatures(), ((SMTIBEA_Problem) p).getConstraints());
SolutionSet pop = a.execute();
for (int i = 0; i < pop.size(); i++) {
Variable v = pop.get(i).getDecisionVariables()[0];
System.out.println("Conf" + (i + 1) + ": " + (Binary) v + " ");
}
for (int i = 0; i < pop.size(); i++) {
Variable v = pop.get(i).getDecisionVariables()[0];
for (int j = 0; j < pop.get(i).getNumberOfObjectives(); j++) {
System.out.print(pop.get(i).getObjective(j) + " ");
}
System.out.println("");
}
} catch (Exception e) {
e.printStackTrace();
System.out.println(
"Usage: java -jar satibea.jar fmDimacs timeMS\nThe .augment, .dead, .mandatory and .richseed files should be in the same directory as the FM.");
}
}
}