Logo GenPRES

CompleteOrder Module

Searches for complete orders, in which every variable has one value and every equation holds, and drops the values that a search proves no complete order reaches. The search fixes the free variables one at a time and solves the order for the minimum and the maximum after each value, so values that the equations then rule out are removed before the search tries them.

Types

Type Description

Search

The outcome of a search.

Functions and values

Function or value Description

byName ord name

Full Usage: byName ord name

Parameters:
Returns: OrderVariable

Returns the order variable with the name. Throws when the order has no such variable.

ord : Order
name : Name
Returns: OrderVariable

dropProvenImpossible logger ord ovar

Full Usage: dropProvenImpossible logger ord ovar

Parameters:
Returns: OrderVariable option

Removes from the value list of the variable each value that a search proves impossible, with one search per value, run in parallel. A value that a search cannot decide stays in the list. Returns the variable unchanged when it has no list of more than one value, and None when every value in the list is proven impossible.

logger : Logger
ord : Order
ovar : OrderVariable
Returns: OrderVariable option

freeNames ord

Full Usage: freeNames ord

Parameters:
Returns: Name list

Returns the names of the basic variables and the invariants that occur in the order equations. The order count is left out because it has no maximum, so every multiple of a total over the order is reached. A variable outside the equations, such as the adjust quantity of an order without an adjusted dose, is not searched.

ord : Order
Returns: Name list

isProvenImpossible logger ovar ord

Full Usage: isProvenImpossible logger ovar ord

Parameters:
Returns: bool

Returns true when no complete order has the variable set to the value of ovar: the solve with the value fails with messages that prove it, or a finished search finds no complete order. Returns false for a failure that proves nothing, or for a search that stops at maxSolves or at a range that cannot be listed.

logger : Logger
ovar : OrderVariable
ord : Order
Returns: bool

maxSolves

Full Usage: maxSolves

Returns: int

The maximum number of solves in one search.

Returns: int

proves msgs

Full Usage: proves msgs

Parameters:
Returns: bool

Returns true when the messages of a failed solve prove that the order cannot hold the values it was solved with. A loop limit, a value set too large to list or an unexpected exception proves nothing.

msgs : Message list
Returns: bool

search logger firstOnly ord

Full Usage: search logger firstOnly ord

Parameters:
Returns: Search

Returns every complete order that the order allows, or only the first one when firstOnly is true. The search stops after maxSolves solves.

logger : Logger
firstOnly : bool
ord : Order
Returns: Search

setAndSolve logger ovar ord

Full Usage: setAndSolve logger ovar ord

Parameters:
Returns: Result<Order, (Order * Message list)>

Replaces the order variable with the same name by ovar and solves the order for min and max.

logger : Logger
ovar : OrderVariable
ord : Order
Returns: Result<Order, (Order * Message list)>

singles ovar

Full Usage: singles ovar

Parameters:
Returns: OrderVariable list option

Returns one copy of the variable for each of its values, with that single value. Returns None when the range of the variable cannot be listed in at most 100000 values.

ovar : OrderVariable
Returns: OrderVariable list option

tryFindWith logger ovar ord

Full Usage: tryFindWith logger ovar ord

Parameters:
Returns: Order option

Returns the first complete order in which the variable has the value of ovar, or None.

logger : Logger
ovar : OrderVariable
ord : Order
Returns: Order option

withValues vu ovar

Full Usage: withValues vu ovar

Parameters:
Returns: OrderVariable

Returns the variable with its values replaced by the values of the value unit vu.

vu : ValueUnit
ovar : OrderVariable
Returns: OrderVariable

Type something to start searching.