Questions tagged [gurobi]

Questions related to the commercial solver Gurobi Optimizer.

Filter by
Sorted by
Tagged with
5 votes
0 answers
61 views

Reduce overhead Gurobi Python getting and setting attributes

I am using Gurobi 9.5.1 in Python 3.10. In the context of column generation I request the duals of the master problem and set them in the objective of the subproblem. This is done repeated times. <...
user avatar
  • 51
2 votes
1 answer
87 views

Restriction on gurobipy problem

The main problem is the optimization of the filling of a tank, filling it in cheap periods and extracting in expensive periods to sell. I am using Python and gurobipy. I am not able to model this ...
user avatar
  • 49
2 votes
1 answer
107 views

Coding some parameters with index zero in Julia

As part of our constraints, we have \begin{align*} &\sum_{i=1}^{I}c_ix_i\ge y, \\ &\sum_{i=1}^{I}c_{i-1}x_i\le y, \end{align*} where $y\ge0,x_i\in\{0,1\}, \forall i$. I am trying to code ...
user avatar
3 votes
2 answers
122 views

How to input this LP model of a buffer allocation problem in Gurobi?

I am doing research on optimizing a simple buffer allocation and need to run my model. I am new to this but someone told me about using Gurobi and I do not for the life of me know how to create the ...
user avatar
  • 39
0 votes
1 answer
154 views

How to put this restriction using Gurobi in python

I am doing an optimization problem for the filling and extraction of a warehouse. One of the constraints is that the filling volume cannot exceed a given limit for one day: For example, on the 3rd of ...
user avatar
  • 49
9 votes
2 answers
459 views

Dealing with Symmetry. Commercial solver defaults vs manual implementations

Since the modeler has domain/business knowledge of the problem being solved, is it possible to manually implement Isomorphism Pruning or Orbital branching and beat the default methods implemented by ...
user avatar
1 vote
1 answer
82 views

Solving Graph Partitioning Problems with Gurobi and Pyomo

I am trying to solve a graph partitioning problem for a large number of structurally similar random graphs with an 0-1 LP. Most of these problems are solved within 0.x seconds. Some graphs take the ...
user avatar
  • 267
0 votes
1 answer
135 views

It takes a long time to solve excel gurobi-opensolver - is this normal?

The problem I have made associated with OpenSolver and Gurobi takes about 50 minutes to solve, is this normal? It has approximately 365 variables with upper and lower bands, the peculiarity is that ...
user avatar
  • 49
-1 votes
1 answer
80 views

I'm trying to solve an OR problem written using pulp framework , with gurobi, in Linux , but I'm not able to solve it

I'm trying to solve an OR problem written using pulp framework , with gurobi, in Linux , but I'm not able to solve it . In windows,I use this command to use gurobi , ...
user avatar
  • 459
1 vote
0 answers
60 views

How to solve this problem with Gurobi add-in Opensolver excel

My main problem is that, when I try to solve an optimization using Gurobi with the OpenSolver add-in, I get the error that there is no feasible solution. To summarize, my variable $X_i$ has a maximum ...
user avatar
  • 49
1 vote
1 answer
74 views

Modeling constraints in gurobi

$$\max \lbrace 0, q_i \rbrace \le L^r_i \le \min \lbrace Q^r,Q^r+q_i \rbrace \quad \forall i\in N,r\in R$$ I am not sure if this type of question is allowed here but I am stuck at modeling this ...
user avatar
  • 429
6 votes
1 answer
103 views

Compute Scaling factor(s) for linear constraint ($A@x<b$)

We optimize large-scale optimization problems with tens of thousands of variables and constraints with Cvxpy + Commercial solvers (e.g. Gurobi, Mosek). The coefficient range easily exceeds the ...
user avatar
  • 430
1 vote
1 answer
98 views

How to get negative shadow price for minimization problem in Gurobi?

I am currently working on a scheduling problem (MIP) to minimize cost, and my idea is to first generate a set of discrete initial solutions, and build an LP model with the discrete initial solution to ...
user avatar
  • 19
1 vote
0 answers
61 views

How to see fix constraint violations found with IIS

I'm running a simple MCNF model to see if my network is balanced. I'm using Gurboi in Python and with the IIS I can see that there are 2 constraint violations making it infeasible. How do I fix these ...
user avatar
3 votes
4 answers
287 views

How to see constraint violation for network flow problem

I am testing to see if my network is balanced as part of a larger protection-interdiction-restoration problem. To do this, I'm solving the problem as a minimum cost network flow problem to see if the ...
user avatar
1 vote
1 answer
174 views

How to create Gurobi model using a matrix? (C++ API)

I have been working on the Gurobi (C++ API) using its reference manual for some time. I did not see any description in the manual regarding how to create the Gurobi model using a matrix and iterate ...
user avatar
  • 105
