cplex

External header file ilcplex\cpxconst.h causing causing compiler error

半世苍凉 提交于 2021-02-13 17:28:10
问题 I have been sent code for a program built in C that uses a reinforcement learning algorithm. I need to modify it, yet I am having difficulties with compiling the code in the first place. Here are the outputs in CodeBlocks. All errors come from one line of code in a header file, which is part of the IBM CPLEX include directory (include\cplex\cpxconst.h) The line of code in question is as follows. define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated) error messages are multiple

Obtaining different solutions on solving a cplex model many times

喜你入骨 提交于 2021-02-11 17:38:43
问题 I have an MIP model written with docplex and a solution pool written with cplex. My model has billions of solutions in reality. I need to solve this model several times (10 for example) with a certain populate number (10,000 for example) but I need the solutions of these multiple solves to be entirely different than each other. How can I achieve that with cplex? Is there a parameter or a approach for it? 回答1: You can use a diversity filter for the solution pool, see CPLEX > User's Manual for

CPLEX: dvar declaration with conditions

戏子无情 提交于 2021-02-11 16:51:35
问题 I am using CPLEX and declaring the dvar with the following: dvar int+ Y[i in a][j in a][m in b] in 0..1 I do not want to create a variable when i = j. 回答1: variable indexer are not allowed but you have 3 workarounds: https://github.com/AlexFleischerParis/zooopl/blob/master/zooarrayvariableindexertupleset.mod https://github.com/AlexFleischerParis/zooopl/blob/master/zooarrayvariableindexerdexpr.mod https://github.com/AlexFleischerParis/zooopl/blob/master/zooarrayvariableindexerunion.mod The

CPLEX: dvar declaration with conditions

喜你入骨 提交于 2021-02-11 16:50:38
问题 I am using CPLEX and declaring the dvar with the following: dvar int+ Y[i in a][j in a][m in b] in 0..1 I do not want to create a variable when i = j. 回答1: variable indexer are not allowed but you have 3 workarounds: https://github.com/AlexFleischerParis/zooopl/blob/master/zooarrayvariableindexertupleset.mod https://github.com/AlexFleischerParis/zooopl/blob/master/zooarrayvariableindexerdexpr.mod https://github.com/AlexFleischerParis/zooopl/blob/master/zooarrayvariableindexerunion.mod The

How to manually set Initial Solution in CVXPY using CPLEX solver

痴心易碎 提交于 2021-02-11 15:44:00
问题 I am trying to solver the Unit Commitment problem (MIQP problem) by modelling the problem in CVXPY and using the CPLEX solver. I have been successful in getting everything to work with CVXPY using CPLEX. However, this was for a small system. Now I would like to do the same with a much larger system. Side Note: I have successfully solved the MIQP problem in MATLAB using CPLEX. For larger system in MATLAB, I have used an initial solution from a MILP formulation of the problem and limited the

How do I convert AMPL to CPLEX

十年热恋 提交于 2021-02-11 13:08:12
问题 The following set and parameters are written in the AMPL environment. How can they be converted to CPLEX? set B; #set of all blocks set T; #set of time periods set BI{B}; #set of blocks that overlie a block set BY{T}; #set of blocks that can be excavated in time period t param C_min; #minimum processing capacity of a mill param g{B}; #average grade for block param x_cord{B}; #x-coordinate of a block param r{B} symbolic; param early{B} default 1; var alpha{B,T} binary; # indicator for which

How do I convert AMPL to CPLEX

假装没事ソ 提交于 2021-02-11 13:06:38
问题 The following set and parameters are written in the AMPL environment. How can they be converted to CPLEX? set B; #set of all blocks set T; #set of time periods set BI{B}; #set of blocks that overlie a block set BY{T}; #set of blocks that can be excavated in time period t param C_min; #minimum processing capacity of a mill param g{B}; #average grade for block param x_cord{B}; #x-coordinate of a block param r{B} symbolic; param early{B} default 1; var alpha{B,T} binary; # indicator for which

How do I convert AMPL to CPLEX

夙愿已清 提交于 2021-02-11 13:03:33
问题 The following set and parameters are written in the AMPL environment. How can they be converted to CPLEX? set B; #set of all blocks set T; #set of time periods set BI{B}; #set of blocks that overlie a block set BY{T}; #set of blocks that can be excavated in time period t param C_min; #minimum processing capacity of a mill param g{B}; #average grade for block param x_cord{B}; #x-coordinate of a block param r{B} symbolic; param early{B} default 1; var alpha{B,T} binary; # indicator for which

how to write a conditional constraint in CPLEX python?

前提是你 提交于 2021-02-11 12:12:34
问题 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 I assum it is not correct : mdl.add((y[(i,j,k)]+y[(j,i,k1)]==2),(k1-k>8) ) I also, put this: mdl.add(mdl.if_then(y[(i,j,k1)]+y[(j,i,k2)]==2, k2-k1>8)) but I got this error: raise DOcplexException(resolved_message) DOcplexException: Expecting linear constraint, got: False How can I model this with cplex

How to use Continuous Variables for IF-THEN constraints on DOCPLEX (Python)?

随声附和 提交于 2021-02-10 14:27:43
问题 I'm using DOCPLEX to build up a Mixed Integer Linear Programming (MILP) problem which is then solved via CPLEX on Python. However, upon trying to solve the MILP problem using IF-THEN constraints, I receive the following error: DOcplexException: Model.if_then(), nbBus40 >= 3.0 is not discrete This is happening because I have declared nbbus40 variable to be continuous , as shown in the code below: from docplex.mp.model import Model mdl = Model(name='buses') nbbus40 = mdl.continuous_var(name=