Gurobi TypeError: __init__() takes exactly 3 positional arguments (4 given)
回答済みHi,
I'm coding an optimization AbstractModel, and if I use gurobi as a solver, when running the variable declaration I find the following error message on my Jupyter Notebook. Could someone explain to me why is that?
Best regards,
Juan

-
Hi Juan,
I think this problem is due to you trying to use both Pyomo and gurobipy and getting a namespace clash. It looks like you are trying to define a Pyomo variable, but it is trying to create a gurobipy variable instead and fails due to the method signatures being different.Are you perhaps using
from gurobipy import *
from pyomo import *in your code?
In general it is bad practice to import functionality like this. Instead use
import gurobipy as gp
import pyomo as pyoand then gp.Var and pyo.Var will be different things, and you don't have ambiguity, or one overwriting the other.
- Riley
1
サインインしてコメントを残してください。
コメント
1件のコメント