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
-1
votes
1 answer

How to linearize constraints in Gurobi

i'm using Gurobi, I have 2 decision variables x and y, and i want to linearize some constraints, here's my code : m.addConstr( x == max(0, y) ) m.addConstr( x >= 0 )
huangkai
  • 21
  • 1
  • 5
-1
votes
1 answer

Gurobi generates wrong solutions when dealing with small numbers

I am using Gurobi on Python interface, to solve a mathematical programming model, for a class of single machine scheduling problem, that contains both Binary and Continuous variables. In some cases, when dealing with small numbers, the solution…
Mostafa
  • 113
  • 9
-1
votes
1 answer

Network Flow Optimimization (Gurobi)

I am trying to model and solve an optimization problem, with python and gurobi optimizer. It is my first experience to solve a problem using optimizer. firstly I wrote a really big problem and add all variables and constraints, step by step. But…
-1
votes
1 answer

Piecewise optimization gurobi

Following is a piecewise function. I need to optimize it. q is the decision variable while the objective is to minimize the overall function subject to the constraint that it never gets zero. How can I optimize this piecewise. all other variables…
-1
votes
1 answer

create 4 dimension array in Python in optimization model

I'm struggling to work with 4 dimension array in python (to optimize then in Gurobi) My objective function is: model.setObjective((quicksum(r[i,j,k,l]*x[i,j,k,l] for i,j,k,l in XXX Subject to a number of constraints: With the following variable: #…
German
  • 1
-1
votes
1 answer

How to do a nested loop Jupyter Notebook Python

I am starting to work with Jupyter Notebook and I have no idea how to do a nested loop, tried everything I could think of. What I want to do is: I=(0,1,2,3,4) R=(0,1,2,3,4) y= m.addVars(n,5, name="y", vtype=GRB.BINARY) yy= m.addVars(n,5*n,…
Barnelby
  • 1
  • 1
-1
votes
1 answer

How to get absolute value of a linear expression?

I am currently working on a optimization problem on GUROBI.All my variables are of binary type.I have a variable y which is equal to the absolute of difference of two binary decision variables.However,when i tried to use the abs() function,i get…
Suman L
  • 1
  • 3
-1
votes
1 answer

Gurobi stopping criteria in MATLAB?

I have been trying to write a MILP in Matlab. I am using gurobi solver interfaced with Matlab. It seems solver has found a heuristic optimal solution but does not stop the iterations and keep looking for it. I am posting the screenshot of the…
nagpalh
  • 51
  • 5
-1
votes
1 answer

Traveling salesman in Gurobi/Python

I am trying to learn Gurobi and having a little bit of trouble understanding how the functions work. I have a matrix with the distance to different places, it looks as follows: places = {} places[“A”,”A”] = 0 places[“A”,”B”] = 10 places[“A”,”C”] =…
gurobiboy
  • 1
  • 1
-2
votes
2 answers

numebering from 1 when using range(len(a)) in python resulting assertion error

The headline says it all. I used it to name the output so I want it to start from 1. edit : I tried range(1, len(a)) but it won't work. Below is my completed code that I run and I tried to numerated. I supposed it's because it will ruining the…
-2
votes
1 answer

How do i fix "invalid error" in python 3?

My programm show one error about syntax of the following line code: runfile('D:/Mon Amour/Codes HPP and Thermal/My World/codes of hydro/Gurobi_python_hydro_scheduling/Gurobi_Python_Hydro_Scheduling-master/SDDP_Model.py', wdir='D:/Mon Amour/Codes HPP…
-2
votes
1 answer

Installed gurobi , not refelecting when importing

I have installed gurobi, however it does not get reflected when importing. I get the following error: No module name gurobi
skaur
  • 15
  • 2
-2
votes
1 answer

AttributeError: 'tuple' object has no attribute 'addVar'

I am stuck on this error: AttributeError: 'tuple' object has no attribute 'addVar' This is a part of my code from gurobipy import* m = () #model data import xlrd file_location = "C:/Users/Mohamed/Desktop/Service.xlsx" workbook =…
-2
votes
2 answers

Using Gurobi to run a MIQP: how can I improve time performance?

I am using Gurobi to run a MIQP (Mixed Integer Quadratic Programming) with linear constraints in Matlab. The solver is very slow and I would like your help to understand whether I can do something about it. These are the lines which I use to launch…
TEX
  • 2,249
  • 20
  • 43
-2
votes
1 answer

AttributeError: 'gurobipy.Var' object has no attribute 'w_permanent'

so I have a problem when it process for printing variables, it can get a result but can not print the variables I is months, J is productsname so my setting variables w_permanent = M.addVars (J , I , lb=0 , vtype=GRB.INTEGER,…
Ruomei
  • 1
  • 1
  • 1
1 2 3
72
73