-
Notifications
You must be signed in to change notification settings - Fork 21
[WIP] Experimental SLP algorithm #274
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
base: master
Are you sure you want to change the base?
Conversation
|
Things to do, 1. Trust region update 2. A restoration like algorithm to get to a good starting point if the starting point is infeasible so that the algorithm is robust to bad x0. |
|
Just a quick comment: the user-facing functions in GMs are being migrated from |
| "base_time", | ||
| "base_pressure", | ||
| ] | ||
| solution = Dict{String,Any}(k => copy(data[k]) for k in unchanged_keys) |
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.
TODO: I should use InfrastructureModels' solution constructor here
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.
This is tricky because IM.build_solution depends on JuMP.value, which uses the MOI.VariablePrimal attribute. I think I need to give the model a mock backend then set this attribute with something like
MOI.set(JuMP.backend(model), MOI.VariablePrimal(1), var, slp.primal_solution[var])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 couldn't get this to work in a quick attempt. My best attempt has been:
JuMP.set_optimizer(gm.model, MOIU.MockOptimizer)
MOIU.attach_optimizer(gm.model)
MOI.set(JuMP.unsafe_backend(gm.model), MOI.TerminationStatus(), slp_results.termination_status)
for var in JuMP.all_variables(gm.model)
val = slp_results.primal_solution[var]
MOI.set(JuMP.unsafe_backend(gm.model), MOI.VariablePrimal(1), JuMP.index(var), val)
end
gm.model.is_model_dirty = false
solution = _IM.build_solution(
gm;
post_processors = [
sol_psqr_to_p!,
sol_compressor_p_to_r!,
sol_regulator_p_to_r!,
],
)This gives me the error message LoadError: No mock primal is set for variable MOI.VariableIndex(12345681), which I don't know how to interpret.
Options I see for solution building:
- Build
solutionmanually (current approach) - Patch
InfrastructureModelsto accept something like avar_valuefunction or dict to override the use ofJuMP.value - Eventually make this a proper MOI solver, then update the
solve_ogfmethod to usebuild_solution
I currently like option 3.
This is a very basic implementation that will need some improvements before production use, but this is probably a good point to get some comments on my design. The algorithm converges several of the Matgas files I've written from Luke and Anatoly's CSV data, but does not converge any of the Matgas files I tried from this repo's tests.
Development roadmap:
start_value)Here's an example that works:
model30ss.m
Here's how you call the solver:
Here's the output I get: