1 | /**
|
---|
2 | * OptimalBidder: using the optimal stopping rule (cutoffs) for bidding.
|
---|
3 | * B_{j+1} = 1/2 + 1/2 B_j^2
|
---|
4 | *
|
---|
5 | *
|
---|
6 | *
|
---|
7 | * @author rafik
|
---|
8 | ************************************************************************************************************************************/
|
---|
9 |
|
---|
10 | package agents;
|
---|
11 |
|
---|
12 | import java.util.HashMap;
|
---|
13 |
|
---|
14 | import genius.core.SupportedNegotiationSetting;
|
---|
15 | import genius.core.issue.ISSUETYPE;
|
---|
16 | import genius.core.issue.IssueDiscrete;
|
---|
17 | import genius.core.issue.Value;
|
---|
18 | import genius.core.issue.ValueDiscrete;
|
---|
19 |
|
---|
20 | public class OptimalBidderSimple extends OptimalBidder {
|
---|
21 | @Override
|
---|
22 | public void init() {
|
---|
23 | partitions = 1000;
|
---|
24 | rv = utilitySpace.getReservationValue();
|
---|
25 | super.init();
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public String getName() {
|
---|
30 | return "Optimal Bidder Simple";
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * computation of the bid for round j as in prop 4.3
|
---|
35 | *
|
---|
36 | * @param round
|
---|
37 | * j
|
---|
38 | * @return bid value
|
---|
39 | **/
|
---|
40 | @Override
|
---|
41 | public double bid(int j) {
|
---|
42 | if (j == 1)
|
---|
43 | return 0.5 + 0.5 * rv;
|
---|
44 | else
|
---|
45 | return 0.5 + 0.5 * Math.pow(bid(j - 1), 2);
|
---|
46 | }
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Getting the issue's values
|
---|
50 | *
|
---|
51 | * @param void
|
---|
52 | * @return void
|
---|
53 | * @throws Exception
|
---|
54 | **/
|
---|
55 | @Override
|
---|
56 | public void getValues() throws Exception {
|
---|
57 | if (pie.getType().equals(ISSUETYPE.DISCRETE)) {
|
---|
58 | IssueDiscrete discrete_pie = (IssueDiscrete) pie;
|
---|
59 | int nvalues = discrete_pie.getNumberOfValues();
|
---|
60 | print(" #values = " + nvalues);
|
---|
61 | values = new HashMap<Integer, Value>(nvalues);
|
---|
62 | for (int i = 0; i < nvalues; i++) {
|
---|
63 | ValueDiscrete value = discrete_pie.getValue(i);
|
---|
64 | values.put(i, value);
|
---|
65 | // print( " values[" + i + "] = " + value);
|
---|
66 | }
|
---|
67 | } else {
|
---|
68 | throw new Exception(
|
---|
69 | "Type " + pie.getType() + " not supported by " + getName());
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | @Override
|
---|
74 | public String getVersion() {
|
---|
75 | return "v1.0";
|
---|
76 | }
|
---|
77 |
|
---|
78 | @Override
|
---|
79 | public SupportedNegotiationSetting getSupportedNegotiationSetting() {
|
---|
80 | return SupportedNegotiationSetting.getLinearUtilitySpaceInstance();
|
---|
81 | }
|
---|
82 |
|
---|
83 | @Override
|
---|
84 | public String getDescription() {
|
---|
85 | return "using the optimal stopping rule (cutoffs) for bidding";
|
---|
86 | }
|
---|
87 |
|
---|
88 | } |
---|