Example #1
0
"""

import preferences
import competitive_equilibrium as ce
import sys, logging
if len(sys.argv) < 2 or sys.argv[1] != "quiet":
    ce.logger.setLevel(logging.INFO)

high_value_goods = "wxyz"
low_value_good = "o"
items = high_value_goods + low_value_good
empty = [""]
singletons = list(high_value_goods)
pairs = preferences.pairs(high_value_goods)
triplets = preferences.triplets(high_value_goods)
quartets = preferences.quartets(high_value_goods)

prefs_of_Alice = preferences.add_low_value_good(
    quartets + triplets +
    ["wx", "wy", "wz", "xy", "w", "xz", "yz", "x", "y", "z"] + empty,
    low_value_good)
prefs_of_Bob = preferences.add_low_value_good(
    quartets + triplets + pairs + ["w", "z", "x", "y"] + empty, low_value_good)
prefs_of_Carl = preferences.add_low_value_good(
    quartets + triplets + pairs + ["x", "y", "w", "z"] + empty, low_value_good)
prefs_of_Dana = preferences.add_low_value_good(
    quartets + triplets + pairs + singletons + empty, low_value_good)
prefs = [prefs_of_Alice, prefs_of_Bob, prefs_of_Carl, prefs_of_Dana]
budgets = [160, 130, 90, 66]

print("\nWith all four agents, there are no competitive equilibria:")
Example #2
0
SINCE:  2019-08
"""

import preferences
import competitive_equilibrium as ce
import sys, logging
if len(sys.argv) < 2 or sys.argv[1] != "quiet":
    ce.logger.setLevel(logging.INFO)

items = "wxyz"

empty = [""]
singletons = list(items)
pairs = preferences.pairs(items)
triplets = preferences.triplets(items)
quartets = preferences.quartets(items)

prefs_of_Alice = quartets + triplets + [
    "wx", "wy", "wz", "xy", "w", "xz", "yz", "x", "y", "z"
] + empty
prefs_of_Bob = quartets + triplets + pairs + ["w", "z", "x", "y"] + empty
prefs_of_Carl = quartets + triplets + pairs + ["x", "y", "w", "z"] + empty
prefs_of_Dana = quartets + triplets + pairs + singletons + empty
prefs = [prefs_of_Alice, prefs_of_Bob, prefs_of_Carl, prefs_of_Dana]
budgets = [160, 130, 90, 66]

print(
    "\nWith the preferences in the paper, there are no competitive equilibria:"
)
ce.display(ce.find_equilibrium(items, prefs, budgets))
Example #3
0
"""

import preferences
import competitive_equilibrium as ce
import sys, logging
if len(sys.argv) < 2 or sys.argv[1] != "quiet":
    ce.logger.setLevel(logging.INFO)

items = "wxyz"

empty = [""]
singletons = list(items)  # all singleton subsets in an arbitrary order
pairs = preferences.pairs(items)  # all pairs of items in an arbitrary order
triplets = preferences.triplets(
    items)  # all triplets of items in an arbitrary order
quartets = preferences.quartets(
    items)  # all quartets of items in an arbitrary order

prefs_of_Alice = quartets + triplets + ["wx", "yz", "wy", "xz", "wz", "xy"
                                        ] + singletons + empty
prefs_of_Bob = quartets + triplets + pairs + ["w", "x", "y", "z"] + empty
prefs_of_Carl = quartets + triplets + pairs + singletons + empty
prefs = [prefs_of_Alice, prefs_of_Bob, prefs_of_Carl]
budgets = [20, 11, 8]

print(
    "\nWith the preferences in the paper, there are no competitive equilibria:"
)
ce.display(ce.find_equilibrium(items, prefs, budgets))

print(
    "\nAs a control, if we change Alice's preferences, there is a competitive equilibrium:"