ramo.utility_function package
Submodules
ramo.utility_function.checking module
- ramo.utility_function.checking.is_concave(func)
Check whether a function is concave.
- Parameters:
func (Function) – A sympy function.
- Returns:
Whether the function is concave.
- Return type:
bool
- ramo.utility_function.checking.is_convex(func)
Check whether a function is convex.
- Parameters:
func (Function) – A sympy function.
- Returns:
Whether the function is convex.
- Return type:
bool
- ramo.utility_function.checking.is_linear(func)
Check whether a function is linear.
- Parameters:
func (Function) – A sympy function.
- Returns:
Whether the function is linear.
- Return type:
bool
- ramo.utility_function.checking.is_multilinear(func)
Check whether a function is multilinear.
- Parameters:
func (Function) – A sympy function.
- Returns:
Whether the function is multilinear.
- Return type:
bool
- ramo.utility_function.checking.is_strictly_concave(func)
Check whether a function is strictly concave.
- Parameters:
func (Function) – A sympy function.
- Returns:
Whether the function is strictly concave.
- Return type:
bool
- ramo.utility_function.checking.is_strictly_convex(func)
Check whether a function is strictly convex.
- Parameters:
func (Function) – A sympy function.
- Returns:
Whether the function is strictly convex.
- Return type:
bool
ramo.utility_function.functions module
- ramo.utility_function.functions.get_u(u_str)
Get the utility function from a string.
- Parameters:
u_str (str) – The string of the utility function.
- Returns:
A utility function.
- Return type:
callable
- ramo.utility_function.functions.product_u(vector)
Calculate the utility from: \(u(\overrightarrow{p}) = \prod p_i\).
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.sum_u(vector)
Calculate the utility from: \(u(\overrightarrow{p}) = \sum p_i\).
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.u1(vector)
Calculate the utility from: \(u(x, y) = x^2 + y^2\). This is a convex function.
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.u2(vector)
Calculate the utility from: \(u(x, y) = x \cdot y\). This prefers the most balanced payoff vector.
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.u3(vector)
Calculate the utility from: \(u(x, y) = x \cdot y - y^2\).
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.u4(vector)
Calculate a constant utility. The constant is currently set to 2.
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
A constant utility \(k\).
- Return type:
float
- ramo.utility_function.functions.u5(vector)
Calculate the utility from: \(u(x, y) = x^2 + x \cdot y + y^2\). This is a convex function.
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.u6(vector)
Calculate the utility from: \(u(x, y) = x^2 + y\). This is a convex function.
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
- ramo.utility_function.functions.u7(vector)
Calculate the utility from: \(u(x, y) = x + y^2\). This is a convex function.
- Parameters:
vector (ndarray) – A payoff vector.
- Returns:
The scalar utility for this vector.
- Return type:
float
ramo.utility_function.generators module
- ramo.utility_function.generators.constant_u(k)
Create a utility function that always outputs a constant value k.
- Parameters:
k (float) – The constant output of the utility function.
- Returns:
The generated utility function.
- Return type:
callable