[1] | 1 | package agents.anac.y2010.AgentSmith;
|
---|
| 2 |
|
---|
| 3 | import java.util.List;
|
---|
| 4 |
|
---|
| 5 | import genius.core.Bid;
|
---|
| 6 | import genius.core.Domain;
|
---|
| 7 | import genius.core.issue.Issue;
|
---|
| 8 | import genius.core.utility.AdditiveUtilitySpace;
|
---|
| 9 | import genius.core.utility.Evaluator;
|
---|
| 10 |
|
---|
| 11 | public class PreferenceProfileManager {
|
---|
| 12 |
|
---|
| 13 | protected AdditiveUtilitySpace fUtilitySpace;
|
---|
| 14 | protected BidHistory fBidHistory;
|
---|
| 15 | private IOpponentModel fOpponentModel;
|
---|
| 16 |
|
---|
| 17 | public PreferenceProfileManager(BidHistory pHist,
|
---|
| 18 | AdditiveUtilitySpace pUtilitySpace) {
|
---|
| 19 | this.fBidHistory = pHist;
|
---|
| 20 | this.fUtilitySpace = pUtilitySpace;
|
---|
| 21 | this.fOpponentModel = new OpponentModel(this, fBidHistory);
|
---|
| 22 |
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * Retrieves the utility of an opponent, this can be based on the
|
---|
| 27 | * bidhistory.
|
---|
| 28 | *
|
---|
| 29 | * @param b
|
---|
| 30 | * @return
|
---|
| 31 | */
|
---|
| 32 | public double getOpponentUtility(Bid b) {
|
---|
| 33 | return fOpponentModel.getUtility(b);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | /*
|
---|
| 37 | * add a bid to the opponentmodel
|
---|
| 38 | */
|
---|
| 39 | public void addBid(Bid b) {
|
---|
| 40 | this.fOpponentModel.addBid(b);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * Returns the utility for a bid for me. Will be just a call to
|
---|
| 45 | * utilityspace.
|
---|
| 46 | *
|
---|
| 47 | * @param b
|
---|
| 48 | * @return
|
---|
| 49 | */
|
---|
| 50 | public double getMyUtility(Bid b) {
|
---|
| 51 | try {
|
---|
| 52 | return this.fUtilitySpace.getUtility(b);
|
---|
| 53 | } catch (Exception e) {
|
---|
| 54 | return 0;
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | /*
|
---|
| 59 | * returns the Evaluator of an issue
|
---|
| 60 | */
|
---|
| 61 | public Evaluator getMyEvaluator(int issueID) {
|
---|
| 62 | return this.fUtilitySpace.getEvaluator(issueID);
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /*
|
---|
| 66 | * returns the domain
|
---|
| 67 | */
|
---|
| 68 | public Domain getDomain() {
|
---|
| 69 | return this.fUtilitySpace.getDomain();
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | /*
|
---|
| 73 | * returns the list of issues in the domain
|
---|
| 74 | */
|
---|
| 75 | public List<Issue> getIssues() {
|
---|
| 76 | return this.fUtilitySpace.getDomain().getIssues();
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | /*
|
---|
| 80 | * returns the opponentmodel
|
---|
| 81 | */
|
---|
| 82 | public IOpponentModel getOpponentModel() {
|
---|
| 83 | return fOpponentModel;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | /*
|
---|
| 87 | * sets the opponent model
|
---|
| 88 | */
|
---|
| 89 | public void setOpponentModel(IOpponentModel fOpponentModel) {
|
---|
| 90 | this.fOpponentModel = fOpponentModel;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|