user_model.hpp file
UserModel element — a self-contained AMPL model fragment.
Defines the UserModel structure — a first-class element that bundles, in ONE element, a set of user variable declarations (cols) + user constraint declarations (rows). It is the generic AMPL-capture vehicle of the FutureCost / UserModel refactor (piece 3): the named cols/rows it owns are captured to the solution under output/UserModel/<tag>/{sol,cost,dual,slack}, and piece 5 will build AmplFutureCost (a global α var + user cuts) on top of it.
Rather than inventing a new AST, UserModel REUSES the existing DecisionVariable (cols) and UserConstraint (rows) structures verbatim: variable_array holds the column declarations and constraint_array holds the row declarations. UserModelLP then drives one internal DecisionVariableLP / UserConstraintLP per declaration through the SAME resolver / AMPL-registry / scope-routing machinery as the standalone elements — additive, no fork.
UserConstraint and DecisionVariable keep working as standalone elements (irrigation depends on them); UserModel is a NEW, additive aggregation.
JSON Example
{ "uid": 1, "name": "fcf_recourse", "tag": "fcf", "variable_array": [ {"uid": 1, "name": "alpha", "scope": "global", "cost": 1, "cost_type": "raw"} ], "constraint_array": [ {"uid": 1, "name": "FcfCut", "scope": "global", "expression": "decision_variable('alpha').value >= 0"} ] }
Namespaces
- namespace gtopt
Classes
- struct gtopt::UserModel
- A self-contained AMPL model fragment: user vars + user constraints.