source: src/main/java/negotiator/parties/NonDeterministicConcederNegotiationParty.java@ 256

Last change on this file since 256 was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 1.1 KB
Line 
1package negotiator.parties;
2
3import java.util.List;
4import java.util.Random;
5
6import genius.core.Bid;
7import genius.core.bidding.BidDetails;
8import genius.core.misc.Range;
9import genius.core.parties.NegotiationInfo;
10
11public class NonDeterministicConcederNegotiationParty extends AbstractTimeDependentNegotiationParty {
12
13 public static final double DELTA = 0.05;
14 protected Random random;
15
16 @Override
17 public void init(NegotiationInfo info) {
18 super.init(info);
19 random = new Random();
20 }
21
22 @Override
23 protected Bid getNextBid() {
24 final List<BidDetails> candidates = getCandidates(getTargetUtility(), DELTA);
25 final BidDetails chosen = getRandomElement(candidates);
26 return chosen.getBid();
27 }
28
29 protected List<BidDetails> getCandidates(double target, double delta) {
30 return outcomeSpace.getBidsinRange(new Range(target - delta, target + delta));
31 }
32
33 protected <T> T getRandomElement(List<T> list) {
34 return list.get(random.nextInt(list.size()));
35 }
36
37 @Override
38 public double getE() {
39 return 2;
40 }
41
42 @Override
43 public String getDescription() {
44 return "Nondeterministic Conceder Party";
45 }
46}
Note: See TracBrowser for help on using the repository browser.