1 | package genius.core.parties;
|
---|
2 |
|
---|
3 | import java.io.Serializable;
|
---|
4 |
|
---|
5 | import genius.core.AgentID;
|
---|
6 | import genius.core.Deadline;
|
---|
7 | import genius.core.persistent.PersistentDataContainer;
|
---|
8 | import genius.core.timeline.TimeLineInfo;
|
---|
9 | import genius.core.uncertainty.User;
|
---|
10 | import genius.core.uncertainty.UserModel;
|
---|
11 | import genius.core.utility.AbstractUtilitySpace;
|
---|
12 | import genius.core.utility.UncertainAdditiveUtilitySpace;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * An object that collects all the init parameters for
|
---|
16 | * {@link NegotiationParty#init()}. This makes the
|
---|
17 | * {@link NegotiationParty#init(NegotiationInfo)} call cleaner, and it makes it
|
---|
18 | * easier to add new functionality without having to fix all agents.
|
---|
19 | *
|
---|
20 | *
|
---|
21 | */
|
---|
22 | public class NegotiationInfo implements Serializable {
|
---|
23 | /**
|
---|
24 | *
|
---|
25 | */
|
---|
26 | private static final long serialVersionUID = 3940801208479173255L;
|
---|
27 | private AbstractUtilitySpace utilSpace;
|
---|
28 | private final Deadline deadline;
|
---|
29 | private final TimeLineInfo timeline;
|
---|
30 | private final long randomSeed;
|
---|
31 | private final AgentID agentID;
|
---|
32 | private final PersistentDataContainer storage;
|
---|
33 | private final UserModel userModel;
|
---|
34 | private final User user;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * Constructor with uncertainty. In this case the original utilityspace was
|
---|
38 | * {@link UncertainAdditiveUtilitySpace} and what is passed down here is a
|
---|
39 | * usermodel.
|
---|
40 | * Constructor used when utilSpace is not
|
---|
41 | * {@link UncertainAdditiveUtilitySpace}.
|
---|
42 | *
|
---|
43 | * @param utilSpace
|
---|
44 | * (a copy of/readonly version of) the
|
---|
45 | * {@link AbstractUtilitySpace} to be used for this session.
|
---|
46 | * @param deadline
|
---|
47 | * The deadline used for this negotiation.
|
---|
48 | * @param timeline
|
---|
49 | * The {@link TimeLineInfo} about current session.
|
---|
50 | * @param randomSeed
|
---|
51 | * A random seed that can be used for creating "consistent
|
---|
52 | * random" behaviour.
|
---|
53 | * @param agentID
|
---|
54 | * The agent's ID.
|
---|
55 | * @param storage
|
---|
56 | * storage space where the agent can store data that is
|
---|
57 | * persistent over sessions. Depending on the run settings, each
|
---|
58 | * [agentclass, profiles] tuple can have its own unique storage
|
---|
59 | * that persists only during the run of a tournament. Between
|
---|
60 | * sessions, this data is saved to disk to avoid memory issues
|
---|
61 | * when other agents are running. If the storage is not empty,
|
---|
62 | * this data is retrieved at the start of each session and saved
|
---|
63 | * at the end of each session. The load is timeboxed by the
|
---|
64 | * negotiation settings. The save time is limited to 1 second.
|
---|
65 | * The programmer should ensure that storage is actually
|
---|
66 | * serializable. This call is timeboxed by the negotiation
|
---|
67 | * deadline settings.
|
---|
68 | */
|
---|
69 | public NegotiationInfo(AbstractUtilitySpace utilSpace, UserModel userModel, User user, Deadline deadline,
|
---|
70 | TimeLineInfo timeline, long randomSeed, AgentID agentID,
|
---|
71 | PersistentDataContainer storage) {
|
---|
72 | if (utilSpace == null) {
|
---|
73 | throw new NullPointerException("utilSpace");
|
---|
74 | }
|
---|
75 | if (deadline == null) {
|
---|
76 | throw new NullPointerException("deadline");
|
---|
77 | }
|
---|
78 | if (timeline == null) {
|
---|
79 | throw new NullPointerException("timeline");
|
---|
80 | }
|
---|
81 | if (agentID == null) {
|
---|
82 | throw new NullPointerException("agentID");
|
---|
83 | }
|
---|
84 | if (storage == null) {
|
---|
85 | throw new NullPointerException("storage");
|
---|
86 | }
|
---|
87 | this.utilSpace = utilSpace;
|
---|
88 | this.deadline = deadline;
|
---|
89 | this.timeline = timeline;
|
---|
90 | this.randomSeed = randomSeed;
|
---|
91 | this.agentID = agentID;
|
---|
92 | this.storage = storage;
|
---|
93 | this.userModel = userModel;
|
---|
94 | this.user = user;
|
---|
95 | }
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * @return the UtilitySpace to use. Returns null if a userModel was provided
|
---|
99 | * instead.
|
---|
100 | */
|
---|
101 | public AbstractUtilitySpace getUtilitySpace() {
|
---|
102 | return utilSpace;
|
---|
103 | }
|
---|
104 |
|
---|
105 | public void setUtilSpace(AbstractUtilitySpace utilSpace) {
|
---|
106 | this.utilSpace = utilSpace;
|
---|
107 | }
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * @return A partial profile. If not null, this supersedes the value
|
---|
111 | * returned by {@link #getUtilitySpace()}.
|
---|
112 | */
|
---|
113 | public UserModel getUserModel() {
|
---|
114 | return userModel;
|
---|
115 | }
|
---|
116 |
|
---|
117 | public User getUser(){
|
---|
118 | return user;
|
---|
119 | }
|
---|
120 |
|
---|
121 | public long getRandomSeed() {
|
---|
122 | return randomSeed;
|
---|
123 | }
|
---|
124 |
|
---|
125 | public TimeLineInfo getTimeline() {
|
---|
126 | return timeline;
|
---|
127 | }
|
---|
128 |
|
---|
129 | public AgentID getAgentID() {
|
---|
130 | return agentID;
|
---|
131 | }
|
---|
132 |
|
---|
133 | public Deadline getDeadline() {
|
---|
134 | return deadline;
|
---|
135 | }
|
---|
136 |
|
---|
137 | public PersistentDataContainer getPersistentData() {
|
---|
138 | return storage;
|
---|
139 | }
|
---|
140 | }
|
---|