Create an integer variable that can only takes values from a list with the cplex python api

from docplex.cp.model import CpoModel mdl = CpoModel() To create an integer variable between [0,10]: variable = mdl.integer_var(min=0, max=10, name="variable") How can I create a variable that...

What are the limits of docplex (the cplex version of python) in terms of the number of variables and constraints?

I am solving an optimization problem in python using docplex(not docplex cloud API) with only 2 constraints and 92 variables (dvar in OPL). But even though I get this...

Docplex vs CPLEX Python API

What is the difference between Docplex and CPLEX Python API? Is any of them faster than the other?

AttributeError: module 'cplex' has no attribute 'Cplex'

I am trying to optimize a linear programming problem using CPLEX in Python. I already installed the IBM ILOG CPLEX Studio, as well as the docplex in Python. When I run the program I'm having the...

CpoException: Can not execute command 'cpoptimizer -angel'. Please check availability of required executable file

I have CPLEX Optimization Studio installed on my Ubuntu machine and I am using the docplex model module with success. Now I have to use CpoModel from docplex.cp.model and I have the...

docplex with callback in dropsolve

Is it possible to solve a model that has a callback using model.solve(url=url, key=api)? I am trying an example similar to this but callback has no effect when called on dropsolve.

How to increase number of Cplex solutions?

I have this cplex model that has 1 binay variable (x_i). Now I have 2 questions regarding its cplex solutions (I put them in one post because they are related). First: For my model I get 26...

How do I bypass the 1000 variable limit in Cplex

I've created a MILP model to test using the Docplex library in python but I get this error message : CPLEX Error 1016: Community Edition. Problem size limits exceeded. Purchase at...

Completing binary matrix with cplex constraint programming

I want to generate a 20x38 binary matrix based on some constraints that I have using a dpcplex model. Some of the matrix cells are predefind as below...

How do I set the key for using the full version of CPLEX?

I have purchased a cplex subscription and received a key to use, but I can't figure out how to use it, no matter what I try I keep getting the "no key, go purchase cplex here" error. I'm using...

Is it possible to solve mixed-integer non-linear programming (MINLP) problem with CPLEX?

I am trying to solve a mixed integer non-linear programming (MINLP) problem. I am aware that CPLEX can solve a mixed integer quadratic programming (MIQP) problem where the objective function...

Using the piecewise function of the IBM CPLEX python API, but the problem cannot be solved

I try to use MILP (Mixed Integer Linear Programming) to calculate the unit commitment problem. (unit commitment: An optimization problem trying to find the best scheduling of generator) Because...

How to speed up cplex solution pool?

I have a MIP model that I need to generate its solution pool. Generating this pool takes around 5 minutes but I need to do this pool generation for 100k model, so I need this pool to run at least...

how to write a conditional constraint in CPLEX python?

I have a model that has one binary variable x [i] [j] [k]. I need to add a constraint that fullfils this condition: if x[i][j][k1]==1 and x[j][i][k2]==1 Then: k2-k1>8 I have this code but...

How to output simplex multiplier with Cplex (docplex)?

I am using python with docplex library to solve a linear programming problem. I want to get its simplex multipliers, or coefficients (of slack variables) in the final tableau.

sensitivity analysis in docplex

how can I do sensitivity analysis in docplex (python)? Suppose we have this model: Max z= 3*x+2*y; st: 2*x+y<=8; x+2*y<=6; I use docplex in python for solve the model: from...

IBM cplex ilog VS docplex in python

Currently, I'm working on docplex on python. I just found out that result from IBM cplex Ilog and docplex is way different. Even though their constraints, objective function, everything are...

How to combine 2 constraints to minimise cost and maximise capacity using DOcplex.mp in Python

I have the following OF to minimize the cost of supply chain: mdl.minimize(mdl.sum((cs+ch+cf+cv*d[j])*q[j] for j in arcs) + mdl.sum(α*(eh+et*d[j])*q[j] for j in arcs) +...

only print the solution in docplex solve()

Using from docplex.cp.model import CpoModel I have written a docplex code. Model defenition is as follows. mdl = CpoModel(name="HouseBuilding") But by the solve() function it is printing...

Adding a path linking docplex to python3

I am installing Cplex python API into my MacBook. So I followed the tutorial given in YouTube (https://www.youtube.com/watch?v=oINxanpv_2M) and have installed the script & library for Cplex using...

Adding multiple quadratic constraints in DOCPLEX

I am trying to add quadratic constraints to a docplex model however it is interpreting them as linear and giving me error messages. below is a excerpt from the script here is the quadratic...

Installing qiskit-aer through pip fails

I'm trying to install qiskit on Win10. I typed in my admin cmd : pip install qiskit It goes just fine for terra, ignis, and aqua. However, I have a C compiler problem when installing aer. Here's...

Python: Is there a faster way to filter on dataframe in a for loop

I have a for loop over a tuple in python which is index for one dataframe. All the values under the index are then summed over. Example: t3 = time() for row in list_of_index: a=[] if...

How to implement a new constraint based on two other constraints on CPLEX?

I am very new to Cplex. I have these two constraints (R is the set of numbers in range 20) : model.add_constraints((model.sum(x[i, j] for j in R2 ) == 2 for i in R),"C1" ) ...

Dockerfile: Python3 not found

I am trying to convert a bash script to a Dockerfile since we are going the containerization route with AWS Batch Basically I install CPLEX (an optimization library) and Anaconda, install some...

Understanding DoCPLEX Multi Objective

I am working on Pure LP problem with around 3 Million Constraints and I am currently using objective function with different weights. But to improve run time I am hoping to explore DoCPLEX multi-...

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...

Colab running Pennylane with DeviceError

I tried to run Pennylane on Colab, so I install it first. But the "Installed devices" are null, what's going on? I have restart and rebuilt for several times. Here is my code. !pip install...

How to connect your installed academic initiative of CPLEx with python?

I am using python 3.6 version and CPLEX 12.10 in MAC with Anaconda. How do I access the cplex libraries for python? I have an academic version installed in my MAC and can be used independently in GUI.

Python 3.7 cannot use DOCPLEX

I have coded a mathematical model and want to solve it using DOCPLEX module. My interpreter is Python 3.7. However, after doing a lot of effort, I will face the following error: Traceback (most...