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
1
vote
1 answer

docplex "Error: Model has non-convex objective:"

I would like to solve a mix-integer nonlinear programming problem in phyton. I use the codes you see in below. I'm taking this error: Error: Model has non-convex objective: x_1_2 * distanceofclusters_1_2 + ... How can I fix this? My model is using…
Ebru Pekel
  • 11
  • 1
1
vote
1 answer

Handling variables in the denominator of an objective function in CPLEX Python

I wish to solve a linear program with an objective function: Here x[i][j] are decision variables and y[i][j] are already precomputed. I was writing the code for this in CPLEX python (DOcplex) and was receiving the error that the denominator can…
flux
  • 13
  • 2
1
vote
1 answer

How to model a scheduling problem with interruptible tasks using docplex.cp (Constraint programming)?

I would like to model a scheduling problem using constraint programming (Python API of CPLEX : docplex.cp) where I have machines to allocate to activities. Activities are performed during work shifts and some tasks can be divised in at most 3 parts…
1
vote
0 answers

Computation Speed differs between OPL and Docplex

I've got a problem at solving an MIP with Docplex. The computation speed for my problem differs between 35 and 120 seconds while it is solved within 5 seconds using the OPL version. The model formulation does not differ between Python and OPL. Does…
1
vote
1 answer

Docplex: Keyerror where there wasn't one before

I am trying to run a replication study, and I have run the code in question multiple times without error. I took a little time off to work on some other projects, and it suddenly doesn't work, I have run into the following error (with different key…
Sean
  • 11
  • 1
1
vote
1 answer

How we can use a decision variable as an index of another decision variable using ILOG CP optimizer in python?

I am modeling a vehicle routing and scheduling problem using CP. I have 2 kinds of decision variables, that is, sequencing and start time of each node. The sequencing variable contains the node number, and start time of each node depends on the…
1
vote
1 answer

Dynamic worker constraint in CPLEX python

I've been working at a rcpsp problem using docplex in python. I consider 10 tasks with indicative costs and a worker that has to complete these tasks in 10 timeframes (can be weeks, days etc.). One of my constraints is that the worker can perform a…
Dru_np
  • 13
  • 2
1
vote
2 answers

AttributeError: 'NoneType' object has no attribute 'get_values'

I am new in coding and need your help. I get the following error: line 159, in _get_solution xs = np.array(ms.get_values(self.int_var)).reshape(self.path_n, self.orderbook_n) AttributeError: 'NoneType' object has no attribute 'get_values' after…
Bsarv
  • 15
  • 1
  • 4
1
vote
1 answer

Dual infeasible due to empty column 'x1' in Python w/Cplex/Docplex

I would really appreciate any input for this optimization problem: I am failing to assign my variables the values 1,2,3,4,5 for i and j, I think that is why I am getting this error: Dual infeasible due to empty column x1. Am I on the right…
jopro
  • 11
  • 1
1
vote
1 answer

ConflictRefiner() returns a different upper bound than the one saved in the model

My model status is integer infeasible. I used ConflictRefiner() to check which constraints are mutually contradictory. Then I use display_conflicts to check which constraints are "at fault". This is the output: I found this weird since my ub is set…
DP_
  • 87
  • 7
1
vote
1 answer

Is there a docplex function for getting solution of more than one variables for using in lazy cut?

I code an optimization problem in python (docplex) base on here but my cut is something like that sum(X) <= N + M*sum(Y, Z), X, Y and Z are decision vars. I do not know how I can pass the solution of X, Y, Z to self.get_cpx_unsatisfied_cts([ct],…
moh jor
  • 13
  • 4
1
vote
0 answers

How to add a time-window in vehicle routing problem?

I am studying a project in Python. It's a vehicle routing problem with time-window. In this study, depot is denoted by 1. And there are 14 customers which are fulfilled with 4 vehicles. Each vehicle has 50 tons capacity. Travel time between every…
ayca
  • 11
  • 1
1
vote
0 answers

CVRP model formulation

I am trying to solve CVRP problem using binary variables. Xr,i,j is the decision variable. Below is the way I have created the decission variable using docplex. na_travel = mymodel.binary_var_cube(vehicle, nodes, nodes, name='X'); We can take that…
suresh_chinthy
  • 377
  • 2
  • 12
1
vote
1 answer

How to change Cplex model during solution generation?

I have a Cplex model with several constraints and a solution pool. One of my constraint is : R_alt=[i for i in R if i not in SetAlt] model.add_constraints((model.sum(x[i, j] for j in R2 ) == 2 for i in R_alt),"6C" ) …
1
vote
1 answer

Getting unique solutions with python cplex solution pool

I have an MILP model that I try to solve with cplex python API. I need to get more than one solution. The problem is that when I get for example 50 solutions from my cplex pool, these solutions are very much similar. How can I somehow shuffle before…
Sana.Nz
  • 81
  • 11
1 2
3
21 22