package lutin

  1. Overview
  2. Docs

Lucky variables.

type 'a t

Abstract type encoding lucky variables and containing all informations attached to them.

This variable type is parametrised by the type of expression variables refer to.

Name, mode, and type of a variable.
type name = string
type mode =
  1. | Input
  2. | Output
  3. | Local
  4. | Pre
Substitutions.
type subst = name * Value.t
type num_subst = name * Value.num
Building Variables.
val make : string -> string -> Type.t -> mode -> 'a t

Makes a var with the mandatory fields, i.e., its name, type, and mode.

val make_pre : 'a t -> 'a t

Makes a pre var of a var.

nb : "make_pre v" will be different from "make_pre v" (in the sense of ocaml compare) although they will have the same value in the end. It migth be useful to tabulate them in the caller.

Sets the non-mandatory fields of a variable.
val set_min : 'a t -> 'a -> 'a t
val set_max : 'a t -> 'a -> 'a t
val set_alias : 'a t -> 'a -> 'a t
val set_init : 'a t -> 'a -> 'a t
Variable information retrieval.

Respectively retrieves the name, type, mode, min, max, alias, and init values of a variable. Non mandatory fields (of course) return an option type.

val name : 'a t -> name
val typ : 'a t -> Type.t
val mode : 'a t -> mode
val min : 'a t -> 'a option
val max : 'a t -> 'a option
val alias : 'a t -> 'a option
val init : 'a t -> 'a option
Representing the input, output, and local variables vectors.

We use an hash table to represent it as we will need to retrieve input values very often when evaluating formulas (and also weights). -> Replaced by a map

type env_in = Value.OfIdent.t
type env_out = Value.OfIdent.t
type env_loc = Value.OfIdent.t
type env = Value.OfIdent.t

For those types we use lists because the only operation we will need to perform over them is to add elements.

val index : 'a t -> int
OCaml

Innovation. Community. Security.