source: src/main/java/negotiator/boaframework/opponentmodel/tools/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: 1.0 KB
Line 
1package negotiator.boaframework.opponentmodel.tools;
2
3import genius.core.Bid;
4import genius.core.Domain;
5import genius.core.boaframework.OpponentModel;
6import genius.core.utility.AdditiveUtilitySpace;
7
8/**
9 * Some opponent models do not use the UtilitySpace-object. Using this object, a
10 * UtilitySpace-object can be created for each opponent model.
11 *
12 * @author Mark Hendrikx
13 */
14public class UtilitySpaceAdapter extends AdditiveUtilitySpace {
15
16 private OpponentModel opponentModel;
17
18 public UtilitySpaceAdapter(OpponentModel opponentModel, Domain domain) {
19 super(domain);
20 this.opponentModel = opponentModel;
21 }
22
23 public double getUtility(Bid b) {
24 double u = 0.;
25 try {
26 u = opponentModel.getBidEvaluation(b);
27 } catch (Exception e) {
28 e.printStackTrace();
29 System.err.println("getNormalizedUtility failed. returning 0");
30 u = 0.0;
31 }
32 return u;
33 }
34
35 public double getWeight(int i) {
36 System.err
37 .println("The opponent model should overwrite getWeight() when using the UtilitySpaceAdapter");
38 return i;
39 }
40}
Note: See TracBrowser for help on using the repository browser.