[1] | 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, double alpha, double beta) {
|
---|
| 34 | this.negotiationSession = negoSession;
|
---|
| 35 | this.offeringStrategy = strat;
|
---|
| 36 | this.a = alpha;
|
---|
| 37 | this.b = beta;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | @Override
|
---|
| 41 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
| 42 | Map<String, Double> parameters) throws Exception {
|
---|
| 43 | this.negotiationSession = negoSession;
|
---|
| 44 | this.offeringStrategy = strat;
|
---|
| 45 |
|
---|
| 46 | if (parameters.get("a") != null || parameters.get("b") != null) {
|
---|
| 47 | a = parameters.get("a");
|
---|
| 48 | b = parameters.get("b");
|
---|
| 49 | } else {
|
---|
| 50 | a = 1;
|
---|
| 51 | b = 0;
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | @Override
|
---|
| 56 | public String printParameters() {
|
---|
| 57 | String str = "[a: " + a + " b: " + b + "]";
|
---|
| 58 | return str;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | @Override
|
---|
| 62 | public Actions determineAcceptability() {
|
---|
| 63 | double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
|
---|
| 64 | double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
| 65 | .getMyUndiscountedUtil();
|
---|
| 66 |
|
---|
| 67 | if (a * lastOpponentBidUtil + b >= nextMyBidUtil) {
|
---|
| 68 | return Actions.Accept;
|
---|
| 69 | }
|
---|
| 70 | return Actions.Reject;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | @Override
|
---|
| 74 | public Set<BOAparameter> getParameterSpec() {
|
---|
| 75 |
|
---|
| 76 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
| 77 | set.add(new BOAparameter("a", 1.0,
|
---|
| 78 | "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
|
---|
| 79 | set.add(new BOAparameter("b", 0.0,
|
---|
| 80 | "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
|
---|
| 81 |
|
---|
| 82 | return set;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | @Override
|
---|
| 86 | public String getName() {
|
---|
| 87 | return "AC_Next example";
|
---|
| 88 | }
|
---|
| 89 | } |
---|