source: src/main/java/agents/anac/y2014/BraveCat/OpponentModels/UtilitySpaceAdapter.java

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: 870 bytes
Line 
1package agents.anac.y2014.BraveCat.OpponentModels;
2
3import genius.core.Bid;
4import genius.core.Domain;
5import genius.core.utility.AdditiveUtilitySpace;
6
7@SuppressWarnings("serial")
8public class UtilitySpaceAdapter extends AdditiveUtilitySpace {
9 private OpponentModel opponentModel;
10
11 public UtilitySpaceAdapter(OpponentModel opponentModel, Domain domain) {
12 super(domain);
13 this.opponentModel = opponentModel;
14 }
15
16 @Override
17 public double getUtility(Bid b) {
18 double u = 0.0D;
19 try {
20 u = this.opponentModel.getBidEvaluation(b);
21 } catch (Exception e) {
22 System.err.println("getNormalizedUtility failed. returning 0");
23 u = 0.0D;
24 }
25 return u;
26 }
27
28 @Override
29 public double getWeight(int i) {
30 System.err
31 .println("The opponent model should overwrite getWeight() when using the UtilitySpaceAdapter");
32 return i;
33 }
34}
Note: See TracBrowser for help on using the repository browser.