LP Problem Formulation
AnsweredHello,
I am using GUROBI to solve a linear programming problem.
The problem I am trying to formulate has conditions in its constraints, and I am having difficulties formulating those.
Here is a screenshot of the algorithm I am trying to implement.
I have been trying 3 days. So any help is appreciated.
Thanks in advance
-
Official comment
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Dear Jonasz,
thank you for the resources, they helped a lot!Would you mind taking a look at a small code snippet just to make sure that I am going in the right direction?
Structure
- Is this the correct way of defining the objective function?
Some of the constraints:
- Does the way I am formulating the constraints make sense? I am trying to make constrains redundant in case they should be ignored.Best regards
0 -
I can't see any obvious red flags from afar. In the future, we will be better able to help you if you paste your code (and format it as such) in the post, rather than pasting a screenshot.
To assess the constraints, you can also write the model to a file using
m.write("model.lp")and then study the file to check whether the constraints look they way you wish.
Best regards
Jonasz1 -
Sorry for the late replay.
The idea with the .lp file is really amazing, and it helped a lot.
Thank you very much!
Best Regards
Mohamad0
Post is closed for comments.
Comments
5 comments