[127] | 1 | package agents.anac.y2014.BraveCat.OpponentModelStrategies;
|
---|
| 2 |
|
---|
| 3 | import agents.anac.y2014.BraveCat.OpponentModels.OpponentModel;
|
---|
| 4 | import java.util.HashMap;
|
---|
| 5 | import java.util.List;
|
---|
| 6 |
|
---|
| 7 | import agents.anac.y2014.BraveCat.necessaryClasses.NegotiationSession;
|
---|
| 8 | import agents.anac.y2014.BraveCat.necessaryClasses.OutcomeSpace;
|
---|
| 9 | import agents.anac.y2014.BraveCat.necessaryClasses.SortedOutcomeSpace;
|
---|
| 10 | import genius.core.bidding.BidDetails;
|
---|
| 11 | import genius.core.misc.Range;
|
---|
| 12 |
|
---|
| 13 | public abstract class OMStrategy
|
---|
| 14 | {
|
---|
| 15 | protected NegotiationSession negotiationSession;
|
---|
| 16 | protected OpponentModel model;
|
---|
| 17 | private final double RANGE_INCREMENT = 0.01D;
|
---|
| 18 |
|
---|
| 19 | private final int EXPECTED_BIDS_IN_WINDOW = 100;
|
---|
| 20 |
|
---|
| 21 | private final double INITIAL_WINDOW_RANGE = 0.01D;
|
---|
| 22 |
|
---|
| 23 | public void init(NegotiationSession negotiationSession, OpponentModel model, HashMap<String, Double> parameters)
|
---|
| 24 | throws Exception
|
---|
| 25 | {
|
---|
| 26 | this.negotiationSession = negotiationSession;
|
---|
| 27 | this.model = model;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | public void init(NegotiationSession negotiationSession, OpponentModel model)
|
---|
| 31 | throws Exception
|
---|
| 32 | {
|
---|
| 33 | this.negotiationSession = negotiationSession;
|
---|
| 34 | this.model = model;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public abstract BidDetails getBid(List<BidDetails> paramList);
|
---|
| 38 |
|
---|
| 39 | public BidDetails getBid(OutcomeSpace space, Range range)
|
---|
| 40 | {
|
---|
| 41 | List bids = space.getBidsinRange(range);
|
---|
| 42 | if (bids.size() == 0) {
|
---|
| 43 | if (range.getUpperbound() < 1.01D) {
|
---|
| 44 | range.increaseUpperbound(0.01D);
|
---|
| 45 | return getBid(space, range);
|
---|
| 46 | }
|
---|
| 47 | this.negotiationSession.setOutcomeSpace(space);
|
---|
| 48 | return this.negotiationSession.getMaxBidinDomain();
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | return getBid(bids);
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public void setOpponentModel(OpponentModel model) {
|
---|
| 55 | this.model = model;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | public BidDetails getBid(SortedOutcomeSpace space, double targetUtility)
|
---|
| 59 | {
|
---|
| 60 | Range range = new Range(targetUtility, targetUtility + 0.01D);
|
---|
| 61 | List bids = space.getBidsinRange(range);
|
---|
| 62 | if (bids.size() < 100) {
|
---|
| 63 | if (range.getUpperbound() < 1.01D) {
|
---|
| 64 | range.increaseUpperbound(0.01D);
|
---|
| 65 | return getBid(space, range);
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | return getBid(bids);
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | return getBid(bids);
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | public abstract boolean canUpdateOM();
|
---|
[1] | 75 | } |
---|