1 | package negotiator.boaframework.acceptanceconditions.anac2012;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import agents.anac.y2012.AgentLG.OpponentBids;
|
---|
6 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
7 | import genius.core.boaframework.Actions;
|
---|
8 | import genius.core.boaframework.NegotiationSession;
|
---|
9 | import genius.core.boaframework.NoModel;
|
---|
10 | import genius.core.boaframework.OfferingStrategy;
|
---|
11 | import genius.core.boaframework.OpponentModel;
|
---|
12 | import negotiator.boaframework.sharedagentstate.anac2012.AgentLGSAS;
|
---|
13 |
|
---|
14 | public class AC_AgentLG extends AcceptanceStrategy {
|
---|
15 |
|
---|
16 | private boolean activeHelper = false;
|
---|
17 | private OpponentBids opponentsBid;
|
---|
18 |
|
---|
19 | public AC_AgentLG() {
|
---|
20 | }
|
---|
21 |
|
---|
22 | public AC_AgentLG(NegotiationSession negoSession, OfferingStrategy strat) throws Exception {
|
---|
23 | init(negoSession, strat, null, null);
|
---|
24 | }
|
---|
25 |
|
---|
26 | @Override
|
---|
27 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
28 | Map<String, Double> parameters) throws Exception {
|
---|
29 | this.negotiationSession = negoSession;
|
---|
30 | this.offeringStrategy = strat;
|
---|
31 |
|
---|
32 | // checking if offeringStrategy SAS is a AgentLGSAS
|
---|
33 | if (offeringStrategy.getHelper() == null || (!offeringStrategy.getHelper().getName().equals("AgentLR"))) {
|
---|
34 | opponentsBid = new OpponentBids(negoSession.getUtilitySpace());
|
---|
35 | helper = new AgentLGSAS(negotiationSession, opponentsBid, new NoModel(), null);
|
---|
36 | activeHelper = true;
|
---|
37 | } else {
|
---|
38 | helper = (AgentLGSAS) offeringStrategy.getHelper();
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | @Override
|
---|
43 | public Actions determineAcceptability() {
|
---|
44 |
|
---|
45 | if (activeHelper) {
|
---|
46 | opponentsBid.addBid(negotiationSession.getOpponentBidHistory().getLastBid());
|
---|
47 | }
|
---|
48 |
|
---|
49 | double time = negotiationSession.getTime();
|
---|
50 | if (negotiationSession.getOwnBidHistory().isEmpty()) {
|
---|
51 | return Actions.Reject;
|
---|
52 | }
|
---|
53 | double myUtility = negotiationSession.getUtilitySpace()
|
---|
54 | .getUtilityWithDiscount(negotiationSession.getOwnBidHistory().getLastBidDetails().getBid(), time);
|
---|
55 |
|
---|
56 | double opponentUtility = negotiationSession.getUtilitySpace()
|
---|
57 | .getUtilityWithDiscount(negotiationSession.getOpponentBidHistory().getLastBid(), time);
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * if(activeHelper){ if(!(time<0.6)) { if ( !(time>=0.9995)){ //to set
|
---|
61 | * some parameters ((AgentLRSAS) helper).getNextBid(time); }
|
---|
62 | *
|
---|
63 | * } }
|
---|
64 | */
|
---|
65 |
|
---|
66 | // System.out.println("decoupled Condition 1: " + (opponentUtility >=
|
---|
67 | // myUtility*0.99));
|
---|
68 | // System.out.println("decoupled Condition 2: " + ( time>0.999 &&
|
---|
69 | // opponentUtility >= myUtility*0.9));
|
---|
70 | // System.out.println("decoupled Condition 3: " + (((AgentLRSAS)
|
---|
71 | // helper).getMyBidsMinUtility(time)<= opponentUtility));
|
---|
72 |
|
---|
73 | // accept if opponent offer is good enough or there is no time and the
|
---|
74 | // offer is 'good'
|
---|
75 | if (opponentUtility >= myUtility * 0.99 || (time > 0.999 && opponentUtility >= myUtility * 0.9)
|
---|
76 | || ((AgentLGSAS) helper).getMyBidsMinUtility(time) <= opponentUtility) {
|
---|
77 | return Actions.Accept;
|
---|
78 |
|
---|
79 | }
|
---|
80 | return Actions.Reject;
|
---|
81 | }
|
---|
82 |
|
---|
83 | @Override
|
---|
84 | public String getName() {
|
---|
85 | return "2012 - AgentLG";
|
---|
86 | }
|
---|
87 |
|
---|
88 | }
|
---|