-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbinMeta.java
62 lines (53 loc) · 1.38 KB
/
binMeta.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
/* binMeta class
*
* binMeta project
*
* last update: April 21, 2021
*
* AM
*/
public abstract class binMeta
{
protected String metaName; // meta-heuristic name
protected Objective obj; // objective function
protected Double objValue; // objective function value in solution
protected Data solution; // Data object containing solution
protected long maxTime; // maximum execution time (ms)
// getName
public String getName()
{
return this.metaName;
}
// getObj
public Objective getObj()
{
return this.obj;
}
// getObjVal (should be the value in the current solution)
public Double getObjVal()
{
return this.objValue;
}
// getSolution
public Data getSolution()
{
return this.solution;
}
// abstract method "optimize" (it runs the meta-heuristic method)
public abstract void optimize();
// toString
public String toString()
{
String print = "[" + this.metaName;
if (this.solution != null)
{
if (this.objValue == null) this.objValue = this.obj.value(this.solution);
print = print + ": objective " + this.obj.getName() + " has value " + this.objValue + " in current solution";
}
else
{
print = print + ": with objective " + this.obj.getName() + ", no known solutions up to now";
}
return print + "]";
}
}