示例#1
0
AUTHOR: Erel Segal-Halevi
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))
示例#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)

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]
示例#3
0
by exhaustively checking all allocations.

See Appendix D, Example 4

AUTHOR: Erel Segal-Halevi
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 = "xyz"
prefs_of_Alice = ["xyz", "xy","yz","xz", "x","y","z", ""]
prefs_of_Bob   = ["xyz", "xy","xz","yz", "y","x","z", ""]
prefs_of_Carl  = preferences.triplets(items) + preferences.pairs(items) + list(items) + [""]
budget_of_Alice = budget_of_Bob = 4;  budget_of_Carl = 2   # or any other a,b,c such that a=b > c

print("\nWith only Alice and Bob, no competitive equilibria exists:")
ce.display(ce.find_equilibrium(items, [prefs_of_Alice, prefs_of_Bob], [budget_of_Alice, budget_of_Bob]))

print("\nWith all three agents, a competitive equilibrium exists:")
ce.display(ce.find_equilibrium(items, [prefs_of_Alice, prefs_of_Bob, prefs_of_Carl],
                               [budget_of_Alice, budget_of_Bob, budget_of_Carl]))

print("\nWith only Alice and Bob, even a *personalized* competitive equilibrium does not exist:")
ce.display(ce.find_personalized_equilibrium(items, [prefs_of_Alice, prefs_of_Bob], [budget_of_Alice, budget_of_Bob]))
示例#4
0
AUTHOR: Erel Segal-Halevi
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)  # 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))