Questions tagged [c++]

For questions about solving Operations Research problems using the C++ programming language.

Filter by
Sorted by
Tagged with
2
votes
1answer
113 views

The precision of the decimal number of the Cplex

I have faced a little weird problem when I use Cplex to solve my test problem. Basically, some of my data are float numbers up to three decimal numbers (For instance, 0.627). But, when I print out the ...
10
votes
1answer
686 views

Linear Optimization Library for C++ with GPU Support

Does anyone know any linear optimization libraries for C++ supporting GPUs for parallelization? If multiple, which do you recommend? The GPU support is important to me since I am dealing with large ...
2
votes
0answers
57 views

Gurobi c++: Getting constraint matrix

I'm trying to get the constraint matrix from a Gurobi model in C++. In Python, one can get this by simply calling a method that will populate a scipy object (see this post). However, in a C++ fashion, ...
0
votes
1answer
127 views

Invalid solutions to Piecewise Mccormick Envelope Implementation

I am currently trying to implement a piecewise McCormick envelope in Drake (c++). The current issue I am having is that the solution produced by the optimization does not produce a valid $x$ and $y$ ...
4
votes
1answer
104 views

How does CPLEX handle objective estimates passed to the makeBranch method?

I want to implement a (simple) branching heuristic through a CPLEX generic callback. There are multiple overloads of the makeBranch method in CPLEX's C++ API, see here: ...
3
votes
1answer
336 views

Implementing benders decomposition using Lazy and User cuts callback of Cplex

I am trying to implement benders decomposition for a simple fixed charge transportation problem for the purpose of learning. I implemented the classic Benders decomposition successfully by adding ...
2
votes
0answers
65 views

CPU time on Linux with Gurobi

I am solving a MILP model in C++ using Gurobi 10.1. I retrieve the CPU time of my C++ program under Linux via the following commands: ...
3
votes
2answers
321 views

Calculated CPU time of C++ is different from actual time to solve MILP model via Gurobi

I am solving a MILP model in C++ using Gurobi 7.5.2. More specifically, I am determining the CPU time of my C++ program via the following commands: clock_t start_time; double elapsed_time; start_time=...
3
votes
2answers
259 views

How to get an extreme ray of an LP from Gurobi

I am working on a problem of form \begin{equation} \begin{array}{l @{\quad} l} \mathrm{max}_{x, u} & p^{\top} u \\ \text{st.} & A u + a x \leq 0 \\ & x \in \{0, 1\...
2
votes
1answer
177 views

C++ code for branch and price

I looking to learn to use bpcolumn generation techniques in c++. Does any body know of GitHub repository or any other site where I can find some code And learn about it... The application can be ...
3
votes
1answer
240 views

Gurobi C++: adding variables with vector

I am solving an LP by using GUROBI - C++ combo. Assume I have a variable $p \in \mathbb{R}^n$. I am adding this as a vector: ...
6
votes
3answers
730 views

No solution found from n MIP starts

Currently, I am working on the implementation of a MILP formulation with lazy constraints for an optimization problem, and I am using the MIP Start strategy. I am generating the integer feasible ...
4
votes
1answer
308 views

How exactly does OptionalIntervalVar work in OR-Tools?

I created OptionalIntervals for a number of tasks: ...
5
votes
1answer
725 views

assigning values to IntVar if and only if BoolVar, else zero [or-tools]

If I have an IntVar s[j] stored in a vector s, is it possible to iterate for (a period of ...
6
votes
0answers
124 views

OptionalIntervalVar enforced but not working OR-TOOLS

I'm using OptionalIntervalVar and then maximizing the starts. The optimal solution is not affecting the other variables that creates the ...
9
votes
1answer
571 views

Check which constraints are violated (Concert - Cplex Studio 12.10 - C++)

Currently, I am working on the implementation of a formulation for an optimization problem, at the moment I already have the MIP formulation implemented in C++ using Cplex studio 12.10 with the ...
6
votes
0answers
126 views

Modelling issue with precedence constraint in OR-Tools

I'm trying to solve an RCPSPDc model It is infeasible, although Ilog Cplex solves it, so I think I have a modelling issue. I have more constraints but the precedence is the one that makes it ...
3
votes
1answer
153 views

ValidateModel or tools in c++ and proto problems

I'm trying to validate my model, this is the relevant part of my code: ...
8
votes
2answers
457 views

Solving multiple easy ILP instances

I have an application where I am solving millions of ILP instances that differ from each other only on one constraint. The instances, of course, are relatively easy to solve or otherwise this would be ...
5
votes
0answers
88 views

Modelling issue with rcpsp and boolean expressions

I'm trying to solve an RCPSPDc problem in OR-Tools with CP-SAT solver. In my RCPSPDc model (with discount rate) i want to set this objective: $$\max_{s}\sum_{j\in J}\text{profit}_{j}\cdot \frac{1}{(1+...
5
votes
1answer
970 views

Cumulative Constraint OR-Tools

I'm trying to solve an rcpsp model. I can't find documentation for the AddCumulative function of OR-Tools. How should this function be used? I want to write this ...
8
votes
1answer
265 views

Precedence Constraint in OR-Tools

I'm trying to write this constraint in C++ and add it to my model (addLessOrEqual): $$\text{start}_{i}+\text{duration}_{i}\le\text{start}_{j}$$ for an $(i,j)$ arc ...
6
votes
1answer
250 views

GUROBI Re-optimize a model

(For Linear Programming) I am aware of CPLEX's reoptimize methods. If I am not wrong, if you solve a problem and after that you add a new constraint, then you can call the reoptimize method for not to ...
7
votes
2answers
575 views

How can I implement a user-written lazy constraint callback in concert CPLEX with C++?

I am trying to implement a user-written lazy constraint callback in concert CPLEX with C++. Although I know there exists a way to implement callbacks in concert CPLEX with C++ via macros, I am looking ...
10
votes
1answer
204 views

Specify the sense of a constraint in CPLEX

I am writing a small wrapper around Gurobi and Cplex so that the models I write are solver independent. I'm very familiar with Gurobi but I'm very new to Cplex and I'm having trouble replicating ...
8
votes
2answers
957 views

CPLEX exceeds time limit issue

I am solving a MILP model using CPLEX 12.8.0, but CPLEX exceeds the time limit on some test instances. More specifically, I set the time limit for 30 minutes using the cplex.setParam(IloCplex::TiLim, ...
10
votes
2answers
224 views

Parallelization of an existing Adaptive Large Neighbourhood Search Heuristic

I am solving (or say, trying to find good solutions for) an arbitrary combinatorial optimization problem, think of it as a Vehicle Routing Problem with a bunch of side constraints that are not ...
13
votes
2answers
1k views

Correct way to get a dual extreme ray for an infeasible LP in CPLEX / C++

We are coding a Benders decomposition using CPLEX/Concert (C++) and we are having some troubles to generate a feasibility cut because we are not sure how to get an extreme ray of the dual for a primal ...
14
votes
2answers
306 views

How to implement a custom global constraint in IBM's ILOG CP optimizer

How do you implement a custom, global constraint in CP Optimizer? This is not a trivial thing to do, as CP Optimizer does not ship any examples of a custom constraint, and the documentation is very ...