source: src/main/java/onetomany/bargainingchipsgame/players/Agent.java@ 268

Last change on this file since 268 was 268, checked in by Tim Baarslag, 5 years ago

Bargaining Chips packages cleanup

File size: 3.1 KB
Line 
1package onetomany.bargainingchipsgame.players;
2
3import onetomany.bargainingchipsgame.Bundle;
4import onetomany.bargainingchipsgame.players.utilityfunction.UtilityFunction;
5
6/**
7 * A negotiator agent has typically a buyer or seller role.
8 * An agent has a wish list (to buy or sell), which is a bundle, and a utility function for evaluating any proposal.
9 *
10 * Negotiator class has a wishlist, deadline, picture, and (implements) a utility function.
11 *
12 * Each user would enjoy a rational assistant agent to make one-to-many negotiation on his or behalf in Bargaining Chips Game.
13 * Players in BCG one-to-many negotiation domain are equipped with two modules, one coordinator agent and multiple negotiator agents one per each thread.
14 * The coordinator monitors and synchronizes all bilateral negotiation threads of each negotiator agent with an opponent regarding the whole preference list of the user.
15 *
16 * Each assistant, and accordingly its agents, could be in buyer or seller role.
17 * Buyer agent and many instances of seller agents are created in each one-to-many negotiation.
18 *
19 */
20public class Agent implements Runnable
21{
22 private String name;
23 private Bundle wishlist;
24 private UtilityFunction utility;
25 private String picture;
26 private long deadline;
27
28
29 public Agent()
30 {
31 setName(null);
32 setWishlist(null);
33 setUtility(null);
34 setDeadline(0);
35 setPicture(null);
36 }
37
38 public Agent(String n, Bundle w, UtilityFunction u, long d, String p)
39 {
40 setName(n);
41 setWishlist(w);
42 setUtility(u);
43 setDeadline(d);
44 setPicture(p);
45 }
46
47
48 @Override
49 public void run() {
50 // TODO Auto-generated method stub
51
52 // ? what to do here?
53
54 }
55
56
57 /**
58 * @return the wishlist
59 */
60 public Bundle getWishlist() {
61 return wishlist;
62 }
63 /**
64 * @param wishlist the wishlist to set
65 */
66 public void setWishlist(Bundle wishlist) {
67 this.wishlist = wishlist;
68 }
69 /**
70 * @return the name
71 */
72 public String getName() {
73 return name;
74 }
75
76 /**
77 * @param name the name to set
78 */
79 public void setName(String name) {
80 this.name = name;
81 }
82
83 /**
84 * @return the utility
85 */
86 public Double getUtility(Bundle b)
87 {
88 return utility.getUtility(b);
89 }
90 /**
91 * @param u the utility to set
92 */
93 public void setUtility(UtilityFunction u) {
94 this.utility = u;
95 }
96 /**
97 * @return the picture
98 */
99 public String getPicture() {
100 return picture;
101 }
102 /**
103 * @param picture the picture to set
104 */
105 public void setPicture(String picture) {
106 this.picture = picture;
107 }
108 /**
109 * @return the deadline
110 */
111 public long getDeadline() {
112 return deadline;
113 }
114 /**
115 * @param deadline the deadline to set
116 */
117 public void setDeadline(long deadline) {
118 this.deadline = deadline;
119 }
120
121 @Override
122 public String toString()
123 {
124 return this.getClass().getSimpleName()+" (name:"+name+", wishlist:"+this.wishlist+", "+this.utility+", deadline:"+deadline+", picture:"+picture+")";
125 }
126
127 public void printUtility(Bundle b)
128 {
129 System.out.println("\n"+this+"\nBundle "+b+"\n"+this.getName()+" evaluates utility of this bundle as "+this.getUtility(b));
130 }
131
132}
Note: See TracBrowser for help on using the repository browser.