Monday, January 09, 2012

Beyond Maths Trades

The maths traders in Australia were discussing whether it was possible in a maths trade to offer multiple items in exchange for one in a maths trade. No it's not, it doesn't even nearly work for reasons which are obvious to mathematicians. However I thought about it for a bit, and realised that with the introduction of a pricing mechanism, there can be such a trade. So I borrowed some symbols from the Z Notation (in which I was trained as an undergrad) and wrote this spec:

Let I be the set of items in the trade.
Let U be the set of users in the trade.
Let P be the set of prices, objects that can be summed and are totally ordered.

# every item has an owner, "\fun" means total function
owns : I \fun U

 # if you don't own anything you're not in trade
ran(owns) = U

# some people assign values to some things, "\pfun" means partial function
values : U \cross I \pfun P

# For each user u, there is a function vu, which is the values that user places on items
vu = { (i,p) | (u,i) \mapsto p \in values }

# and that user at least values the things they own
\forallu:U @ owns~\limg{u}\rimg \subseteq dom(vu)

# Then a valid solution to the trade is an assignment of items to users
s : I \pfun U

# the items received by u are
ru = s~\limg{u}\rimg

# the items sent by u are
su = owns~\limg{u}\rimg \cat ran(s)

# such that nothing is assigned to the person it came from
s \cap owns = \emptyset

# and everyone gets a bargain, by their own personal pricing rules
\forallu:ran(s) @ Σ (i \in ru) vu(i) \geq Σ (i \in su) vu(i)

# For a solution to be useful, it must be non-trivial:
\neq \emptyset

# and furthermore, we would like to restrict ourselves to minimal solutions so as to not make offered trades incomprehensibly complex, so if t is a solution, then t is not a subset of s (can't find the right symbols to write that!)

It occurs to me that blogspot is maybe not the ideal medium for writing specifications.

3 comments:

Chris Okasaki said...

We tried an experimental trade like that once: http://www.boardgamegeek.com/thread/377422/extended-value-loops-trade-discussion-thread
This was with only limited software support, and with the results mostly being calculated by hand.

I think the "minimal solution" criterion would rule out a big trade that was the union of two smaller disjoint trades, which probably isn't what you want. If there was another quality metric for judging the goodness of a solution (such as total value gained or # of users trading) then the minimal solution criterion might apply to solutions with the same score on the quality metric.

Friendless said...

The BGG thread is here:

http://boardgamegeek.com/thread/748121/for-maths-geeks-only-the-even-more-complicated-tha

If we were to run this sort of trade as an event, then finding the biggest solution is required. If we were to run it as an on-going process, the smallest solution is sufficient, as we can then run it again. In any case, if we want a big solution we can find a small solution, remove those items from the trade, and find a solution on the remainder. It might not be the best solution, but I think any solution will be handy for us beginners.

Sandie Elsom said...

You're such a dork.