Closed maramos874 closed 3 years ago
This feature existed in prior releases, but I removed it in the latest rework because I have not yet sorted how it should work going forward. I had a version in development where you could use @decision
annotations also in the final stage, which would mark those variables as recourse variables that could be extracted. However, this was a bit clunky, partly because the recourse actions are scenario-dependent.
Right now there are a few options. After solving a model with vertical/horizontal structure you can always extract the subproblems using subproblem
and observe the recouse actions through regular JuMP functions. There is no built in way to access the recourse variables for a specific scenario in a deterministic equivalent formulation, but this could probably be implemented through the method I alluded to above. If you want the optimal recourse action for a specific scenario ξ
the canonical method right now would be:
x = optimal_decision(sp)
m = outcome_model(sp, x, ξ; optimizer = GLPK.Optimizer)
optimize!(m)
value.(all_variables(m))
Note, that this result will also include the optimal first-stage decision. I could add a shorthand recourse_decision
function that does the above (parallelling expected_value_decision
and wait_and_see_decision
) where you specify the first-stage decision and the scenario. Implementing an option to access a specific recourse action in a solved model will however require some more thought.
The latest release supports extracting optimal recourse decisions using optimal_recourse_decision(sp, scenario_index)
where scenario_index
is the scenario of interest. This only works for second-stage decisions annotated with ´@recourse. The suggested
recourse_decision` function is now available as well. In addition, many other scenario-dependent values can be queried. See NEWS for a summary or the updated documentation.
Hi, Is it possible to extract recourse variables optimal value?
Kind regards