source: src/main/java/agents/rlboa/RLBOAagentBilateral.java

Last change on this file was 153, 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

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

This commit finalized the RLBOA project and it is now ready for use

Our own package (uva.project.:

  • Moved to agents.rlboa
  • 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: 1.9 KB
Line 
1package agents.rlboa;
2
3import genius.core.actions.Accept;
4import genius.core.actions.EndNegotiation;
5import genius.core.boaframework.BOAagentBilateral;
6import genius.core.events.MultipartyNegoActionEvent;
7import genius.core.events.NegotiationEvent;
8import genius.core.events.SessionEndedNormallyEvent;
9
10/**
11 * This class orchestrates the learning process of any BOAAgentBilateral that
12 * implements reinforcement learning into one of its components. To implement
13 * such an agent one needs to extends this class and implement ones own versions
14 * of the methods defined in the RLBOA interface.
15 */
16
17public abstract class RLBOAagentBilateral extends BOAagentBilateral implements RLBOA {
18
19 @Override
20 public abstract void agentSetup();
21
22 @Override
23 public void notifyChange(NegotiationEvent data) {
24
25 // the event was an action (offer/accept/endnegotiation..)
26 if (data instanceof MultipartyNegoActionEvent) {
27
28 // Get relevant information from negotiation event
29 MultipartyNegoActionEvent negoEvent = (MultipartyNegoActionEvent) data;
30
31 // This will get handled by the SessionEndedNormallyEvent case
32 if (negoEvent.getAction().getClass() == Accept.class || negoEvent.getAction().getClass() == EndNegotiation.class) {
33 return;
34 }
35
36 // Observe state
37 AbstractState newState = this.getStateRepresentation(negoEvent);
38
39 double reward = this.getReward(negoEvent.getAgreement());
40 boolean myTurn = negoEvent.getAction().getAgent() == this.getAgentID();
41
42 if (newState.isTerminalState() || !myTurn) {
43
44 this.observeEnvironment(reward, newState);
45
46 }
47 }
48 // the negotation ended
49 if (data instanceof SessionEndedNormallyEvent) {
50 double reward = this.getReward(((SessionEndedNormallyEvent) data).getAgreement());
51 this.observeEnvironment(reward, State.TERMINAL);
52 }
53 }
54}
Note: See TracBrowser for help on using the repository browser.