source: src/main/java/agents/rlboa/LookBackQlearner.java@ 345

Last change on this file since 345 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.5 KB
Line 
1package agents.rlboa;
2
3import genius.core.Bid;
4import genius.core.BidHistory;
5import genius.core.actions.Action;
6import genius.core.actions.EndNegotiation;
7import genius.core.events.MultipartyNegoActionEvent;
8
9@SuppressWarnings("serial")
10public class LookBackQlearner extends Qlearner {
11
12 @Override
13 public AbstractState getStateRepresentation(MultipartyNegoActionEvent negoEvent) {
14
15 Bid oppLastBid = negotiationSession.getOpponentBidHistory().getLastBid();
16 Bid myLastBid = negotiationSession.getOwnBidHistory().getLastBid();
17
18 Bid myPreviousBid = this.getPreviousBid(negotiationSession.getOwnBidHistory());
19 Bid oppPreviousBid = this.getPreviousBid(negotiationSession.getOpponentBidHistory());
20
21 Bid agreement = negoEvent.getAgreement();
22 Action currentAction = negoEvent.getAction();
23
24 if (agreement != null || currentAction.getClass() == EndNegotiation.class) {
25 return LookBackState.TERMINAL;
26 }
27
28 int myBin = this.getBinIndex(myLastBid);
29 int myPrevBin = this.getBinIndex(myPreviousBid);
30 int oppBin = this.getBinIndex(oppLastBid);
31 int oppPrevBin = this.getBinIndex(oppPreviousBid);
32
33 double time = negotiationSession.getTime();
34
35 LookBackState state = new LookBackState(myBin, oppBin, myPrevBin, oppPrevBin, this.getTimeBinIndex(time));
36
37 return state;
38 }
39
40 private Bid getPreviousBid(BidHistory history) {
41 Bid bid = null;
42
43 if (history.size() > 1) {
44 return history.getHistory().get(history.size() - 1).getBid();
45 }
46
47 return bid;
48 }
49
50 @Override
51 public String getName() {
52 return "LookBackQlearner";
53 }
54}
Note: See TracBrowser for help on using the repository browser.