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

  1. Compose the key with state_key.
  2. Check with assert_state_key_free that the key is free.
  3. Register val under the key.

Validation

Related

source