A program holds a complete model as plain R lists, in the form the service
reads: encode() turns it into bytes, and solve() and submit() accept
it directly. as_program() converts a model() into a program. Building
one by hand, with this function and the ones it links to, is for parts of
the format that a model() does not offer, such as index sets and
parameter tables.
Arguments
- sets
A list of
index_set()s.- indexed_sets
Sets that differ from position to position (see above).
- params
Parameter tables (see above).
- vars
A list of
var_decl()s.- objective
The objective, an expression node (see ir).
- sense
"min"or"max".- constraints
A list of
constraint()s.- fix
Variables fixed at a value (see above).
- scenarios
How many scenarios to draw, at least 1.
- scenario_seed
The seed to draw them from, at least 1.
- sources
The random variables: a named list of
parametric()andempirical()declarations.- structures
The permutations and partitions: a named list of
permutation_decl()andpartition_decl()declarations.- blocks
The blocks (see
block()): a named list, each element a list ofir_var()nodes, the block's variables.
Value
An object of class quicopt_program: a list with one element per
argument, under the argument's name.
Details
Data indexed by positions is given as lists of entries, because a position (a list of numbers and strings) cannot be a name:
paramsmaps the name of a parameter table to a list of entrieslist(key = <position>, value = <number>);indexed_setsmaps a name to a list of entrieslist(key = <position>, value = <list of elements>), a set that differs from position to position;fixis a list of entrieslist(var = , index = , value = ), each fixing one variable at a value.
The order of the entries does not matter.
A model with random variables also needs sources, which declares them,
and scenarios and scenario_seed, which say how many scenarios are drawn
and from which seed. A model with permutations or partitions needs
structures, and one with blocks blocks.