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

Error code: <bound method Model.optimize of <gurobi.Model Continuous instance Greenhouse Renewable Energy Use: 0 constrs, 0 vars, No parameter changes>>

回答済み

コメント

4件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?.
  • Eli Towle
    • Gurobi Staff

    This is not an error message. You are effectively printing the Model.optimize() function instead of calling it. To call Model.optimize(), add closing parentheses:

    model.optimize()

    Gurobi reports no variables or constraints in the model because Model.update() was not called after adding the variables and constraints. That said, Gurobi performs a model update internally when Model.optimize() is called. As a result, there is no need to explicitly call Model.update() in your code unless you want to query information about the variables/constraints before solving the model.

    0
  • Olivia Park
    • Gurobi-versary
    • Conversationalist
    • Curious

    Thank you for the reply - indeed the parentheses did the work. 

    I have an academic license and it seems that this has limitations..can students have a full license? 

    GurobiError                               Traceback (most recent call last)
    <ipython-input-2-4b5bdce5b8bd> in <module>
        102 
        103 model.setObjective(obj,gp.GRB.MINIMIZE)
    --> 104 model.optimize()
        105 
        106 #P = model.getAttr("X")
    
    src/gurobipy/model.pxi in gurobipy.Model.optimize()
    
    GurobiError: Model too large for size-limited license; visit https://www.gurobi.com/free-trial for a full license
    

     

    GurobiError                               Traceback (most recent call last)
    <ipython-input-2-4b5bdce5b8bd> in <module>
        102 
        103 model.setObjective(obj,gp.GRB.MINIMIZE)
    --> 104 model.optimize()
        105 
        106 #P = model.getAttr("X")
    
    src/gurobipy/model.pxi in gurobipy.Model.optimize()
    
    GurobiError: Model too large for size-limited license; visit https://www.gurobi.com/free-trial for a full license
    
    0
  • Eli Towle
    • Gurobi Staff

    It doesn't look like your academic license file is properly set up. An academic license gives you access to all of Gurobi's features without any restrictions on problem size. I suspect Gurobi is detecting only the size-limited license file included in a pip installation of gurobipy.

    To set up a free academic license, connect your computer to your university's network, then follow the instructions for a named-user academic license at https://www.gurobi.com/academia/academic-program-and-licenses/. This involves downloading Gurobi Optimizer so you can run a \( \texttt{grbgetkey} \) command to set up the academic license file on your computer.

    0

投稿コメントは受け付けていません。