package lp
Library
Module
Module type
Parameter
Class
Class type
top module of package Lp
module Var : sig ... end
Module for LP variable. Typically, users don't need to use this module directly. See higher-level module for polynomials (Poly
) instead.
module Term : sig ... end
Module for a term in the polynomial. Typically, users don't need to use this module directly. See higher-level module for polynomials (Poly
) instead.
module Poly : sig ... end
Module for polynomial expression.
module Cnstr : sig ... end
Module for the constraint.
module Objective : sig ... end
Module for the objective.
module Problem : sig ... end
Module for the optimization problem (model).
module Pclass = Problem.Pclass
Module for the optimization problem class.
Map with Poly.t key. It can be used to pack optimization result.
val c : float -> Poly.t
Make monomial of a constant value.
val var : ?integer:bool -> ?lb:float -> ?ub:float -> string -> Poly.t
Make monomial of a variable. You can optionally set its bounds (lb
and ub
) and whether it is an integer
. By default, it becomes continuous and non-negative (integer
= false, lb
= Float.zero, and ub
= Float.infinity).
val binary : string -> Poly.t
Make monomial of a binary variable.
val range :
?integer:bool ->
?lb:float ->
?ub:float ->
?start:int ->
int ->
string ->
Poly.t array
Make an array of monomials of a variable with uniform bounds.
val range2 :
?integer:bool ->
?lb:float ->
?ub:float ->
?start0:int ->
?start1:int ->
int ->
int ->
string ->
Poly.t array array
Make 2D array of monomials of a variable with uniform bounds.
val range3 :
?integer:bool ->
?lb:float ->
?ub:float ->
?start0:int ->
?start1:int ->
?start2:int ->
int ->
int ->
int ->
string ->
Poly.t array array array
Make 3D array of monomials of a variable with uniform bounds.
val rangeb : ?start:int -> int -> string -> Poly.t array
Make an array of monomials of a binary variable.
val range2b :
?start0:int ->
?start1:int ->
int ->
int ->
string ->
Poly.t array array
Make 2D array of monomials of a binary variable.
val range3b :
?start0:int ->
?start1:int ->
?start2:int ->
int ->
int ->
int ->
string ->
Poly.t array array array
Make 3D array of monomials of a binary variable.
val rangev :
?integer:bool ->
?lb:float array ->
?ub:float array ->
?start:int ->
int ->
string ->
Poly.t array
Make an array of monomials of a variable with different bounds.
val range2v :
?integer:bool ->
?lb:float array array ->
?ub:float array array ->
?start0:int ->
?start1:int ->
int ->
int ->
string ->
Poly.t array array
Make 2D array of monomials of a variable with different bounds.
val range3v :
?integer:bool ->
?lb:float array array array ->
?ub:float array array array ->
?start0:int ->
?start1:int ->
?start2:int ->
int ->
int ->
int ->
string ->
Poly.t array array array
Make 3D array of monomials of a variable with different bounds.
val of_float_array : float array -> Poly.t
Convert a float array into a polynomial.
val zero : Poly.t
The monomial of constant zero.
val one : Poly.t
The monomial of constant one.
Subtract two polynomials (concatenate left with negated right).
Multiply two polynomials. Specifically, performs polynomial expansion.
Divide polynomial by a univariate polynomial. Be careful as this function raises exception in some cases.
Build an equality constraint. Optional name
can be given. Polynomials are simplified (Poly.simplify
) on build. eps
specifies the threshold of near-zero, defaulting to 10. *. epsilon_float.
Build an unnamed equality constraint. Polynomials are simplified on build.
Build an inequality constraint. Optional name
can be given. Polynomials are simplified (Poly.simplify
) on build. eps
specifies the threshold of near-zero, defaulting to 10. *. epsilon_float.
Build an unnamed inequality constraint. Polynomials are simplified on build.
Build an inequality constraint. Optional name
can be given. Polynomials are simplified (Poly.simplify
) on build. eps
specifies the threshold of near-zero, defaulting to 10. *. epsilon_float.
Build an unnamed inequality constraint. Polynomials are simplified on build.
val maximize : ?eps:float -> Poly.t -> Objective.t
Build an objective to maximize a polynomial. The polynomial is simplified (Poly.simplify
) on build. eps
specifies the threshold of near-zero, defaulting to 10. *. epsilon_float.
val minimize : ?eps:float -> Poly.t -> Objective.t
Build an objective to minimize a polynomial. The polynomial is simplified (Poly.simplify
) on build. eps
specifies the threshold of near-zero, defaulting to 10. *. epsilon_float.
val make : ?name:string -> Objective.t -> Cnstr.t list -> Problem.t
Make problem from an Objective.t
and a constraint (Cnstr.t
) list. String name
can be given optionally.
val validate : Problem.t -> bool
Validate the problem. true
(false
) means the problem is valid (invalid).
val vname_list : Problem.t -> string list
Make (unique and sorted) list of the variables in a problem.
val to_string : ?short:bool -> Problem.t -> string
Express the problem in LP file format string.
val of_string : string -> Problem.t
Parse an LP file format string to build the problem.
val write : ?short:bool -> string -> Problem.t -> unit
write fname
problem
writes out problem
to an LP file fname
.
val read : string -> Problem.t
Parse an LP file to build the problem.