Questions tagged [docplex]

docplex (a.k.a. IBM® Decision Optimization CPLEX® Modeling for Python) is a Python modeling API that provides modules for mathematical programming via CPLEX and constraint programming via CP Optimizer.

316 questions
0
votes
1 answer

How to recreate variables using CPLEX or DoCPLEX module?

Suppose I have a lot of variables in mdl1. After saving mdl1 in a .sav and .lp, I read it back into doCPlex. mdl2 = ModelReader.read(filename) Now I want to recreate all the variables in mdl2. How to do that? Suppose I know the variables' names are…
qqzj
  • 21
  • 1
  • 6
0
votes
1 answer

Issue with cumul function using Cplex Python?

I'm new to CPlex Python. Actually I am modeling a scheduling problem where I have to select only activities or tasks (has specific points in terms of efforts requires) from a large list for different Time Intervals and that should sum up to the…
0
votes
1 answer

How to add constrain to pick stories (or tasks) in a solution from large list which sum up to given Team capacity using Cplex Python?

I am using the IBM cplex Python API and working on the problem to find stories from list of thousand stories which sum up to the given Team Capacity for different sprints (2 weeks of sprint here). Each story has assigned Story points &belongs to…
0
votes
2 answers

The CPLEX does not provide the expected result

I am developing the python code for Marking Optimization Problem by using python CPLEX library. Here is the mathematical equations. Here is the python code (I give comments for each of the codes with the respective mathematical equations by…
0
votes
1 answer

How to terminate the docplex code after timelimit

I am using docplex.mp and I am running an Integer optimisation problem that takes about several days.. I need to terminate the program after a certain time limit and obtain a solution for whatever the limit left.
GTek
  • 155
  • 6
0
votes
1 answer

Can I add kpi with maximum values without contraining CPLEX model?

I am using cplex for an optimization model, to optimize diet compositions. Now I would like to add an extra variable/KPI, which is the sum of other KPIs in the model. However, this sum is a score with maximum values, which means that when each KPI…
0
votes
1 answer

Is possible to change the decision variable type for cplex in python?

(1) When I define decision variables for cplex in python, x = np.empty((6,1), dtype= object) for i in range(6): x[i] = mdl.integer_var(lb= 0, ub= inf, name='x' + str(i+1)) How can I change the type of decision variables for x from integer_var…
0
votes
1 answer

Is it possible to create two models within one coding program for docplex.mp?

Is it possible if we combine two models of docplex.mp within one pyton coding file? For example, mdl. and mdl2. Thank you.
0
votes
1 answer

How to use keys in defining integer_var_list for cplex?

I am not really sure about how to define a decision variable by using integer_var_list(). Supposing I have a set of scalar decision variables X = [[x1,x2,x3,x4,x5,x6]], then I defined them as: ''' x = np.empty((Total_T,1), dtype= object) for i in…
0
votes
1 answer

How to define a set of decision variables in ascending order? (TypeError: Cannot convert a linear constraint to boolean: S1 <= S2)

Good day to you. I would like to define a set of decision variables S for docplex.mp in cplex in ascending order, from the smallest to the largest value of S). When I tried to use the following code, it seems incorrect. Could anyone let me know how…
0
votes
1 answer

CPLEX solve one problem with many different inputs

I am solving a basic linear programming problem: min c*x, with an A*x = b constraint, using CPLEX with Python (DOCPLEX). Then I run the above LP for 10k-100k different combinations of b and c (A stays fixed), in order to find the minimal solution…
Vidak
  • 1,083
  • 14
  • 29
0
votes
2 answers

Logical formula in docplex

Given the following formula with the table below encode the relationship of x_0, x_1 and r for Objective 2': For objective 2, we can code it as following with Docplex, where we have either 0 or 1 for priority p. CPriorityInFreight =…
william007
  • 17,375
  • 25
  • 118
  • 194
0
votes
1 answer

CPLEX binary_var_matrix gives values outside 0.0 and 1.0

I use from docplex.mp.model import Model mdl = Model(name='itc_load_planning') Assignment = mdl.binary_var_matrix(orders, freights, name='Assignment') ... ok = mdl.solve() if ok: # mdl.print_solution() for index, dvar in…
william007
  • 17,375
  • 25
  • 118
  • 194
0
votes
1 answer

Truck Type (infinite number of them) vs Orders

The goal of the docplex model below is to choose the trucks with total minimum cost to fulfill all orders. I treat the truck type as 1 truck in the following code, but in fact, a truck type can have infinite number of truck, in that case, how should…
william007
  • 17,375
  • 25
  • 118
  • 194
0
votes
0 answers

Docplex: getting objective function coefficients

I am using DOCPLEX for the first time to address an optimization problem. My objective function is built through the following sequence of operations: model = Model(name='pack') # Total number of columns colstot = 97622 #…
Roland
  • 427
  • 1
  • 4
  • 15