Closed piotroslaw closed 12 years ago
I've had similar thoughts - what I've decided on is for the annex one countries to do everything to avoid these issues.
My general market strategy is as follows:
If I'm above my target and need to reduce my carbon emissions, I'll look at the market. If there are offers available where the price is low enough such that I'll make a profit in the long run, I'll buy it. Else, I'll put down a buy offer at a reasonable price and hope it's fulfilled. If not, I'll just do normal reduction options (and shut down factories if necessary).
If I'm just about at my target, I'll primarily invest in industry which will put me above my carbon target again, and I'll do exactly as above.
If I'm below my target, once again I'll check the market. If the current selling price is particularly low, I'll attempt to sell any excess (obviously my behaviour does enough work to make sure that selling too much carbon doesn't put me in too deep of a hole). If there are any buy offers available at a good price for me, I'll accept those offers. Else, I'll put out some sell offers.
Basically I'll be buying and selling only if the price offsets the negative outcome of either the credits resetting every 10 years or missing out on the long term benefits of investing in industry early. Exactly as you'd expect, really. I'm trying to use the market as much as possible in my strategy as that seems to be the point of the simulation, so expect a fair amount of usage.
The issue of livelock is nasty. The worst case scenario is there are two countries, one who posts a buy offer for 100, and one which puts a sell offer for 120. The other posted offer, however, is well within the others price range. Which one accepts which offer?
Easiest fix is to enforce only sell offers, but this limits flexibility unless we implement some sort of haggling API. I think we need a big group discussion with the market implementers at some point.
The alternative discussed to the livelock is that if you broadcast an offer, you cannot simultaneously accept incoming messages. It's less limiting than having only one kind of offer, and can be implemented at behaviour level. Possibly at trade protocol level also?
but surely, if you do that, you have a livelock - both countries would have to decline the offer of the other country. then, they would probably repost the offer in the next turn, with exactly the same result.
Alternatively, they would both wait in the next turn expecting that the other country would repost the offer. Either way, it is a livelock, until one country decides to repost the offer and the other not to do it
I'm suggesting that when you have an offer out, you effectively block incoming messages. So you have no idea what else is on the market and the chance of countries synchronising their actions decreases greatly.
So the two countries that would be potentially interested in each others offers cannot see each other. Therefore, they post again in the next round -> livelock.
As there is not much time, I think it would be reasonable for countries that want to buy - only look for what is offered on the market, countries that want to sell - only send offers (not look at the market). It is a little unrealistic, doesn't use our protocol's full potential, but I think a lot of problem can be avoided.
It might also be worth to wait for the complete simulation to check if this problem actually comes up.
I agree, we should stick to just sell offers for the time being. It's unlikely we have enough time to do anything else.
Nik's behaviour is absolutely reasonable - check if there are good offers, if not, post your own. I will have two phases of selling - in one I will only wait for buy offers, in the other I will do the same as Nik - check if there are good offers, if not, post my own (will write a wiki on that soon).
So, it's not only livelock that is a problem here. Since the execution order is not sequential afaik, there might be a situation where events happen it following order: (assuming A wants to buy and B wants to sell)
Now, if countries do what Chris said (ignore other offers while posting your own), no sales will take place. On the other hand, if both react to other offers, livelock is likely to occur (each will agree to other offer and decline it's own). Either way, not good.
Initially I though what Adam said would be a good idea, but in fact it is severly limiting. In my case, the price at which I am ready to sell inthe second "phase" depends on the quantity sold, because I am reducing/absorbing carbon to make up for it. For example, it might be profitable to sell 50 credits at 10$/unit, but selling 100 credits at that price might not be profitable anymore. The trade protocol has no way of modelling that, so I could only guess how much buyer might potentially want, and set the qantity and price accordingly. And really, I suspect the same will apply to Nik's behaviour - again, it's much easier to react to the offers of the other party, but if one country behaviour has to be the one that posts the offers, it has a massive disadvantage.
So I think we cannot really do anything about it without serious changes to trade protocol, and it is much to late for that. So let's just write the behaviours and see how it works.
As an aside, @n1kunj something to consider with your code. Since your code is used for a large block of countries, will they all look to buy and sell at the same times? I'm worried about large bubbles in the market caused by 30 countries all looking at the market and thinking its a good time to buy
closing this, will create new issue when we actually encounter these problems
This is a question for people creating and implementing annex one reduce strategy (mostly Nikunj, if I'm correct), but is kind of a general issue.
If you think about it, it is much more easier to only react to sell/buy offers from other countries, instead of broadcasting own offers. I'm talking conceptually, not how easy it is to implement the code. To give an example: in our case, the price at which we sell depends on the amount we are selling. The amount we are selling depends on how much others want to buy. And, finally, how much others want to buy depends on the price at which we are selling. So we have a closed circle, where we either let other post their buy offer first (and hence have one set variable, with which we can calculate each other) or just throw a random amount/price, which can lead to losses.
The problem lies in setting the price - it could be fun and allow interesting strategies if there was already an established market with both sell and buy offers. Looking at spread, transaction quantities etc would give a sound basis for setting the price. Unfortunatelly, in this case, we ceate market from scratch - there are no offers initially, and no way of knowing how much the other countries are ready to buy/sell and for what price.
What I'm afraid of is that, if the strategies of annex1 reduce and sustain are not "compatible" with each other, we might have a situation where each is waiting for the other to propose the transaction. This might not be the case - If you are using both (post buy offers and wait for sell offers at the same time), we can implement the same thing. But then we are back at the problem of livelock which we discussed on facebook a long time ago.
Sorry for this long rambling, but this may potentially prevent any sales from happening if not understood and resolved properly.
So: are you posting buy offers only, wait for sell offers only, or both? if you are posting buy offers, are you waiting and reacting to our sell offers?