JuMP model state
The private page documents the other names of this topic.
PortfolioOptimisers.state_set! — Function
state_set!(model::JuMP.Model, prefix::Symbol, name::Symbol, val)
state_set!(model::JuMP.Model, prefix::Symbol, name::Symbol, i, val)Register val under the Model State key of name and prefix, and return val.
A nested risk build, such as a risk tracking measure, passes a non-empty prefix, so the entries it makes (:X, :net_X, :W, :dd and others) do not collide with the entries of the outer model. The empty prefix gives the bare key.
The method with i registers the scratch of one measure, such as :cvar_risk_ or :z_cvar_, at the measure index i, so two measures of one type in one build get their own entries. state_key composes both parts of the key.
Algorithm
- Compose the key with
state_key. - Check with
assert_state_key_freethat the key is free. - Register
valunder the key.
Validation
- The composed key is free. Otherwise
assert_state_key_freeraises anArgumentError. To reuse an entry, usestate_build!ormark_state!.
Related