1 | package agents.anac.y2019.minf.etc;
|
---|
2 |
|
---|
3 | import java.util.HashSet;
|
---|
4 | import java.util.Map;
|
---|
5 | import java.util.Set;
|
---|
6 |
|
---|
7 | import genius.core.bidding.BidDetails;
|
---|
8 | import genius.core.boaframework.BOAparameter;
|
---|
9 | import genius.core.boaframework.NegotiationSession;
|
---|
10 | import genius.core.boaframework.NoModel;
|
---|
11 | import genius.core.boaframework.OMStrategy;
|
---|
12 | import genius.core.boaframework.OfferingStrategy;
|
---|
13 | import genius.core.boaframework.OpponentModel;
|
---|
14 | import genius.core.boaframework.SortedOutcomeSpace;
|
---|
15 |
|
---|
16 | public class TimeDependent_Offering extends OfferingStrategy {
|
---|
17 | /** Outcome space */
|
---|
18 | private SortedOutcomeSpace outcomespace;
|
---|
19 | /** Time of Maximum Utility */
|
---|
20 | private double MaxUtilTime;
|
---|
21 | /** Time of Concession */
|
---|
22 | private double ConcedeTime;
|
---|
23 | /** Negotiation Information */
|
---|
24 | private NegotiationInfo negotiationInfo;
|
---|
25 |
|
---|
26 | public TimeDependent_Offering(NegotiationInfo negoInfo){
|
---|
27 | this.negotiationInfo = negoInfo;
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void init(NegotiationSession negoSession, OpponentModel model, OMStrategy oms,
|
---|
32 | Map<String, Double> parameters) throws Exception {
|
---|
33 | super.init(negoSession, parameters);
|
---|
34 |
|
---|
35 | this.negotiationSession = negoSession;
|
---|
36 |
|
---|
37 | outcomespace = new SortedOutcomeSpace(negotiationSession.getUtilitySpace());
|
---|
38 | negotiationSession.setOutcomeSpace(outcomespace);
|
---|
39 |
|
---|
40 | if (parameters.get("MT") != null)
|
---|
41 | this.MaxUtilTime = parameters.get("MT");
|
---|
42 | else
|
---|
43 | this.MaxUtilTime = 0;
|
---|
44 |
|
---|
45 | if (parameters.get("CT") != null)
|
---|
46 | this.ConcedeTime = parameters.get("CT");
|
---|
47 | else
|
---|
48 | this.ConcedeTime = 1.0;
|
---|
49 |
|
---|
50 | this.opponentModel = model;
|
---|
51 |
|
---|
52 | this.omStrategy = oms;
|
---|
53 | }
|
---|
54 |
|
---|
55 | @Override
|
---|
56 | public BidDetails determineOpeningBid() {
|
---|
57 | return determineNextBid();
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Override
|
---|
61 | public BidDetails determineNextBid() {
|
---|
62 | double time = negotiationSession.getTime();
|
---|
63 | double utilityGoal = negotiationInfo.getRandomThreshold(time);
|
---|
64 |
|
---|
65 | if (time < MaxUtilTime) {
|
---|
66 | nextBid = negotiationSession.getOutcomeSpace().getMaxBidPossible();
|
---|
67 | } else if (time >= ConcedeTime && utilityGoal != 1.0D &&
|
---|
68 | negotiationSession.getOpponentBidHistory().getBestBidDetails().getMyUndiscountedUtil()
|
---|
69 | >= negotiationSession.getUtilitySpace().getReservationValueUndiscounted()) {
|
---|
70 | nextBid = negotiationSession.getOpponentBidHistory().getBestBidDetails();
|
---|
71 | } else {
|
---|
72 | // if there is no opponent model available
|
---|
73 | if (opponentModel instanceof NoModel) {
|
---|
74 | nextBid = negotiationSession.getOutcomeSpace().getBidNearUtility(utilityGoal);
|
---|
75 | } else {
|
---|
76 | nextBid = omStrategy.getBid(outcomespace, utilityGoal);
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | return nextBid;
|
---|
81 | }
|
---|
82 |
|
---|
83 | public NegotiationSession getNegotiationSession() {
|
---|
84 | return negotiationSession;
|
---|
85 | }
|
---|
86 |
|
---|
87 | @Override
|
---|
88 | public Set<BOAparameter> getParameterSpec() {
|
---|
89 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
90 | set.add(new BOAparameter("MT", 0.0, "Max Utility Time"));
|
---|
91 | set.add(new BOAparameter("CT", 1.0, "Concede Time"));
|
---|
92 |
|
---|
93 | return set;
|
---|
94 | }
|
---|
95 |
|
---|
96 | @Override
|
---|
97 | public String getName() {
|
---|
98 | return "TimeDependent Offering";
|
---|
99 | }
|
---|
100 | }
|
---|