2 votes
0 answers
105 views

Solving minimax problems with Gurobi

I want to solve a problem of the form $\min_x\max_y f(x,y)$ using Gurobi, where $x,y\in [0,1]$. Is there a simple way to model this in Gurobi? I've seen examples where the domain of $y$ is finite, but ...
user avatar
  • 21
1 vote
0 answers
92 views

How to eliminate large matrix coefficients and large RHS warning in Gurobi

I'm solving a large network flow problem using Gurobi to do Benders decomposition in Python. The imported .csvs contain values that typically fall in either zero, the range of [20,200], or with a ...
user avatar
-5 votes
1 answer
106 views

How to make Gurobi solve huge LP/IP model with only using A,b,c matrices?

I work on the scaling of MIP. I have scaled the A,b,c matrices of the huge original model. These matrices have more than 25000 rows and columns. I need to make Gurobi solve the scaled model. Normally, ...
user avatar
  • 105
2 votes
1 answer
35 views

How does a ratio of fixed cost to variable cost affect the problem difficulty?

I am working on an OR scheduling problem where OR opening cost is considered a fixed cost when a surgery is scheduled. If OR is used beyond a certain time, overtime cost is incurred. I would like to ...
user avatar
7 votes
1 answer
116 views

Translate LP format to Numpy matrices

