[200] | 1 | package agents.anac.y2019.podagent;
|
---|
| 2 |
|
---|
| 3 | import java.util.HashSet;
|
---|
| 4 | import java.util.Map;
|
---|
| 5 | import java.util.Set;
|
---|
| 6 |
|
---|
| 7 | import genius.core.BidHistory;
|
---|
| 8 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
| 9 | import genius.core.boaframework.Actions;
|
---|
| 10 | import genius.core.boaframework.BOAparameter;
|
---|
| 11 | import genius.core.boaframework.NegotiationSession;
|
---|
| 12 | import genius.core.boaframework.OfferingStrategy;
|
---|
| 13 | import genius.core.boaframework.OpponentModel;
|
---|
| 14 | import genius.core.timeline.DiscreteTimeline;
|
---|
| 15 |
|
---|
| 16 | public class Group1_AS extends AcceptanceStrategy {
|
---|
| 17 | public Group1_AS() {
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public Group1_AS(NegotiationSession negoSession, OfferingStrategy strat, double friendliness, double panic) {
|
---|
| 21 | this.negotiationSession = negoSession;
|
---|
| 22 | this.offeringStrategy = strat;
|
---|
| 23 |
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | @Override
|
---|
| 27 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
| 28 | Map<String, Double> parameters) throws Exception {
|
---|
| 29 |
|
---|
| 30 | this.negotiationSession = negoSession;
|
---|
| 31 | this.offeringStrategy = strat;
|
---|
| 32 | this.opponentModel = opponentModel;
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * Determine whether to accept or not. We use a standard metric of comparing the offer to our next bid,
|
---|
| 37 | * but because out agent uniquely relies so heavily on our bidding strategy we only give up when we are out of turns
|
---|
| 38 | * without the need for complicated methods of acceptance.
|
---|
| 39 | *
|
---|
| 40 | * @return Actions.Reject if our BS is not in panicMode,
|
---|
| 41 | * or we are contesting a hard-headed opponent below a threshold.
|
---|
| 42 | * @return Actions.Accept if we are out of turns, our next bid is lower,
|
---|
| 43 | * or a hard-headed opponent beats a threshold.
|
---|
| 44 | */
|
---|
| 45 | @Override
|
---|
| 46 | public Actions determineAcceptability() {
|
---|
| 47 |
|
---|
| 48 | if (negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= offeringStrategy
|
---|
| 49 | .getNextBid().getMyUndiscountedUtil()) {
|
---|
| 50 | return Actions.Accept;
|
---|
| 51 | }
|
---|
| 52 | if (!getPanicMode()) {
|
---|
| 53 | return Actions.Reject;
|
---|
| 54 | }
|
---|
| 55 | boolean hardHead = false;
|
---|
| 56 | if (opponentModel instanceof Group1_OM) {
|
---|
| 57 | hardHead = ((Group1_OM) opponentModel).isHardHeaded();
|
---|
| 58 | }
|
---|
| 59 | if(hardHead) {
|
---|
| 60 | if(negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= 0.95) {
|
---|
| 61 | return Actions.Accept;
|
---|
| 62 | }
|
---|
| 63 | return Actions.Reject;
|
---|
| 64 | }
|
---|
| 65 | return Actions.Reject;
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | /**
|
---|
| 69 | * Get PanicMode from Bidding Strategy
|
---|
| 70 | *
|
---|
| 71 | * @return boolean in PanicMode or not
|
---|
| 72 | */
|
---|
| 73 | private Boolean getPanicMode() {
|
---|
| 74 | if(offeringStrategy instanceof Group1_BS) {
|
---|
| 75 | return ((Group1_BS) offeringStrategy).getPanicMode();
|
---|
| 76 | }
|
---|
| 77 | else {
|
---|
| 78 | return false;
|
---|
| 79 | }
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | @Override
|
---|
| 83 | public String getName() {
|
---|
| 84 | return "Group1_AS";
|
---|
| 85 | }
|
---|
| 86 | }
|
---|