AI2 project
links
Hi, I propose to define the common contract in details between our agents since I've nearly finished to code. By now I've define the following rules:
- The price may vary between [0 .. 100]
- The follow contracting algorithm exists:
- Your agent asks for the resource (without suppling the price so far)
- My agent may respond with "lack of resources" (if I decide that my system is overloaded or whatever),"not for price" (in this case I propose my initial price to start with ).
- If I've replied with "lack of resource" - there is nothing to do, negotiation is closed
- If I've replied with "not for price" - we start to negotiate.
- A Negotiation is similar to the previous step but now I can't reply with "lack of resources" message, but instead if I decide that the negotiation is useless and we can't agree, I can send "quit negotiation" message (as described in the task of course). In addition I can neither accept or reject your proposal. This negotiation site may be executed more than once, I can decide to reply with "quit negotiation" only after the second "round".
I defined that only is available between the instances of our agents can open only one "conversation channel" simultaneously (this is because your agent will negotiate with the user as far as I concerned, so you'll need a kind of GUI)..
Now some technical details:
I differ between the message by "Perfomatives" I call "ACLMessage.setPerformative" in order to define the message type Since I've defined my own constants for this purpose I suggest you to use them too:
public enum Resource implements Serializable {
- NETWORK, CPU, DISK, MEMORY
}
- public static final int RESOURCE_REQUEST = 0; // this is what you sent in the very beginning
- public static final int LACK_OF_RESOURCE = 1; // I can reply in the very beginning
- public static final int LACK_FOR_PRICE = 2; // I can reply in the very beginning
Alon: redundant, you can use REJECT_PROPOSAL. besides when are you going to use this? we don't send the first price, you do.
NEW!!!
22/08/2007 Mark: yes, basically you right. I took this message from the task definition, since it is written in the "Stage 4" description section of the project task that I can reply with LACK_OF_RESOURCE or LACK_FOR_PRICE. I think that this name is not successful, but it should mean "I have this resource and I'm ready to trade it for N (here comes price)". I've introduced a dedicated and different "REJECT_PROPOSAL" message for negotiation, here there is no negotiation (hasn't been established yet)." So I tend to think, that this message should denote not a "reject of proposal" (there is no proposal) but NEGOTIATION_INVITATION with an initial price supplied or something like this.
- public static final int ACCEPT_PROPOSAL = 3; // Both of us can send it
- public static final int REJECT_PROPOSAL = 4; // I can send during the negotiation
- public static final int PROPOSE_PRICE = 5; // Both of us can send (Its a counter-proposal)
- public static final int QUIT_NEGOTIATION = 6; // Both of us can send
public static final int NOT_UNDERSTOOD = ACLMessage.NOT_UNDERSTOOD; // Both of us can send, I use this if you send me a message that shouldn't be considered (sent at the wrong time).
NEW!!!
19/08/2007
The information is transfered via the serializable classes An ACLMessage.setContentObject allows to do that I've defined 2 classes by now that can contain an information:
1 public class ResourceContent implements Serializable {
2 private Resource resource;
3
4 public ResourceContent(Resource resource) {
5 this.resource = resource;
6 }
7
8 public Resource getResource() {
9 return resource;
10 }
11 }
1 /**
2 * Denotes resource and price content
3 * @author Mark Bramnik
4 */
5 public class ResourceForPriceContent extends ResourceContent {
6 private Integer price;
7
8 public ResourceForPriceContent(Resource pResource, Integer pPrice) {
9 super(pResource);
10 this.price = pPrice;
11 }
12
13 public Integer getPrice() {
14 return price;
15 }
16 }
Resource - is an enum ( I use jdk 6 from sun)
1 public enum Resource implements Serializable {
2 NETWORK,
3 CPU,
4 DISK,
5 MEMORY
6 }
Of course I'll provide a jar with these classes for reuse. Well, basically thats all, If you have a notes feel free to tell me I'll update the project
NEW!!!
18/08/2007
I've decided to identify each conversation by a randomly generated String key (I used java.utils.UUID class for that purpose). So when you receive from me a LACK_FOR_PRICE message call msg.getConversationId() to obtain the conversation key. Then add it to your message so that I'll be able to identify the conversation. Moreover, please supply a resource and price when needed.
NEW!!!
29/08/2007
I've finished the project refactoring so that it now can be run with ant script, all the directories also were moved to another locations You should add your project into analyzer/analyzer-src folder of the project (this will be your source-root package) Unless you don't define some external configuration files, the ant script should handle your sources.
Run ant compile to compile the project (monitor agent, analyzer agent, common - our common part) this should create "build" directory and place the *.class files into it
Run ant install to install the project This should pack the classes into jars, create "build/release" directory and put our jars to that dir.
Run ant run to run the project This should run the project
Run ant clean in order to remove the generated build directory