opl

ILOG CPLEX / OPL dynamic Excel sheet referencing

半腔热情 提交于 2021-01-29 20:39:12
问题 I'm trying to dynamically reference Excel sheets or tables within the .dat for a Mixed Integer Problem in Vehicle Routing that I'm trying to solve in CPLEX (OPL). The setup is a: .mod = model, .dat = data and a MS Excel spreadsheet I have a 2 dimensional array with customer demand data = Excel range (for coding convenience I did not format the excel data as a table yet) The decision variable in .mod looks like this: dvar boolean x[vertices][vertices][scenarios] in .dat: vertices from

0-1 knapsack using python cplex

别来无恙 提交于 2019-12-13 19:24:37
问题 I'm trying to solve a slight modification of a 0-1 knapsack problem, where each item is a vector of values from which one value is chosen, instead of a scalar using Python Cplex. This is a variant of a Mixed integer problem. I wrote a IBM OPL solution to this problem, but unable to figure out how to solve it using Python Cplex. My solution using IBM OPL is: int Capacity = 100; // Capacity of the knapsack int k = 2; // Number of items int n = 5; // Number of values range values = 1..n; range

OPL Transportation

允我心安 提交于 2019-12-13 03:55:47
问题 I am writing a code for a simple transportation problem in IBM ILOG CPLEX Optimization Studio. Here is the code trans.mod (File) {string} Sources = ...; {string} Destination = ...; float Demand[Destination]= ...; float Output[Sources]= ...; float Shipcost[Sources][Destination]= ...; assert sum(s in Sources) Output[s] == sum(d in Destination) Demand[d]; dvar int Ship[Sources][Destination] in 1..50; minimize sum(s in Sources, d in Destination) Shipcost[s][d]*Ship[s][d]; subject to { forall( s

read CSV file in Cplex

与世无争的帅哥 提交于 2019-12-11 15:56:37
问题 my question is related to my previous question. I should make some change in my code. I have a number of nodes between 1 to 100 in the CSV file. I create another CSV file and generate 20 random numbers between the 100 nodes and called them demand points. Each of this demand point has specific demands which are the randomly generate numbers between 1 to 10. I want to read this demand points(the indexes) and their weights. this is the first part of my question? how can I read this? After that,

IBM Optimization Studio OPL, why constraint is not respected?

不羁的心 提交于 2019-12-11 06:46:39
问题 Here is a description of the optimization problem I need to solve, but with a small twist. I need to add two constraints: The first constraint: From each group we want to choose only one product, which means that we can't allow two products from the same group to be in the same basket(i.e. Product11 and Product12 should never be in the same basket ) The second constraint: In the user basket we only want products from the categories that the user is interested in. i.e if user is interested in

Connecte Excel file to Cplex

江枫思渺然 提交于 2019-12-10 23:59:10
问题 I'm to solve an optimization problem using Cplex. In my file.dat I use SheetConnection my_sheet("ExcelFile.xls") to link Excel file to my cplex program, and after that I use SheetRead() to read data from Excel file. But after I run my configuration I've got the following error: "sheet data not supported on this platform" "Processing failed" I found that reading excel spreadsheet on ILOG CPLEX optimization studio is not supported on Linux Any ideas please? 回答1: I had the same problem. My