1 | package agents;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import genius.core.Bid;
|
---|
6 | import genius.core.actions.Action;
|
---|
7 | import genius.core.actions.Offer;
|
---|
8 | import genius.core.parties.AbstractNegotiationParty;
|
---|
9 | import genius.core.uncertainty.AdditiveUtilitySpaceFactory;
|
---|
10 | import genius.core.uncertainty.ExperimentalUserModel;
|
---|
11 | import genius.core.utility.AbstractUtilitySpace;
|
---|
12 |
|
---|
13 | public class UncertaintyAgentExample extends AbstractNegotiationParty {
|
---|
14 |
|
---|
15 | @Override
|
---|
16 | public Action chooseAction(List<Class<? extends Action>> possibleActions)
|
---|
17 | {
|
---|
18 | System.out.println("UncertaintyAgentExample: ");
|
---|
19 |
|
---|
20 | System.out.println("User model: " + userModel);
|
---|
21 |
|
---|
22 | System.out.println("Incoming util space: " + getUtilitySpace());
|
---|
23 |
|
---|
24 | Bid randomBid = getUtilitySpace().getDomain().getRandomBid(rand);
|
---|
25 | System.out.println("Random bid util: " + getUtility(randomBid) + " for " + randomBid);
|
---|
26 |
|
---|
27 | if (userModel instanceof ExperimentalUserModel)
|
---|
28 | {
|
---|
29 | System.out.println("You have given the agent access to the real utility space for debugging purposes.");
|
---|
30 | ExperimentalUserModel e = (ExperimentalUserModel) userModel;
|
---|
31 | AbstractUtilitySpace realUSpace = e.getRealUtilitySpace();
|
---|
32 | System.out.println("Real utility space: " + realUSpace);
|
---|
33 | }
|
---|
34 |
|
---|
35 | return new Offer(getPartyId(), generateRandomBid());
|
---|
36 | }
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * With this method, you can override the default estimate of the utility space given uncertain preferences specified by the user model.
|
---|
40 | * This example sets every value to zero.
|
---|
41 | */
|
---|
42 | @Override
|
---|
43 | public AbstractUtilitySpace estimateUtilitySpace()
|
---|
44 | {
|
---|
45 | return new AdditiveUtilitySpaceFactory(getDomain()).getUtilitySpace();
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 | @Override
|
---|
50 | public String getDescription()
|
---|
51 | {
|
---|
52 | return "Example agent that can deal with uncertain preferences";
|
---|
53 | }
|
---|
54 |
|
---|
55 | }
|
---|