source: src/main/java/agents/anac/y2015/xianfa/AIssue.java@ 346

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

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 912 bytes
Line 
1package agents.anac.y2015.xianfa;
2
3import java.util.HashMap;
4import java.util.Random;
5
6import genius.core.issue.Value;
7
8public class AIssue {
9
10 HashMap<Value, Double> values = new HashMap<Value, Double>();
11 int issnr;
12
13 public AIssue(int n) {
14 issnr = n;
15 }
16
17 public int getIssNr() {
18 return issnr;
19 }
20
21 public void setVal(Value val, int total, int act) {
22 double freq = values.get(val);
23 if (act == 0) {
24 values.put(val, ((freq*(total-1))+1)/total);
25 } else {
26 values.put(val, freq+0.13);
27 }
28
29 }
30
31 public Value getDesiredVal() {
32 double max = 0;
33 Value value = new Value();
34 for (Value v : values.keySet()) {
35 if (values.get(v) > max) {
36 max = values.get(v);
37 value = v;
38 }
39 }
40 return value;
41 }
42
43 public double getVal(Value val) {
44 return values.get(val);
45 }
46
47 public HashMap<Value, Double> getValues() {
48 return values;
49 }
50}
Note: See TracBrowser for help on using the repository browser.