[127] | 1 | package boaexample;
|
---|
| 2 |
|
---|
| 3 | import java.util.HashSet;
|
---|
| 4 | import java.util.Map;
|
---|
| 5 | import java.util.Set;
|
---|
| 6 |
|
---|
| 7 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
| 8 | import genius.core.boaframework.Actions;
|
---|
| 9 | import genius.core.boaframework.BOAparameter;
|
---|
| 10 | import genius.core.boaframework.NegotiationSession;
|
---|
| 11 | import genius.core.boaframework.OfferingStrategy;
|
---|
| 12 | import genius.core.boaframework.OpponentModel;
|
---|
| 13 |
|
---|
| 14 | /**
|
---|
| 15 | * This Acceptance Condition will accept an opponent bid if the utility is
|
---|
| 16 | * higher than the bid the agent is ready to present.
|
---|
| 17 | *
|
---|
| 18 | * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
|
---|
| 19 | * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
|
---|
| 20 | *
|
---|
| 21 | */
|
---|
| 22 | public class AC_Next extends AcceptanceStrategy {
|
---|
| 23 |
|
---|
| 24 | private double a;
|
---|
| 25 | private double b;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * Empty constructor for the BOA framework.
|
---|
| 29 | */
|
---|
| 30 | public AC_Next() {
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public AC_Next(NegotiationSession negoSession, OfferingStrategy strat,
|
---|
| 34 | double alpha, double beta) {
|
---|
| 35 | this.negotiationSession = negoSession;
|
---|
| 36 | this.offeringStrategy = strat;
|
---|
| 37 | this.a = alpha;
|
---|
| 38 | this.b = beta;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | @Override
|
---|
| 42 | public void init(NegotiationSession negoSession, OfferingStrategy strat,
|
---|
| 43 | OpponentModel opponentModel, Map<String, Double> parameters)
|
---|
| 44 | throws Exception {
|
---|
| 45 | this.negotiationSession = negoSession;
|
---|
| 46 | this.offeringStrategy = strat;
|
---|
| 47 |
|
---|
| 48 | if (parameters.get("a") != null || parameters.get("b") != null) {
|
---|
| 49 | a = parameters.get("a");
|
---|
| 50 | b = parameters.get("b");
|
---|
| 51 | } else {
|
---|
| 52 | a = 1;
|
---|
| 53 | b = 0;
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | @Override
|
---|
| 58 | public String printParameters() {
|
---|
| 59 | String str = "[a: " + a + " b: " + b + "]";
|
---|
| 60 | return str;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | @Override
|
---|
| 64 | public Actions determineAcceptability() {
|
---|
| 65 | double nextMyBidUtil = offeringStrategy.getNextBid()
|
---|
| 66 | .getMyUndiscountedUtil();
|
---|
| 67 | double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory()
|
---|
| 68 | .getLastBidDetails().getMyUndiscountedUtil();
|
---|
| 69 |
|
---|
| 70 | if (a * lastOpponentBidUtil + b >= nextMyBidUtil) {
|
---|
| 71 | return Actions.Accept;
|
---|
| 72 | }
|
---|
| 73 | return Actions.Reject;
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | @Override
|
---|
| 77 | public Set<BOAparameter> getParameterSpec() {
|
---|
| 78 |
|
---|
| 79 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
| 80 | set.add(new BOAparameter("a", 1.0,
|
---|
| 81 | "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
|
---|
| 82 | set.add(new BOAparameter("b", 0.0,
|
---|
| 83 | "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
|
---|
| 84 |
|
---|
| 85 | return set;
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | @Override
|
---|
| 89 | public String getName() {
|
---|
| 90 | return "AC_Next example";
|
---|
| 91 | }
|
---|
[1] | 92 | } |
---|