Skip to content

Commit af2398e

Browse files
refactoring
1 parent 2aededd commit af2398e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pm4py/util/lp/variants/cvxopt_solver_custom_align_ilp.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@
1515
along with PM4Py. If not, see <https://www.gnu.org/licenses/>.
1616
'''
1717
import sys
18+
from enum import Enum
19+
from pm4py.util import exec_utils
1820

1921
from cvxopt import blas
2022
from cvxopt import glpk
2123

24+
25+
class Parameters(Enum):
26+
INTEGRALITY = "integrality"
27+
28+
2229
this_options = {}
2330
this_options["LPX_K_MSGLEV"] = 0
2431
this_options["msg_lev"] = "GLP_MSG_OFF"
@@ -83,8 +90,13 @@ def apply(c, Aub, bub, Aeq, beq, parameters=None):
8390
if parameters is None:
8491
parameters = {}
8592

86-
size = Aub.size[1]
87-
I = {i for i in range(size)}
93+
integrality = exec_utils.get_param_value(Parameters.INTEGRALITY, parameters, None)
94+
95+
if integrality is None:
96+
size = Aub.size[1]
97+
I = {i for i in range(size)}
98+
else:
99+
I = {i for i in range(len(integrality)) if integrality[i] == 1}
88100

89101
sol = custom_solve_ilp(c, Aub, bub, Aeq, beq, I)
90102

0 commit comments

Comments
 (0)