[253] | 1 | package onetomany.bargainingchipsgame.players;
|
---|
[243] | 2 |
|
---|
[253] | 3 | import onetomany.bargainingchipsgame.Bundle;
|
---|
[268] | 4 | import onetomany.bargainingchipsgame.players.utilityfunction.UtilityFunction;
|
---|
[243] | 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 | *
|
---|
[268] | 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.
|
---|
[243] | 15 | *
|
---|
[268] | 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 | *
|
---|
[243] | 19 | */
|
---|
[257] | 20 | public class Agent implements Runnable
|
---|
[243] | 21 | {
|
---|
| 22 | private String name;
|
---|
| 23 | private Bundle wishlist;
|
---|
[268] | 24 | private UtilityFunction utility;
|
---|
[243] | 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 |
|
---|
[268] | 38 | public Agent(String n, Bundle w, UtilityFunction u, long d, String p)
|
---|
[243] | 39 | {
|
---|
| 40 | setName(n);
|
---|
| 41 | setWishlist(w);
|
---|
| 42 | setUtility(u);
|
---|
| 43 | setDeadline(d);
|
---|
| 44 | setPicture(p);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
[257] | 47 |
|
---|
| 48 | @Override
|
---|
| 49 | public void run() {
|
---|
| 50 | // TODO Auto-generated method stub
|
---|
| 51 |
|
---|
| 52 | // ? what to do here?
|
---|
| 53 |
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 |
|
---|
[243] | 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 | */
|
---|
[257] | 86 | public Double getUtility(Bundle b)
|
---|
| 87 | {
|
---|
| 88 | return utility.getUtility(b);
|
---|
[243] | 89 | }
|
---|
| 90 | /**
|
---|
| 91 | * @param u the utility to set
|
---|
| 92 | */
|
---|
[268] | 93 | public void setUtility(UtilityFunction u) {
|
---|
[243] | 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 |
|
---|
[253] | 121 | @Override
|
---|
[243] | 122 | public String toString()
|
---|
| 123 | {
|
---|
[253] | 124 | return this.getClass().getSimpleName()+" (name:"+name+", wishlist:"+this.wishlist+", "+this.utility+", deadline:"+deadline+", picture:"+picture+")";
|
---|
[243] | 125 | }
|
---|
[257] | 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 |
|
---|
[243] | 132 | }
|
---|