source: src/main/java/agents/anac/y2010/Southampton/analysis/BidSpaceDiscrete.java@ 126

Last change on this file since 126 was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 1.9 KB
Line 
1package agents.anac.y2010.Southampton.analysis;
2
3import java.util.ArrayList;
4import java.util.HashMap;
5
6import genius.core.issue.ValueDiscrete;
7
8public class BidSpaceDiscrete {
9
10 /**
11 * @param discreteEvaluationFunctions
12 * @param discreteWeights
13 * @return
14 */
15 public static ValueDiscrete[][] getDiscreteCombinations(ArrayList<HashMap<ValueDiscrete, Double>> discreteEvaluationFunctions,
16 ArrayList<Double> discreteWeights) {
17 return getDiscrete(getDiscreteCombinationValues(discreteEvaluationFunctions), discreteEvaluationFunctions, discreteWeights);
18 }
19
20 /**
21 * @param discreteCombinationValues
22 * @param discreteEvaluationFunctions
23 * @param discreteWeights
24 * @return
25 */
26 private static ValueDiscrete[][] getDiscrete(ArrayList<int[]> discreteCombinationValues,
27 ArrayList<HashMap<ValueDiscrete, Double>> discreteEvaluationFunctions, ArrayList<Double> discreteWeights) {
28 ValueDiscrete[][] result = new ValueDiscrete[discreteCombinationValues.size()][discreteEvaluationFunctions.size()];
29
30 int i = 0;
31 for (int[] discreteCombinationValue : discreteCombinationValues) {
32 for (int j = 0; j < discreteEvaluationFunctions.size(); j++) {
33 result[i][j] = (ValueDiscrete) discreteEvaluationFunctions.get(j).keySet().toArray()[discreteCombinationValue[j]];
34 }
35 i++;
36 }
37
38 return result;
39 }
40
41 /**
42 * @param discreteEvaluationFunctions
43 * @return
44 */
45 private static ArrayList<int[]> getDiscreteCombinationValues(ArrayList<HashMap<ValueDiscrete, Double>> discreteEvaluationFunctions) {
46 int[] space = new int[discreteEvaluationFunctions.size() + 1];
47 space[0] = 1;
48 int i = 0;
49
50 // Work out how many 'sections' there are
51 for (HashMap<ValueDiscrete, Double> discreteEvaluationFunction : discreteEvaluationFunctions) {
52 i++;
53 space[i] = space[i - 1] * discreteEvaluationFunction.size();
54 }
55
56 // Work out what the combinations of spaces are
57 return BidSpace.getCombinationValues(space);
58 }
59}
Note: See TracBrowser for help on using the repository browser.