package ortools

  1. Overview
  2. Docs

Module Sat.LinearExprSource

Linear expressions are used in linear constraints and to specify objectives.

Sourcetype t

A linear expression. An integer offset is maintainted in addition to a list of coefficients and variables. This allows both to normalize boolean literals into positive form and to represent constants (see of_int).

Sourceval zero : t

An empty linear expression.

Sourceval sum : t list -> t

A sum of linear expressions.

Sourceval sum_vars : 'a Var.t list -> t

A sum of variables: all coefficients are 1s.

Sourceval weighted_sum : (int * 'a Var.t) list -> t

A weighted sum of variables.

Sourceval scale : int -> t -> t

Multiply all coefficients by an integer.

Sourceval of_int : int -> t

A constant expression.

Sourceval var : 'a Var.t -> t

A single variable.

Sourceval term : (int * 'a Var.t) -> t

A single term. See also (*).

Sourceval neg : t -> t

Negate all coefficients (and the offset).

Sourceval to_string : t -> string

Return a string representing the linear expression.

Sourceval pp : Format.formatter -> t -> unit

Pretty-printer for linear expressions.

Sourcemodule L : sig ... end

Operators for building linear expressions. They are also available directly in the Sat module.