source: src/main/java/agents/UtilityBasedAcceptor.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.4 KB
Line 
1package agents;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import genius.core.Bid;
7import genius.core.BidIterator;
8import genius.core.SupportedNegotiationSetting;
9
10/**
11 * This agent does not concede, but will accept anything equal to or above the
12 * reservation value. For undiscounted domain only.
13 */
14public class UtilityBasedAcceptor extends TimeDependentAgent {
15
16 private List<Bid> acceptableBids;
17
18 @Override
19 public double getE() {
20 return 0;
21 }
22
23 @Override
24 public String getName() {
25 return "Utility Based Acceptor";
26 }
27
28 @Override
29 public void init() {
30 super.init();
31 acceptableBids = new ArrayList<Bid>();
32
33 BidIterator iter = new BidIterator(this.utilitySpace.getDomain());
34 while (iter.hasNext()) {
35 Bid bid = iter.next();
36 try {
37
38 if (getUtility(bid) >= utilitySpace.getReservationValue() && (Math.random() <= getUtility(bid)))
39 this.acceptableBids.add(bid);
40
41 } catch (Exception e) {
42 e.printStackTrace();
43 }
44 }
45
46 }
47
48 @Override
49 public boolean isAcceptable(Bid plannedBid) {
50 Bid opponentLastBid = getOpponentLastBid();
51 if (this.acceptableBids.contains(opponentLastBid))
52 return true;
53 else
54 return false;
55 }
56
57 @Override
58 public SupportedNegotiationSetting getSupportedNegotiationSetting() {
59 return SupportedNegotiationSetting.getLinearUtilitySpaceInstance();
60 }
61
62 @Override
63 public String getDescription() {
64 return "Utility Based Acceptor";
65 }
66}
Note: See TracBrowser for help on using the repository browser.