Closed pmartiner closed 2 years ago
I got the expected result by changing this line:
if offer.price >= 10 and self['drugs'] > 1:
where self['drugs'] > 1
is replaced with self['drugs'] >= 1
I looked at the jupyter html, and found this to be the expected output:
Round0
Customer offers 10 dollar:
drug_dealer{'drugs': 1.0}
customer{'money': 90.0}
Drug Dealer accepts or rejects the offer:
drug_dealer{'drugs': 1.0}
customer{'money': 100.0}
Round1
Customer offers 10 dollar:
drug_dealer{'drugs': 1.0}
customer{'money': 90.0}
Drug Dealer accepts or rejects the offer:
drug_dealer{'drugs': 1.0}
customer{'money': 100.0}
which is in line with > 1
instead of >= 1
. @DavoudTaghawiNejad which behavior do you intend to use?
That's true! I missed that >= 1
. Thank you!
Maybe I misunderstood, but these line were the ones that led me to think the expected behavior was to trade (to have >=1
), even if no supply remained:
When looking at round one one can see that after the customer offered 10 dollars, the 10 dollars are not available to him util the deal has either been accepted or rejected. After the drug dealer accepts the offer in the 0 round. The money is transfered to the drug dealer and the drugs to the customer.
In round 1, where the drug dealer runs out of drugs the 10 dollars go back to the customer.
I see. Feel free to make a PR to update https://github.com/AB-CE/abce/blob/master/docs/jupyter_tutorial.html !
Will do! Thanks for the help!
Hi! I recently discovered abcEconomics and started to learn to use it by reading and running the jupyter tutorial on the website. However, I'm kind of stuck on the "Trade" section. The dealer, if I'm understanding correctly, should be selling after the consumer's offer on round 0, since they have drugs available, yet it seems, according to
print_possessions()
, that this is not happening. Why is that?Here's what I'm getting (both by running my own notebook and the one on the repo):
Result:
Expected behavior: