-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleRandom.java
More file actions
64 lines (54 loc) · 1.63 KB
/
SimpleRandom.java
File metadata and controls
64 lines (54 loc) · 1.63 KB
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
import java.util.Random;
/**
* A Visualisation Tool for
* Selection Hyper-Heuristics <br>
* <br>
* http://code.google.com/p/vch/ <br>
* <br>
* Module: G52GRP, University of Nottingham <br>
* <br>
* Group: gp09-exo <br>
* @author Lao Jingqi (jxl29u)
* @author Zhang Chao (cxz09u)
* @author Thomas Barton (txb18u)
* @author Ben Jenkinson (bxj08u)
* @author Alexander Jermstad (asj08u)
*
*/
/**
* the class is the heuristics selection greedy random which extends from HeuristicsSelection
*/
public class SimpleRandom extends HeuristicsSelection {
/**
* create an random instance
*/
Random random = new Random();
/**
* the instance of HyperHeuristic
*/
HyperHeuristic hyperHeuristic;
/**
* Defines an SimpleRandom object with a instance of HyperHeuristic
* @param hyperHeuristic
*/
public SimpleRandom(HyperHeuristic hyperHeuristic) {
// TODO Auto-generated constructor stub
this.hyperHeuristic = hyperHeuristic;
}
/**
* return the name as "Simple Random"
*/
@Override
String getName() {
// TODO Auto-generated method stub
return "Simple Random";
}
/**
* Override the method to get a low-level heuristic by simple random
*/
@Override
LowLevelHeuristic selectLowLevelHeuristic(int[] candiateSolution) {
// TODO Auto-generated method stub
return hyperHeuristic.lowLevelHeuristics.get(random.nextInt(hyperHeuristic.lowLevelHeuristics.size()));
}
}