メインコンテンツへスキップ

Gurobi TypeError: __init__() takes exactly 3 positional arguments (4 given)

回答済み

コメント

1件のコメント

  • Riley Clement
    • Gurobi Staff

    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 pyo

    and then gp.Var and pyo.Var will be different things, and you don't have ambiguity, or one overwriting the other.

    - Riley

    1

サインインしてコメントを残してください。