We have a large-scale optimization problem (~10K vars and ~10K constraints) in the form of LP format file (generated using Cplex ...
user avatar
  • 430
1 vote
2 answers
273 views

How to create A, b and c matrices from very large .lp file?

I am working on Scaling MIP. I use Gurobi within Clion. I need to extract the coefficient of Xs (A matrix), right-hand side (B matrix), and an objective function(c matrix) from the .lp file and ...
user avatar
  • 105
1 vote
2 answers
180 views

Gurobi with C++

This is not the right question to be posting here, but is anywhere a video tutorial/ written on how to link C++ header files with Gurobi?
user avatar
  • 101
3 votes
0 answers
54 views

Pyomo: Compute IIS, remove corresponding constraint and resolve

I am using pyomo together with a bunch of solvers (gurobi, cbc, etc.). I am able to compute the IIS (with gurobi, not cbc), and write it in a *.ilp file. What I ...
user avatar
  • 414
0 votes
1 answer
169 views

How to make CLion read .lp file and make Gurobi solve that file within CLion?

I am working on the scaling of a MIP using C++. I use Gurobi within CLion. The Gurobi model I use now in Clion require me to enter everything manually (model.addVar, model.addConstr...). However, in a ...
user avatar
  • 105
0 votes
1 answer
132 views

Algorithms and analytical solution methods/tools to solve an optimization problem for a particular objective function

I have the following objective function: \begin{equation} \min_{I_{i,v}} \ \sum^{N_v}_{v}\sum^{TT_v}_{i} \ C_{loss,cyc} \end{equation} where $I_{i,v}$ is the only positive decision variable. $...
user avatar
7 votes
1 answer
388 views

Problem is infeasible with Gurobi, feasible with cbc (but can't access objective value)

I am solving a MILP with cbc and gurobi (via pyomo). Gurobi states that the model is infeasible. As to cbc the solver status states that a feasible and optimal solution is found, but then it fails to ...
user avatar
  • 414
4 votes
2 answers
120 views

Compute Irreducible Infeasible Set (IIS) in Pyomo

I am using Pyomo together with Gurobi (and other solvers such as cbc). I am trying to compute an Irreducible Infeasible Set (ISS). In Pyomo documentation, ...
user avatar
  • 414
10 votes
1 answer
579 views

No "not equals" constraint in Gurobi

I'm using Gurobi and trying to set a constraint that two variables A, B are not equal ...
user avatar
  • 145
1 vote
0 answers
60 views

Pooling problem, Gurobi example

I tried to model and solve this Pooling problem below. I used Excel and Opensolver and used Couenne solver to get the .nl problem file. I then used Neos Knitro and Scip 8 to (try to) solve the problem....
user avatar
3 votes
0 answers
39 views

PWL constraints efficiency

So, I'm trying to optimize MILP, which has PWL constraints. I use gurobi, and when I'm optimizing model without those constraints, gurobi finds solution in a matter ...
user avatar
2 votes
1 answer
142 views

Gurobi add constraint which two variables cant be zero at the same time

I'm currently using Gurobi in python and trying to add a constraint that the variable will not equal to 0 at the same time, say a != 0 or b != 0, both a and b can ...
user avatar
  • 145
1 vote
1 answer
233 views

Pyomo: Check if solution exists and if not solve other problem

I am using pyomo with gurobi (and other solvers) to solve some optimization programs. Sometimes these programs don't have a solution and throw an error such as ...
user avatar
  • 414
0 votes
2 answers
116 views

How to find an optimal solution (out of many optimal sols) of an MILP, which satisfies a condition (maximizes a variable) in GUROBI?

I have an MILP problem with an objective of the type $\max z(x,g(x))= X - \varepsilon\cdot g(X)$, where $\varepsilon$ is a penalty term determined through an iterative process. What I want is to find ...
user avatar
0 votes
1 answer
102 views

Gurobi Environment should be Common or Unique for concurrent optimization problems?

Thanks for the amazing performance of Gurobi. Actually we are using Gurobi Cloud (via its python binding - Gurobipy) for our optimization requirements. Due to our ...
user avatar
  • 430
1 vote
0 answers
68 views

Hybrid metaheuristic and linear program?

I have a Linear program (LP) that can solve problem X with two objective functions a and b, I use the weighted sum method. I use Gurobi solver when I optimize the objective alone, the problem takes a ...
user avatar
5 votes
1 answer
83 views

How to transfer an optimization problem written with GUROBI (in python) in a grammar that can be readily solved with another solver?

Trying to use an opensource optimization tool in python (having used only gurobi for years) I see that the whole code (representing the optimization problem in pythonic language) must be written ...
user avatar
2 votes
3 answers
183 views

How to say to Gurobi solver with Python API to start from a given solution?

I have a binary linear program, where all my variables are binary. So, I have implemented the problem on python with Gurobi solver. I have implemented also a heuristic to find a near-optimal solution. ...
user avatar
5 votes
1 answer
128 views

What fraction of the search space has been searched for ILP?

Is there a way to make Gurobi output (an estimate of) how much of the search space has already been cut off as infeasible? If not with Gurobi are you aware of any binary only (912 of them) ILP solver ...
user avatar
0 votes
1 answer
132 views

How to solve the following linear programming problem using Gurobi (or at least python)?

For an optional ungraded assignment (see it as a complex problem that won't be graded, more to test our skills and knowledge) I was given the following problem. It is not as straightforward as all the ...
user avatar
3 votes
0 answers
62 views

Automatic quadratization of constraints in pyomo for gurobi

Gurobi 9 can solve QCQPs, and QCQPs capture all of polynomial optimization by the obvious trick that e.g. a cubic term $x_1 x_2 x_3$ can be turned into a quadratic term $y x_3$ and a constraint $y = ...
user avatar
2 votes
1 answer
277 views

Using OR-Tools with .NET and GUROBI

We want to model our MILP problem with Google OR-Tools in .NET, and solve it using GUROBI (solver may change in the next 1-2 years). However, we couldn't find the correct syntax to call GUROBI. https:/...
user avatar
1 vote
0 answers
165 views

Problem with Piecewise constraint in Gurobi

I am facing a problem in my model with piecewise constraints that is making my one of the decision variables equal to zero for every value. My objective function is: \begin{equation} \min \sum_{t=...
user avatar
  • 99
6 votes
1 answer
272 views

Gurobi searches all nodes despite variable initialization

We are trying to solve a large-scale MIQCQP (18K decision variables) problem via Gurobipy (v9.0.3). Gurobi is able to solve this problem in ~13 mins despite whether or not we initialize the decision ...
user avatar
  • 430
7 votes
1 answer
272 views

Why is Gurobi output in Pyomo returning floating-point values rather than optimal integer solution?

I am hoping someone will be able to point me in the direction of why I am experiencing floating-point outputs rather than simply model.X = [15,15] and model.Z = [15,5] as solutions to this model? Note ...
user avatar
  • 191
3 votes
1 answer
121 views

Standard Form for LP and MPS

Is there any way I could have Gurobi/CPLEX or any other package write/export MPS and LP files in the standard LP construct loaded with slack variables and transformations required for unsigned vars? ...
user avatar
8 votes
1 answer
332 views

Using the values of variable in the objective function before optimizing

I am facing a problem to multiply a term in objective function. My objective function is : \begin{equation} \min \sum_{t=1}^\top p_{t} \cdot (1+r) \cdot y_{t} \end{equation} where $p$ is the ...
user avatar
  • 99
3 votes
1 answer
95 views

A tricky Bi-Level Location Problem using VISUM

I'm writing my thesis on the optimal location of Air-Taxi Stations. I'm using PTV VISUM for the transport model where I'll inherit the Origin-Destination demand matrix. I come from transportation ...
user avatar
4 votes
1 answer
513 views

Gurobi: how to add a constraint to make there be only one non-integer value

line1 line2 line3 line4 A 2.3 0 3.1 0 B 0 4 2.2 0 C 1.1 0 0 4.6 Let's say after optimization with certain constraints, my model will generate an optimal production allocation table similar to ...
user avatar
  • 41
2 votes
2 answers
472 views

How to solve MILP efficiently using MIP python? Any other solvers to quickly solve where I have only integer and binary variables alone?

...
user avatar
  • 125