farhanrahman / kyoto

18 stars 7 forks source link

CDM protocol problems #65

Closed georgePil closed 12 years ago

georgePil commented 12 years ago

I started implementing the CDM function in the country's behaviour but I am a bit stuck in some points:

  1. quantity shouldnt be a double since its the amount of carbonOffset, carbonOutput?
  2. how do the countries know if the offer to sell was accepted by another country?

and 3. how can a country choose which offer is the best to go forward and accept it?

If I am missing any documentation on this please let me know..

Thanks

farhanrahman commented 12 years ago

1) quantity is double since both carbonOffset and carbonOutput is double

2) Currently there is no function to let the person who initiated the offer using the offer method know that the trade was accepted. The variables should be automatically adjusted after successful trade. If not then nothing happens. I can add a function that calls a function in the country that the trade was rejected and then allow the country to analyse that thing. Ideally you don't really need that because you can see it from the change in carbon output. It should be implied in the logic that you create.

3) There is no way for a country to wait for future offers. ITS A MIND FUCK to do that as presage FSM protocols transitions depend on messages received from another party. I tried doing it but TradeProtocol is as complicated as it is now so it was agreed in the beginning that it should be kept simple like this.

georgePil commented 12 years ago
  1. Ok because I was confused since now its INT and I was wondering if I misunderstood the protocol
  2. Then the country assumes all the offers it puts on the table are accepted? I dont get it, so why broadcast the sell offer then if no-one sees it and is accepted automatically?
  3. NULL :p
farhanrahman commented 12 years ago

you misunderstood me on point 2. I'll go through an example here.

Two agents in Lalaland: George Max

1) George wants to buy some carbon. So he sends a broadcast message 2) Max receives the message and decides to respond to the offer. So he calls the offer function in his tradeProtocol, which starts a conversation between the two. Max then waits in the TRADE_PROPOSED state 3) George sees what Max has to offer and then sends a reply back to Max that he likes it. Now here is the thing, George (the responder) DOES KNOW THAT THE TRADE HAS HAPPENED. 4) Max receives the acceptance. Now here MAX DOES NOT GET A CONFIRMATION TO HIMSELF THAT THE TRADE HAS BEEN COMPLETED, even though carbonOffset and cash gets adjusted. I can add a function that lets the initiator know that the trade has been successful. 5) The trade completes and they lived happily ever after..

farhanrahman commented 12 years ago

Oh and yeah Im not too sure which version of Abstract country I have because the one i have has carbonOutput and offset as type double.

farhanrahman commented 12 years ago

I hope it helps man.. just let me know if you require any more function in the TradeProtocol

georgePil commented 12 years ago

Man check your phone :p

georgePil commented 12 years ago

@farhanrahman you are a legend :D