source: src/main/java/agents/similarity/CriteriaDiscrete.java@ 126

Last change on this file since 126 was 126, checked in by Aron Hammond, 6 years ago

Added function to calculate opposition to MultiLateralAnalysis.java

Moved code to add RLBOA listeners to RLBOAUtils is misc package

Added input for strategyParameters to SessionPanel (gui)

!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files

Our own package:

  • Added opponents and strategies that are mentioned in the report
  • Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
  • States extend from AbstractState
File size: 1.3 KB
Line 
1package agents.similarity;
2
3import java.util.HashMap;
4
5import genius.core.Bid;
6import genius.core.issue.ValueDiscrete;
7import genius.core.xml.SimpleElement;
8
9
10
11public class CriteriaDiscrete implements Criteria {
12 private int fIssueIndex;
13 private HashMap<ValueDiscrete, Double> fCriteriaValues;
14
15 public CriteriaDiscrete(int pIssueIndex) {
16 fIssueIndex = pIssueIndex;
17 fCriteriaValues = new HashMap<ValueDiscrete, Double> ();
18 }
19 public double getValue(Bid pBid) {
20 ValueDiscrete lValue = null;
21 try {
22 lValue = (ValueDiscrete)(pBid.getValue(fIssueIndex));
23 } catch (Exception e) {
24 e.printStackTrace();
25 }
26 Double lTmp = fCriteriaValues.get(lValue);
27 if (lTmp!=null) {
28 return fCriteriaValues.get(lValue);
29 } else {
30 System.out.println("Can't find criteria value for " +lValue.toString() + "(issue index = " +String.valueOf(fIssueIndex)+")");
31 return -1;
32 }
33
34 }
35
36 public void loadFromXML(SimpleElement pRoot) {
37
38 Object[] xml_items = (pRoot).getChildByTagName("item");
39 int nrOfValues = xml_items.length;
40 ValueDiscrete value;
41 for(int j=0;j<nrOfValues;j++) {
42 value = new ValueDiscrete(((SimpleElement)xml_items[j]).getAttribute("value"));
43 this.fCriteriaValues.put(value, Double.valueOf(((SimpleElement)xml_items[j]).getAttribute("evaluation")));
44 }
45 }
46
47
48}
Note: See TracBrowser for help on using the repository browser.