bound.py¶
from pymwp import Bound
Bound
¶
Represents an MWP bound for a relation.
There is one mwp-bound expression for each input variable.
Source code in pymwp/bound.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
calculate(relation)
¶
Calculate bound from a simple-valued matrix.
Arguments relation: a simple-valued relation.
Returns:
Type | Description |
---|---|
Bound
|
The bound for the relation. |
Source code in pymwp/bound.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
show_poly(compact=False, significant=False)
¶
Format a nice display string of bounds.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
compact |
bool
|
reduce whitespace in the output |
False
|
significant |
bool
|
omit bounds that depend only on self |
False
|
Returns:
Type | Description |
---|---|
str
|
A formatted string of the bound. |
Source code in pymwp/bound.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
to_dict()
¶
Get serializable dictionary representation of a bound.
Source code in pymwp/bound.py
146 147 148 149 |
|
HonestPoly
¶
Models an honest polynomial.
Source code in pymwp/bound.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
MaxVar
¶
Bases: HonestPoly
m-variables
Source code in pymwp/bound.py
37 38 39 40 41 |
|
MwpBound
¶
Represents MWP bound.
Source code in pymwp/bound.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
bound_triple: Tuple[Tuple[str], Tuple[str], Tuple[str]]
property
¶
Alternative bounds representation.
Example
(X1,) (,) (X4, X5)
Returns:
Type | Description |
---|---|
Tuple[Tuple[str], Tuple[str], Tuple[str]]
|
Current bound as \((m_1,...m_n), (w_1,...w_n), (p_1,...p_n)\) where the first contains list of variables in m, second contains variables in w, and last in p (if any). |
bound_triple_str: str
property
¶
Alternative bounds representation.
Example
X1;;X4,X5
Returns:
Type | Description |
---|---|
str
|
Current bound as |
append(scalar, var_name)
¶
Append variable dependency in the right list by scalar.
Source code in pymwp/bound.py
108 109 110 111 112 113 114 115 |
|
parse_triple_str(value=None)
staticmethod
¶
Restore bound from triple format
Source code in pymwp/bound.py
88 89 90 91 92 |
|