Skip to main content

Error bei optimizaion fomulation

Answered

Comments

3 comments

  • Official comment
    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

    I think your idea is the following: the models are equivalent in the sense that given a solution to either model, you can construct a solution to the other model with equal objective value. In particular, you should be able to flip the signs on the values of the \( \texttt{power_HP} \) and \( \texttt{gas_CHP} \) variables in any solution to the first model to obtain a solution to the second model with the same objective value (and vice versa).

    If this is the case, the problem is that variables in an LP file have a lower bound of \( 0 \) unless otherwise specified. What functions do you use to add the variables to your model? In the Python API, variables added to a model using Model.addVar() or Model.addVars() have a lower bound of \( 0 \) by default. To add variables without a lower bound, add the argument \( \texttt{lb=-GRB.INFINITY} \).

    0
  • Yusheng CHEN
    • Gurobi-versary
    • First Question
    • First Comment

    Hi Eli,

     

    thank you! The problem is solved by add the argument 

    0

Post is closed for comments.