source: src/main/java/agents/anac/y2011/TheNegotiator/Decider.java@ 126

Last change on this file since 126 was 126, checked in by Aron Hammond, 6 years ago

Added function to calculate opposition to MultiLateralAnalysis.java

Moved code to add RLBOA listeners to RLBOAUtils is misc package

Added input for strategyParameters to SessionPanel (gui)

!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files

Our own package:

  • Added opponents and strategies that are mentioned in the report
  • Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
  • States extend from AbstractState
File size: 2.6 KB
Line 
1package agents.anac.y2011.TheNegotiator;
2
3import genius.core.Agent;
4import genius.core.Bid;
5import genius.core.actions.Action;
6import genius.core.actions.Offer;
7
8/**
9 * The Decider class is used to decide each turn which action the agent should
10 * perform.
11 *
12 * @author Alex Dirkzwager, Mark Hendrikx, Julian de Ruiter
13 */
14public class Decider {
15
16 // storageobject which contains all possible bids, bids already used, and
17 // opponent bids.
18 private BidsCollection bidsCollection;
19 // reference to the timemanager (manages time related function)
20 private TimeManager timeManager;
21 // reference to the bidsgenerator (generates a (counter)offer)
22 private BidGenerator bidGenerator;
23 // reference to the acceptor (generates an action to accept)
24 private Acceptor acceptor;
25 // reference to the negotiation agent
26 private Agent agent;
27 private Bid lastOppbid;
28
29 /**
30 * Creates a Decider-object which determines which offers should be made
31 * during the negotiation.
32 *
33 * @param agent
34 * in negotiation
35 */
36 public Decider(Agent agent) {
37 this.agent = agent;
38 bidsCollection = new BidsCollection();
39 bidGenerator = new BidGenerator(agent, bidsCollection);
40 acceptor = new Acceptor(agent.utilitySpace, bidsCollection,
41 agent.getAgentID());
42 timeManager = new TimeManager(agent.timeline,
43 agent.utilitySpace.getDiscountFactor(), bidsCollection);
44 }
45
46 /**
47 * Stores the bids of the partner in the history with the corresponding
48 * utility.
49 *
50 * @param action
51 * action made by partner
52 */
53 public void setPartnerMove(Action action) {
54 if (action instanceof Offer) {
55 lastOppbid = ((Offer) action).getBid();
56 try {
57 bidsCollection.addPartnerBid(lastOppbid,
58 agent.utilitySpace.getUtility(lastOppbid),
59 timeManager.getTime());
60 } catch (Exception e) {
61
62 }
63 }
64 }
65
66 /**
67 * Method which returns the action to be performed by the agent. Assumes
68 * setPartnerMove has been called with last opponent move.
69 */
70 public Action makeDecision() {
71
72 int phase = timeManager.getPhase(timeManager.getTime());
73 int movesLeft = 0;
74
75 if (phase == 3) {
76 movesLeft = timeManager.getMovesLeft();
77 }
78 // if the negotiation is still going on and a bid has already been made
79 double threshold = timeManager.getThreshold(timeManager.getTime());
80 Action action = acceptor.determineAccept(phase, threshold,
81 agent.timeline.getTime(), movesLeft, lastOppbid);
82
83 // if we didn't accept, generate an offer (end of negotiation is never
84 // played
85 if (action == null) {
86 action = bidGenerator.determineOffer(agent.getAgentID(), phase,
87 timeManager.getThreshold(timeManager.getTime()));
88 }
89 return action;
90 }
91}
Note: See TracBrowser for help on using the repository browser.