2

I am using CPLEX 22.1.0 and docplex library in python to extract the Irreducible Infeasible Subset of a Linear Programming problem. The extraction seems correct but CPLEX is ignoring the time limit that I set. Any idea why this happens?

from docplex.mp.model import Model
import random as rd
import numpy as np
m = 4000 #number of constraints
n = 1000 #number of variables
seed = 0
time_limit = 1.0
rd.seed(seed)
#create matrixes
A = np.random.rand(m, n)
b = np.random.rand(m)
#create model
model = Model()
#create variables
keys = [i for i in range(n)]
x = model.continuous_var_list(keys,name='x')
#constraints
for i in range(m):
 model.add_constraint(model.sum(A[i][j]*x[j] for j in range(n)) == b[i])
#conflict refiner
model.parameters.timelimit = time_limit
model.parameters.conflict.display = 2
model.parameters.conflict.algorithm = 0
import time
st_time = time.time()
cplex_model = model.get_cplex()
cplex_model.conflict.refine(cplex_model.conflict.linear_constraints())
# Retrieve and process the IIS
iis_constraints = cplex_model.conflict.get()
finish_time = time.time() - st_time
for i in range(len(iis_constraints)):
 value = iis_constraints[i]
 if value > 0.5:
 print(f"i: {i} ; Value: {value}")
print(f"Finish time: {finish_time:.3f} s")
asked Feb 23, 2024 at 12:00

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.