Check if a characteristic function is monotoneΒΆ
To check if a characteristic function is monotone use
coopgt.characteristic_function_properties.is_monotone
.
For example to check if the following characteristic function is monotone:
\[\begin{split}v_1(C)=\begin{cases}
0,&\text{if }C=\emptyset\\
6,&\text{if }C=\{1\}\\
12,&\text{if }C=\{2\}\\
42,&\text{if }C=\{3\}\\
10,&\text{if }C=\{1,2\}\\
42,&\text{if }C=\{1,3\}\\
42,&\text{if }C=\{2,3\}\\
42,&\text{if }C=\{1,2,3\}\\
\end{cases}\end{split}\]
First create the characteristic function:
>>> characteristic_function = {
... (): 0,
... (1,): 6,
... (2,): 12,
... (3,): 42,
... (1, 2): 10,
... (1, 3): 42,
... (2, 3): 42,
... (1, 2, 3): 42,
... }
Then:
>>> import coopgt.characteristic_function_properties
>>> coopgt.characteristic_function_properties.is_monotone(
... characteristic_function=characteristic_function
... )
False