Questions tagged [opl]

Optimization Programming Language (OPL) is an algebraic modeling language to describe models of optimization and mathematical programming. It is part of IBM ILOG CPLEX Optimization Studio.

Optimization Programming Language (OPL) is a high-level, mathematical language for the description of optimization models, which produces substantially simpler and shorter code than general-purpose programming languages.

438 questions
1
vote
1 answer

Error when using a conditional forall in OPL

I get an error in a OPL model when I use that constraint: forall (j1,j2 in p: row[j1]==row[j2] && j1
Carl
  • 53
  • 1
  • 7
1
vote
1 answer

CPLEX OPL Error 5002: Constraint not convex

I'm trying to work with cplex opl and facing an error. I read the manual and googled but I still have no idea what I should do to fix this error due to my lacking of knowledge. Can anyone please help or give me ideas to figure this out? I really…
1
vote
1 answer

X binary variable and W is dvar float. And i want to have this result if Wi>0 then Xi=1

With X a vector of binary variables, and W a vector of float variables, I want to write a constraint such that if W[i] > 0, then I should have X[i] = 1. dvar boolean X[I]; // we choosed stocks i or not dvar float W[I]; // weight of stocks i in…
1
vote
1 answer

cplex/opl model - 4 index parameter - data sheet connection with excel

I'm a total beginner with CPLEX and OPL, so maybe you can help me with the coding of a mixed integer programming model. In my case: I have an optimization function including a parameter transportation cost which are specific for the starting point…
tabacoben
  • 41
  • 2
1
vote
1 answer

IBM Optimization Studio OPL, why constraint is not respected?

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…
sel
  • 942
  • 1
  • 12
  • 25
1
vote
0 answers

Rewriting OPL model in Java

I'm trying to rewrite basic VRPTW Model from OPL to Java. When I run it in OPL I get objective value 290,1 as a result, but when I run Java code result is 189,5 with same input data. I'm not sure if I just made some mistake in rewriting process.…
Zveka
  • 11
  • 1
1
vote
1 answer

How do you define and initialize a 3 dimensional Array using IBM Cplex OPL script

On the ibm website http://www-01.ibm.com/support/docview.wss?uid=swg21573358 they defined and initialized a 2- dimensional array in the Main Opl script as below main { var var_2d = new Array(3); for (var i=0; i<3; i++) { …
johnO
  • 11
  • 3
1
vote
1 answer

How can I export a .mps file from my .mod and a .dat files in CPLEX?

How can I export a .MPS file from my OPL project so that I can execute it on neos-server.org? My project includes a .mod file and a .dat file. My .mod file contains the following code: main { thisOplModel.generate(); …
Mina H
  • 11
  • 2
1
vote
1 answer

I can't simulate a CPLEX model even when the code has no errors

i have some doubts related to a CPLEX code that i'm trying to write. The code itself (model) seems to be well written, but when it comes to fill the data i have an error. NOTE: there are no constraints in the model because i'm trying to make a trial…
1
vote
1 answer

How do I change my objective to "Minimize Max() - Min()" in OPL Code?

I've got some OPL code that minimizes the sum of my decision variables. It works fine and I'm happy with it, but I would like to change my objective to minimize the... sort of range... of my decision variables. Here's my working OPL code: //…
Shiasu-sama
  • 1,179
  • 2
  • 12
  • 39
1
vote
1 answer

How to execute Cplex Run Configuration without IDE

I don't know if this is possible or not, but I would like to execute a run configuration of my Cplex project without opening the project in the Cplex IDE and running it from there. Can I somehow double click something that runs the configuration or…
Shiasu-sama
  • 1,179
  • 2
  • 12
  • 39
1
vote
0 answers

CPLEX - define variables with expressions

I'm working on fleet assignment problem, and I'm building a model in xpress-Mosel. However, I need to build it too in OPL - Cplex. I'm new at OPL, so I've some doubts. I can't define variables by some expression that aren't constraints or given by…
Jorge Mendes
  • 77
  • 1
  • 9
1
vote
1 answer

How to define this kind of decision variables in CPLEX

I'm new to CPLEX, I wonder how to define decision variables like xijk but only those with subscript i < j or i ≠ j using OPL. The code is like int jobsNum = ...; int machinesNum = ...; range jobs = 0..jobsNum-1 range machines =…
Li Danyuan
  • 121
  • 8
1
vote
1 answer

CPLEX warm start error when using OPL model in Java API

I am trying to do a warm start using the Java API and having some issues when passing the initial solution to the model. In my model file(.mod) I have a 2D decision variable defined as, range nodes = 1..5; range vehicles = 1..2; dvar int…
1
vote
1 answer

A lot sizing model in opl

for my master thesis I have to develope a lot sizing model for a radiology. I implement it with opl and I'm totally new to opl or programming in general. So after a lot of programming time and trying to get the model run, it runs. But now it tells…
CrnD
  • 11
  • 1