[32] | 1 | package agents;
|
---|
| 2 |
|
---|
| 3 | import java.util.List;
|
---|
| 4 |
|
---|
[46] | 5 | import genius.core.Bid;
|
---|
[32] | 6 | import genius.core.actions.Action;
|
---|
[50] | 7 | import genius.core.actions.Offer;
|
---|
[32] | 8 | import genius.core.parties.AbstractNegotiationParty;
|
---|
[57] | 9 | import genius.core.uncertainty.AdditiveUtilitySpaceFactory;
|
---|
[64] | 10 | import genius.core.uncertainty.ExperimentalUserModel;
|
---|
[46] | 11 | import genius.core.utility.AbstractUtilitySpace;
|
---|
[32] | 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: ");
|
---|
[46] | 19 |
|
---|
[50] | 20 | System.out.println("User model: " + userModel);
|
---|
[46] | 21 |
|
---|
[50] | 22 | System.out.println("Incoming util space: " + getUtilitySpace());
|
---|
[46] | 23 |
|
---|
[50] | 24 | Bid randomBid = getUtilitySpace().getDomain().getRandomBid(rand);
|
---|
| 25 | System.out.println("Random bid util: " + getUtility(randomBid) + " for " + randomBid);
|
---|
[46] | 26 |
|
---|
[64] | 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 | }
|
---|
[46] | 34 |
|
---|
[50] | 35 | return new Offer(getPartyId(), generateRandomBid());
|
---|
[32] | 36 | }
|
---|
[46] | 37 |
|
---|
[64] | 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 | */
|
---|
[57] | 42 | @Override
|
---|
| 43 | public AbstractUtilitySpace estimateUtilitySpace()
|
---|
| 44 | {
|
---|
| 45 | return new AdditiveUtilitySpaceFactory(getDomain()).getUtilitySpace();
|
---|
| 46 | }
|
---|
| 47 |
|
---|
[32] | 48 |
|
---|
| 49 | @Override
|
---|
| 50 | public String getDescription()
|
---|
| 51 | {
|
---|
| 52 | return "Example agent that can deal with uncertain preferences";
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | }
|
---|