source: src/test/java/boaexample/AC_Uncertain.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: 1.6 KB
Line 
1package boaexample;
2
3import java.util.List;
4
5import genius.core.Bid;
6import genius.core.boaframework.AcceptanceStrategy;
7import genius.core.boaframework.Actions;
8import genius.core.uncertainty.UserModel;
9
10/**
11 * Accepts:
12 * <ul>
13 * <li>if we have uncertainty profile, and we receive an offer in our highest
14 * 10% best bids.
15 * <li>if we have normal utilityspace, and we receive offer with a utility
16 * better than 90% of what we offered last.
17 * </ul>
18 * Discount is ignored.
19 */
20public class AC_Uncertain extends AcceptanceStrategy {
21
22 @Override
23 public Actions determineAcceptability() {
24 Bid receivedBid = negotiationSession.getOpponentBidHistory()
25 .getLastBid();
26 Bid lastOwnBid = negotiationSession.getOwnBidHistory().getLastBid();
27 if (receivedBid == null || lastOwnBid == null) {
28 return Actions.Reject;
29 }
30
31 UserModel userModel = negotiationSession.getUserModel();
32 if (userModel != null) {
33 List<Bid> bidOrder = userModel.getBidRanking().getBidOrder();
34 if (bidOrder.contains(receivedBid)) {
35 double percentile = (bidOrder.size()
36 - bidOrder.indexOf(receivedBid))
37 / (double) bidOrder.size();
38 if (percentile < 0.1)
39 return Actions.Accept;
40 }
41 } else {
42 // we have a normal utilityspace
43 double otherLastUtil = negotiationSession.getUtilitySpace()
44 .getUtility(receivedBid);
45 double myLastUtil = negotiationSession.getUtilitySpace()
46 .getUtility(lastOwnBid);
47 if (otherLastUtil >= 0.9 * myLastUtil) {
48 return Actions.Accept;
49 }
50 }
51 return Actions.Reject;
52 }
53
54 @Override
55 public String getName() {
56 return "AC uncertainty example";
57 }
58}
Note: See TracBrowser for help on using the repository browser.