Last change
on this file 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:
973 bytes
|
Line | |
---|
1 | package negotiator.boaframework.opponentmodel.agentlg;
|
---|
2 | import java.util.HashMap;
|
---|
3 |
|
---|
4 | import genius.core.issue.Issue;
|
---|
5 | import genius.core.issue.Value;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Class that is used by the opponent model of the ANAC2012 AgentLG.
|
---|
9 | */
|
---|
10 | public class BidStatistic {
|
---|
11 |
|
---|
12 | private HashMap<Value,Integer> valStatis = new HashMap<Value,Integer>();
|
---|
13 |
|
---|
14 | public BidStatistic(Issue issue) {
|
---|
15 | super();
|
---|
16 | }
|
---|
17 |
|
---|
18 | public void add(Value v)
|
---|
19 | {
|
---|
20 | if(valStatis.get(v)== null) {
|
---|
21 | valStatis.put(v,1);
|
---|
22 | } else {
|
---|
23 | valStatis.put(v,valStatis.get(v) + 1);
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | public int getMostVotedCount()
|
---|
28 | {
|
---|
29 | Integer maxtimes=0;
|
---|
30 | for (Value val:valStatis.keySet())
|
---|
31 | {
|
---|
32 | if (valStatis.get(val)>maxtimes)
|
---|
33 | {
|
---|
34 | maxtimes=valStatis.get(val);
|
---|
35 | }
|
---|
36 | }
|
---|
37 | return maxtimes;
|
---|
38 | }
|
---|
39 |
|
---|
40 | public double getValueUtility(Value value)
|
---|
41 | {
|
---|
42 | double ret = 0;
|
---|
43 | if (valStatis.get(value)!= null)
|
---|
44 | ret = ((double)valStatis.get(value)) / ((double)getMostVotedCount());
|
---|
45 | return ret;
|
---|
46 | }
|
---|
47 |
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.