1 | package genius.gui.progress.session;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 | import java.util.List;
|
---|
5 |
|
---|
6 | import genius.core.AgentID;
|
---|
7 | import genius.core.Bid;
|
---|
8 | import genius.core.parties.PartyWithUtility;
|
---|
9 | import genius.core.utility.UtilitySpace;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * One outcome in a negotiation
|
---|
13 | */
|
---|
14 | public class Outcome {
|
---|
15 | private int round = 1;
|
---|
16 | private int turn = 1;
|
---|
17 | private Bid bid;
|
---|
18 | private List<? extends PartyWithUtility> participants;
|
---|
19 | private List<Double> discUtils = new ArrayList<Double>();
|
---|
20 |
|
---|
21 | // true if this bid is an agreement
|
---|
22 | private boolean isAgreement;
|
---|
23 | private AgentID agentID;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Create new outcome. We calculate discounted utilities right here.
|
---|
27 | *
|
---|
28 | * @param bid
|
---|
29 | * the current bid or accepted bid (if party does an accept for a
|
---|
30 | * bid).
|
---|
31 | * @param round
|
---|
32 | * @param turn
|
---|
33 | * @param parties
|
---|
34 | * @param isAgreement
|
---|
35 | * @param agent
|
---|
36 | * the agent that placed this bid
|
---|
37 | * @param time
|
---|
38 | * the time at which this bid was placed.
|
---|
39 | */
|
---|
40 | public Outcome(Bid bid, int round, int turn, List<? extends PartyWithUtility> parties, boolean isAgreement,
|
---|
41 | AgentID agent, double time) {
|
---|
42 | this.round = round;
|
---|
43 | this.turn = turn;
|
---|
44 | this.bid = bid;
|
---|
45 | this.participants = parties;
|
---|
46 | this.isAgreement = isAgreement;
|
---|
47 | this.agentID = agent;
|
---|
48 | for (PartyWithUtility party : participants) {
|
---|
49 | UtilitySpace us = party.getUtilitySpace();
|
---|
50 | discUtils.add(us.discount(us.getUtility(bid), time));
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | public int getRound() {
|
---|
55 | return round;
|
---|
56 | }
|
---|
57 |
|
---|
58 | public int getTurn() {
|
---|
59 | return turn;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public Bid getBid() {
|
---|
63 | return bid;
|
---|
64 | }
|
---|
65 |
|
---|
66 | public List<? extends PartyWithUtility> getParticipants() {
|
---|
67 | return participants;
|
---|
68 | }
|
---|
69 |
|
---|
70 | public List<Double> getDiscountedUtilities() {
|
---|
71 | return discUtils;
|
---|
72 | }
|
---|
73 |
|
---|
74 | public boolean isAgreement() {
|
---|
75 | return isAgreement;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * @return The agent that placed this bid.
|
---|
80 | *
|
---|
81 | */
|
---|
82 | public AgentID getAgentID() {
|
---|
83 | return agentID;
|
---|
84 | }
|
---|
85 | }
|
---|