Questions tagged [gurobi]

Gurobi is a commercial optimization solver for linear programming (LP), quadratic programming (QP), quadratically constrained programming (QCP), mixed-integer linear programming (MILP), mixed-integer quadratic programming (MIQP), and mixed-integer quadratically constrained non-convex programming (MIQCP).

As described on Wikipedia:

The Gurobi Optimizer is a commercial optimization solver for linear programming (LP), quadratic programming (QP), quadratically constrained programming (QCP), mixed integer linear programming (MILP), mixed-integer quadratic programming (MIQP), and mixed-integer quadratically constrained programming (MIQCP).

Problems can be defined and solved via Gurobi's interactive shell or one of its many programming languages interfaces: C, C++, Java, Microsoft, .NET, Python, MATLAB, R.

1089 questions
4
votes
2 answers

Gurobi and gurobipy - doubled output console when using Python logging

When using the Gurobi Python package (gurobipy v. 8.1.0) alongside the standard Python logging package, I get on console a doubled output for Gurobi, for example Total elapsed time = 498.27s [2019-03-04 17:51:58,804][INFO] Total elapsed time =…
user1403546
  • 1,680
  • 4
  • 22
  • 43
4
votes
1 answer

How to get constraints in matrix format from Gurobi/JuMP?

I have built an LP model in JuMP/Julia using Gurobi solver. I wish to visualize the constraints for checking the overall correctness of my model. In python, we can define a function help to visualize the constraints. Please follow the link below for…
NIT_GUP
  • 97
  • 1
  • 5
4
votes
1 answer

Efficient way to add variables and constraints through Gurobi Python without enumerating through all elements

I am learning to build optimization models through Gurobi python and I am having some issues finding the pythonic way of defining decision variables and constraints: Assuming I have these sets: time={morning, afternoon,…
4
votes
1 answer

TypeError: unsupported operand type(s) for +: 'generator' and 'generator'

I have a problem with adding three expressions in my objective function. I used quicksum to build each expression. However, when I try to add them together I get an error that I cannot use +/- operands on class 'generator'. Here is the last part of…
Reza A.
  • 43
  • 1
  • 1
  • 5
4
votes
4 answers

print constraints Gurobi Python

I'm using Gurobi in Python and for a given set S I'm adding the constraint as follows: for i in S: m.addConstr(quicksum(x[i,j] for j in (set(V) - set(S))) >= 2) I want to print these constraints for each value of the sets S and V on the screen.…
ccc
  • 574
  • 2
  • 9
  • 22
4
votes
2 answers

Using multiprocess to build Gurobi expression in Python

First of all, I am working with jupyter-notebook, python version 3.5, and Gurobi 7.0.2 with its python interface, all on Red Hat. This is the context of my problem: I want to solve a Quadratic problem, which has a huge number of variables. It takes…
JoseleMG
  • 302
  • 5
  • 18
4
votes
1 answer

Gurobi on Python: Muting the optimize function

I am using Gurobi on Python and my code requires a loop of Model.optimize() function. Is there a way to mute this function, so it won't make paragraphs of output? Thanks.
Oğuz K
  • 164
  • 3
  • 7
4
votes
1 answer

Gurobi, How to change a continuous variable to a binary variable

I am using gurobi-python interface. Is there anyway to convert a continuous variable to a binary variable. I just do not want to convert m.addVar(lb=0, ub=1, vtype=GRB.CONTINUOUS) to m.addVar(lb=0, ub=1, vtype=GRB.BINARY). I have to do it in…
user2512443
  • 485
  • 1
  • 6
  • 20
4
votes
2 answers

iPython: imported module can't find its shared libraries

In iPython, I import a module, which in turn imports another module. This another module (namely gurobipy) tries to load its shared library, which fails. The path to the shared library is added to LD_LIBRARY_PATH in .bashrc. When I run the whole…
Konstantin
  • 2,451
  • 1
  • 24
  • 26
4
votes
1 answer

Gurobi: Get optimization runtime

I would like to access the time it took to find the optimal solution of model m when running a mathematical optimization problem in gurobi from python. So far I use runtime = m.Runtime print("The run time is %f" % runtime) Unfortunately, the…
Peter Lustig
  • 941
  • 11
  • 23
3
votes
0 answers

Infeasible solution MILP Gurobi - Median Regression Estimation

I am currently trying to estimate a model in some academic work I am doing but having some issues getting it to actually estimate in Gurobi, which is currently returning an infeasibility result. For starters, I am trying to optimize the following…
3
votes
1 answer

Obtaining Irreducible Inconsistent Subsystem (IIS) with JumP - Julia

I am trying to obtain the constraints that are included in the IIS, for example with the following infeasible problem using JuMP, Gurobi model = direct_model(Gurobi.Optimizer()) # defining variables @variable(model, z) @variable(model, x1[a=1:10,…
3
votes
1 answer

Integer division in Mixed Integer Linear Programming

What is a solver friendly way of encoding integer division in MILP programs? Currently I'm using the following encoding (in Gurobi python), which may not be totally correct and I hope not that optimal. # res is an integer variable in the solver #…
3
votes
2 answers

Keeping variable names when exporting Pyomo into a .mps file

So, i'm currently working with a pyomo model with multiple instances that are being solved in parallel. Issue is, solving them takes pyomo quite a long time (like 2 to 3 secs, even though the solving part by gurobi takes about 0.08s). I've found out…
Pablo Pablo
  • 165
  • 10
3
votes
2 answers

UnsatisfiedLinkError on System.loadLibrary() after adding the directory to java.library.path

I would like to load the local library /opt/gurobi902/linux64/lib/libGurobiJni90.so within my Java IntelliJ Maven project on Ubuntu 19.10. My first attempt was adding the environment variable LD_LIBRARY_PATH like this: export…
Vega180
  • 779
  • 2
  • 5
  • 22
1 2
3
72 73