-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Iterative ProductMode() #184
base: master
Are you sure you want to change the base?
Conversation
I edited a bit of the code to make it more concise and a little more performant. For practical usage, it is important to set the right solver attributes before running the model. I guess this can hardly be done inside BilevelJuMP ex-ante, as code should work independent of the solver. set_optimizer_attribute(model, "warm_start_init_point", "yes") Additionally, not printing the solver log gives a higher level overview. In the future, some of the warmstart related settings may be included automatically for popular solvers, but I think leaving this to the user should be sufficient for now :D |
… lost) and separate solver settings in iterative mode
…hout using copy_to each iteration, except if this is necessary from solver side.
Hey @joaquimg,
|
Think this should be good to go for now. |
Will look into it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like where it is going.
Can you fix the JuMP style?
I will make changes following that
src/jump.jl
Outdated
|
||
function _iterative_optimize_copy!(single_blm, solver, mode::ProductMode{T}, model::BilevelModel, t0) where T | ||
for (iter,eps) in enumerate(mode.IterativeEpsilon) | ||
SetIterPrimalStarts!(single_blm, solver, model.sblm_to_solver) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in many functions and variable names this PR does nof follow the JuMP style guide: https://jump.dev/JuMP.jl/stable/developers/style/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still fairly inexperienced, so please excuse the question. Is this mostly about naming functions/variables like SetIterPrimalStarts! or IterEps?
Or do I need to consider anything else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have now taken care of function and variable names as well as code formatting.
Now includes tests and a mutable log as well. Note that I had to update Ipopt compat (because it did not have methods to alter the rhs prior to jump-dev/Ipopt.jl#336). |
Formatter was added to master, so you can just run that and it will fix part of the style. |
can you check if this is better? |
Just realized that the following line is problematic if there exist different types of complements (greater/less) within the same model: Further, the previous attempt did not work correctly with slacks, which is also fixed now. |
@joaquimg is there anything I can do/fix atm? |
As discussed on discourse, an iterative solution strategy for ProductMode() would be nice.
I have given this a first (and probably naive) shot.
Changes include:
I would have preferred to do the iterative procedure in place (i.e. without passing a copy for each iteration). The commented code would implement this. However, copying seems more appropriate in this case, as in place modification does not work.
Changes are small, so no old functionality should break.
I would be happy about a brief discussion, especially in case anyone sees a more elegant approach.
Warnings/errors are not yet implemented, also not thoroughly tested on my end. This is more to test the waters and not a final approach :D
It's my first PR, so I would be happy about some feedback!