The model seems to ignore the added constraints
Awaiting user inputI designed an optimization algorithm which is iteratively solving a model, adding a constraint, solving it again, remove the old constraint, add the new one, solve, remove, add... And so on.
The issue is the following: with linear objective functions and linear constraints everything is ok but when I use the algorithm for solving problems having a quadratic objective function and quadratic constraints (everything is convex, I get no "set NonConvex parameter" error or warning) things start to get pretty messy. Namely, I sometimes get an error "Tried to remove a quadratic constraint that does not exist", which I never got with linear problems (issue solved by calling update() on the model every time I add a constraint...) and most importantly, after a certain point and with a specific instance, it happens that the solution I get seems to completely ignore the constraint added at the previous iteration, and so I end up in a loop in which, despite the constraint, gurobi retrieves the same solution over and over again even if to the best of my knowledge the solution retrieved should be infeasible.
Note that I am on the python API and I am not using any callback. I tried both addConstr and addQConstr for adding the constraints. Also, I tried for quite some time to understand what is going on in the code without being able to encounter the possibly present bug in my code.
It is very hard for me now to post a minimal reproducible example, so I will first ask the community is there are some straightforward guesses I can take advantage of.
Thanks in advance for the help provided.
-
Hi Daniele,
It would be best if we could investigate this on our end. Can you please share a minimal reproducible example with us? You can share the file with us through Filemail, Dropbox, Box, Google Drive, or OneDrive.
Thanks,
Simran0
Please sign in to leave a comment.
Comments
1 comment