package lp
Library
Module
Module type
Parameter
Class
Class type
Module for polynomial expression type
type t = Term.t list
Type for the polynomial with order up to two (quadratic). Internal representation (Term.t list) is intentionally exposed for now.
val c : float -> t
Make monomial of a constant value
val var : ?integer:bool -> ?lb:float -> ?ub:float -> string -> t
Make monomial of a variable
val binary : string -> t
Make monomial of a binary variable
val range : ?integer:bool -> ?lb:float -> ?ub:float -> string -> int -> t array
Make array of monomials of a variable
val zero : t
Constant zero
val to_string : ?short:bool -> t -> string
Get string expression of the polynomial
val classify : t -> classified
Classify terms into three categories quad, linear, const
val collision : t -> bool
Check if any variable collision exist in the polynomial
Simplify the polynomial. The polynomial is sorted and terms with same variables are accumulated. After that, near-zero terms are dropped. epsilon
specifies the threshold of near-zero, defaulting to 10. *. epsilon_float.
val degree : t -> int
Get the degree of polynomial
Divide polynomial by a univariate polynomial. Be careful as this function raises exception in following cases.
trans_bound name
lb
ub
transforms the bounds of the variable name
with lb
and ub
to_integer name
transforms the variable name
into general integer variable