1 | package negotiator.parties;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import genius.core.AgentID;
|
---|
6 | import genius.core.actions.Action;
|
---|
7 | import genius.core.actions.EndNegotiation;
|
---|
8 | import genius.core.actions.Offer;
|
---|
9 | import genius.core.parties.AbstractNegotiationParty;
|
---|
10 | import genius.core.parties.NegotiationInfo;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Agent that always ends the nego as quick as possible, only placing a random
|
---|
14 | * bid if it starts.
|
---|
15 | * <p/>
|
---|
16 | * The class was created as part of a series of agents used to understand the
|
---|
17 | * api better
|
---|
18 | *
|
---|
19 | * @author David Festen
|
---|
20 | */
|
---|
21 | public class NegotiationEndingParty extends AbstractNegotiationParty {
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Initializes a new instance of the {@link NegotiationEndingParty} class.
|
---|
25 | *
|
---|
26 | * @param utilitySpace
|
---|
27 | * The utility space used by this class
|
---|
28 | * @param deadlines
|
---|
29 | * The deadlines for this session
|
---|
30 | * @param timeline
|
---|
31 | * The time line (if time deadline) for this session, can be null
|
---|
32 | * @param randomSeed
|
---|
33 | * The seed that should be used for all randomization (to be
|
---|
34 | * reproducible)
|
---|
35 | */
|
---|
36 | @Override
|
---|
37 | public void init(NegotiationInfo info) {
|
---|
38 | super.init(info);
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * If offer was proposed: Accept offer, otherwise: Propose random offer
|
---|
43 | *
|
---|
44 | * @param possibleActions
|
---|
45 | * List of all actions possible.
|
---|
46 | * @return Accept or Offer action
|
---|
47 | */
|
---|
48 | @Override
|
---|
49 | public Action chooseAction(final List<Class<? extends Action>> possibleActions) {
|
---|
50 |
|
---|
51 | if (possibleActions.contains(EndNegotiation.class)) {
|
---|
52 | return new EndNegotiation(getPartyId());
|
---|
53 | } else {
|
---|
54 | return new Offer(getPartyId(), generateRandomBid());
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * We ignore any messages received.
|
---|
60 | *
|
---|
61 | * @param sender
|
---|
62 | * The initiator of the action
|
---|
63 | * @param arguments
|
---|
64 | * The action performed
|
---|
65 | */
|
---|
66 | @Override
|
---|
67 | public void receiveMessage(final AgentID sender, final Action arguments) {
|
---|
68 | super.receiveMessage(sender, arguments);
|
---|
69 | }
|
---|
70 |
|
---|
71 | @Override
|
---|
72 | public String getDescription() {
|
---|
73 | return "Stop Negotiation Party";
|
---|
74 | }
|
---|
75 |
|
---|
76 | }
|
---|