Module Ppl_ocaml_globals

module Ppl_ocaml_globals: sig .. end

PPL interface types and operations shared by all configurations.

Coefficients are Zarith Z.t values. Native domain and solver handles are managed by the OCaml garbage collector; they have no public deletion function. Borrowed PIP and powerset views retain their owners but remain subject to the documented mutation and invalidation rules.

The configured Ppl_ocaml module adds the selected numerical-domain API. See the interface overview and domain operation contracts for native lifetimes, dimensions, result conventions and approximation rules.


exception PPL_arithmetic_overflow of string

A native arithmetic-overflow report with its diagnostic message.

exception PPL_domain_error of string

A native mathematical-domain error with its diagnostic message.

exception PPL_length_error of string

A native size or dimension-limit error with its diagnostic message.

exception PPL_logic_error of string

A native logic error with its diagnostic message. Invalid arguments, domain errors and size errors have their more specific translations.

exception PPL_timeout_exception

A native time-based or deterministic work-limit interruption.

exception PPL_internal_error of string

A native runtime-error report with its diagnostic message.

exception PPL_unknown_standard_exception of string

A native standard exception not covered by a more specific binding translation.

exception PPL_unexpected_error of string

An unexpected non-standard native exception with a diagnostic message.

type degenerate_element = 
| Universe
| Empty

Selects the universe or empty value for a domain constructor.

type linear_expression = 
| Variable of int
| Coefficient of Z.t
| Unary_Plus of linear_expression
| Unary_Minus of linear_expression
| Plus of linear_expression * linear_expression
| Minus of linear_expression * linear_expression
| Times of Z.t * linear_expression

An affine expression with integral Z.t coefficients and zero-based coordinate indices. Times multiplies an expression by an integral coefficient.

type linear_constraint = 
| Less_Than of linear_expression * linear_expression
| Less_Or_Equal of linear_expression * linear_expression
| Equal of linear_expression * linear_expression
| Greater_Than of linear_expression * linear_expression
| Greater_Or_Equal of linear_expression * linear_expression

An equality or strict/non-strict inequality between affine expressions. Each operation determines which constraint forms it admits.

type linear_generator = 
| Line of linear_expression
| Ray of linear_expression
| Point of linear_expression * Z.t
| Closure_Point of linear_expression * Z.t

A line, ray, point or closure point. Points and closure points represent the expression coordinates divided by their nonzero divisor. Native generator validity rules apply.

type linear_grid_generator = 
| Grid_Line of linear_expression
| Grid_Parameter of linear_expression * Z.t
| Grid_Point of linear_expression * Z.t

A grid line, parameter or point. Grid parameters and points use the supplied nonzero rational divisor; native validity rules apply.

type poly_gen_relation = 
| Subsumes

A native relation flag between a domain value and a generator.

type poly_con_relation = 
| Is_Disjoint
| Strictly_Intersects
| Is_Included
| Saturates

Native relation flags between a domain value and a constraint. Query results are lists of the applicable flags.

type relation_with_congruence = 
| Is_Disjoint
| Strictly_Intersects
| Is_Included

Native relation flags between a domain value and a congruence.

type linear_congruence = linear_expression * linear_expression *
Z.t

(left, right, modulus) represents equality of the two expressions modulo the modulus; zero modulus denotes an equality.

type constraint_system = linear_constraint list 

An OCaml list of constraints. Lists do not carry a separate ambient-dimension field.

type generator_system = linear_generator list 

An OCaml list of generators. Coordinate dimensions are carried by the contained expressions.

type grid_generator_system = linear_grid_generator list 

An OCaml list of grid generators.

type congruence_system = linear_congruence list 

An OCaml list of congruences.

type relation_symbol = 
| Less_Than_RS
| Less_Or_Equal_RS
| Equal_RS
| Greater_Than_RS
| Greater_Or_Equal_RS

A relation selector for generalized affine operations. The _RS suffix distinguishes these constructors from constraint constructors.

type bounded_integer_type_overflow = 
| Overflow_Wraps
| Overflow_Undefined
| Overflow_Impossible

The native wrapping, undefined-overflow or impossible-overflow policy used by wrap_assign operations.

type bounded_integer_type_representation = 
| Unsigned
| Signed_2_Complement

Selects unsigned or signed two-complement integer representation.

type bounded_integer_type_width = 
| Bits_8
| Bits_16
| Bits_32
| Bits_64
| Bits_128

Selects the machine-integer bit width for a wrapping operation.

type complexity_class = 
| Polynomial_Complexity
| Simplex_Complexity
| Any_Complexity

Selects polynomial, simplex or unrestricted native complexity. A policy does not make an approximate domain operation exact.

type optimization_mode = 
| Minimization
| Maximization

Selects minimization or maximization of a linear objective.

type mip_problem_status = 
| Unfeasible_Mip_Problem
| Unbounded_Mip_Problem
| Optimized_Mip_Problem

The infeasible, unbounded-objective or finite-optimized outcome of an MIP solve.

type control_parameter_name = 
| Pricing

Selects the MIP pricing control-parameter family.

type control_parameter_value = 
| Pricing_Steepest_Edge_Float
| Pricing_Steepest_Edge_Exact
| Pricing_Textbook

Selects a supported native MIP pricing strategy.

type pip_problem_status = 
| Unfeasible_Pip_Problem
| Optimized_Pip_Problem

The infeasible or solved outcome of a parametric integer problem.

type pip_problem_control_parameter_name = 
| Cutting_Strategy
| Pivot_Row_Strategy

Selects the PIP cutting-strategy or pivot-row-strategy family.

type pip_problem_control_parameter_value = 
| Cutting_Strategy_First
| Cutting_Strategy_Deepest
| Cutting_Strategy_All
| Pivot_Row_Strategy_First
| Pivot_Row_Strategy_Max_Column

Selects a supported native PIP cutting or pivot strategy.

val ppl_version_major : unit -> int

Returns the major component of the native PPL version.

val ppl_version_minor : unit -> int

Returns the minor component of the native PPL version.

val ppl_version_revision : unit -> int

Returns the revision component of the native PPL version.

val ppl_version_beta : unit -> int

Returns the prerelease component of the native PPL version.

val ppl_version : unit -> string

Returns the complete native PPL version string. Check it against the versions supported by the application.

val ppl_banner : unit -> string

Returns native version, licensing, build and project-contact information.

val ppl_io_wrap_string : string -> int -> int -> int -> string

ppl_io_wrap_string text indent first_width later_width wraps text with the requested indentation and preferred first/subsequent line widths, using the native wrapping policy.

val ppl_max_space_dimension : unit -> int

Returns the native maximum supported ambient dimension. Individual domains and operations can impose smaller limits.

val ppl_Coefficient_bits : unit -> int

Returns the native coefficient bit width, or zero for an unbounded coefficient type.

val ppl_Coefficient_is_bounded : unit -> bool

Tests whether the native coefficient type has finite bounds. OCaml coefficients are represented by Z.t independently of this native limit.

val ppl_Coefficient_max : unit -> Z.t

Returns the largest native coefficient. Requires a bounded native coefficient type; query ppl_Coefficient_is_bounded first.

val ppl_Coefficient_min : unit -> Z.t

Returns the smallest native coefficient. Requires a bounded native coefficient type; query ppl_Coefficient_is_bounded first.

val ppl_Linear_Expression_is_zero : linear_expression -> bool

Tests whether the complete affine expression, including its constant term, is zero.

val ppl_Linear_Expression_all_homogeneous_terms_are_zero : linear_expression -> bool

Tests whether all variable coefficients are zero. The constant term can be nonzero.

val ppl_set_rounding_for_PPL : unit -> unit

Sets the floating-point rounding direction required by the native PPL. Use the rounding and synchronization rules in the interface manual.

val ppl_restore_pre_PPL_rounding : unit -> unit

Restores the floating-point rounding direction saved before native PPL initialization. Restore PPL rounding before subsequent computations that require it.

val ppl_irrational_precision : unit -> int

Returns the native precision parameter used for rational approximations of irrational computations.

val ppl_set_irrational_precision : int -> unit

Sets that native precision parameter to the supplied nonnegative integer. The native admissibility and approximation rules apply.

val ppl_set_timeout : int -> unit

Requests interruption after the supplied positive number of centiseconds. Interrupted PPL work raises PPL_timeout_exception; native watchdog availability and timing rules apply. Replaces an existing time-based limit.

val ppl_reset_timeout : unit -> unit

Cancels the active time-based PPL timeout.

val ppl_set_deterministic_timeout : int -> int -> unit

ppl_set_deterministic_timeout weight scale requests interruption after the native work threshold weight * 2^scale. Both arguments must satisfy the native unsigned-range requirements. Replaces an existing deterministic limit.

val ppl_reset_deterministic_timeout : unit -> unit

Cancels the active deterministic PPL timeout.

type mip_problem 

An owned native MIP problem managed by the OCaml garbage collector.

val ppl_new_MIP_Problem_from_space_dimension : int -> mip_problem

Creates a garbage-collected MIP problem with the given dimension, no constraints or integer coordinates, zero objective and maximization mode.

val ppl_new_MIP_Problem : int ->
constraint_system ->
linear_expression ->
optimization_mode -> mip_problem

ppl_new_MIP_Problem dimension constraints objective mode creates an owned MIP problem. All rows and the objective must fit the ambient space. Initially no coordinates are constrained to be integral; use ppl_MIP_Problem_add_to_integer_space_dimensions for integrality.

val ppl_MIP_Problem_space_dimension : mip_problem -> int

Returns the ambient dimension of the MIP problem.

val ppl_MIP_Problem_integer_space_dimensions : mip_problem -> int list

Returns the indices of the coordinates currently required to be integral, as an independent OCaml list.

val ppl_MIP_Problem_constraints : mip_problem -> constraint_system

Returns an independent OCaml copy of the constraint system. Modifying the returned OCaml data does not update the problem.

val ppl_MIP_Problem_add_space_dimensions_and_embed : mip_problem -> int -> unit

Adds the requested nonnegative number of unconstrained coordinates, preserving the old problem on its original coordinates.

val ppl_MIP_Problem_add_to_integer_space_dimensions : mip_problem -> int list -> unit

Requires the listed existing coordinates to take integer values. Existing integrality requirements are retained.

val ppl_MIP_Problem_add_constraint : mip_problem -> linear_constraint -> unit

Adds one admissible MIP constraint to the problem. Its dimension must fit the ambient space; native MIP admission rules apply.

val ppl_MIP_Problem_add_constraints : mip_problem -> constraint_system -> unit

Adds all constraints in the list, subject to the same admission and dimension rules as the single-constraint operation.

val ppl_MIP_Problem_set_objective_function : mip_problem -> linear_expression -> unit

Replaces the objective with the supplied affine expression. The expression must fit the ambient space.

val ppl_MIP_Problem_is_satisfiable : mip_problem -> bool

Tests exact feasibility with the current constraints and integer-coordinate set. The native solver may update its cached state.

val ppl_MIP_Problem_solve : mip_problem -> mip_problem_status

Solves the current mixed-integer optimization problem and returns Unfeasible_Mip_Problem, Unbounded_Mip_Problem or Optimized_Mip_Problem.

val ppl_MIP_Problem_optimization_mode : mip_problem -> optimization_mode

Returns the current minimization or maximization mode.

val ppl_MIP_Problem_feasible_point : mip_problem -> linear_generator

Returns an independent OCaml point witnessing feasibility. Requires a satisfiable problem; the native solver is queried for its feasible point.

val ppl_MIP_Problem_optimizing_point : mip_problem -> linear_generator

Returns an independent OCaml point attaining the optimum. Requires a problem with a finite optimum.

val ppl_MIP_Problem_objective_function : mip_problem -> linear_expression

Returns an independent OCaml representation of the current objective.

val ppl_MIP_Problem_optimal_value : mip_problem -> Z.t * Z.t

Returns the exact finite optimum as (numerator, denominator). Requires a problem with a finite optimum.

val ppl_MIP_Problem_evaluate_objective_function : mip_problem ->
linear_generator -> Z.t * Z.t

Evaluates the objective at the supplied Point and returns the exact rational value as (numerator, denominator). The point must be dimension-compatible; rays, lines and closure points are not admitted.

val ppl_MIP_Problem_OK : mip_problem -> bool

Tests the native MIP representation invariants. This is a diagnostic query, not a feasibility or optimality test.

val ppl_MIP_Problem_clear : mip_problem -> unit

Resets the problem to the trivial zero-dimensional MIP problem.

val ppl_MIP_Problem_set_optimization_mode : mip_problem -> optimization_mode -> unit

Selects minimization or maximization for subsequent optimization.

val ppl_MIP_Problem_set_control_parameter : mip_problem ->
control_parameter_value -> unit

Selects the supplied native pricing strategy.

val ppl_MIP_Problem_get_control_parameter : mip_problem ->
control_parameter_name ->
control_parameter_value

Returns the current strategy for the requested control-parameter family.

val ppl_MIP_Problem_swap : mip_problem -> mip_problem -> unit

Exchanges the complete states of the two MIP problems. Their dimensions can differ.

val ppl_MIP_Problem_ascii_dump : mip_problem -> string

Returns the native ASCII diagnostic representation of the MIP problem.

type pip_problem 

An owned native parametric integer problem managed by the OCaml garbage collector.

type pip_tree_node 

A checked view of a PIP solution tree. Root and child handles retain the owning problem, so they remain usable after its OCaml handle and parent-node handles have been collected. Calls to problem mutators invalidate all existing tree handles; swap invalidates both problems. Even a no-op or failed update may invalidate handles. Any tree operation on an invalidated handle raises Invalid_argument, including predicates and operations on bottom handles. Obtain a new solution handle after an update. Repeated solving queries without updates preserve handles.

type artificial_parameter = linear_expression * Z.t 

(expression, divisor) defines an artificial parameter by the native integer floor-division convention. Tree-local parameters are interpreted after inherited parameters.

val ppl_new_PIP_Problem_from_space_dimension : int -> pip_problem

Creates a garbage-collected PIP problem of the given dimension, initially without constraints or parameter coordinates.

val ppl_new_PIP_Problem : int ->
constraint_system ->
int list -> pip_problem

ppl_new_PIP_Problem dimension constraints parameters creates an owned parametric integer problem. The last argument lists parameter-coordinate indices; all indices and constraints must fit the ambient space.

val ppl_PIP_Problem_space_dimension : pip_problem -> int

Returns the ambient dimension of the PIP problem.

val ppl_PIP_Problem_parameter_space_dimensions : pip_problem -> int list

Returns the parameter-coordinate indices as an independent OCaml list.

val ppl_PIP_Problem_constraints : pip_problem -> constraint_system

Returns an independent OCaml copy of the problem constraints.

val ppl_PIP_Problem_add_space_dimensions_and_embed : pip_problem -> int -> int -> unit

ppl_PIP_Problem_add_space_dimensions_and_embed problem variables parameters adds the requested nonnegative numbers of decision-variable and parameter coordinates. Existing tree views are invalidated as described by pip_tree_node.

val ppl_PIP_Problem_add_to_parameter_space_dimensions : pip_problem -> int list -> unit

Adds existing coordinates to the parameter set. Tree-view invalidation follows pip_tree_node.

val ppl_PIP_Problem_add_constraint : pip_problem -> linear_constraint -> unit

Adds an admissible PIP constraint fitting the ambient space. Tree-view invalidation follows pip_tree_node.

val ppl_PIP_Problem_add_constraints : pip_problem -> constraint_system -> unit

Adds the admissible PIP constraints in the list. Tree-view invalidation follows pip_tree_node.

val ppl_PIP_Problem_is_satisfiable : pip_problem -> bool

Returns true exactly for the native optimized status in the selected mode. A designated big parameter is treated as arbitrarily large. Infeasibility in that mode may coexist with feasibility at finite values outside the solver's sign assumptions. A solving query without an intervening update preserves existing tree views.

val ppl_PIP_Problem_solve : pip_problem -> pip_problem_status

Solves the parametric integer problem and returns Unfeasible_Pip_Problem or Optimized_Pip_Problem. This query without updates preserves existing tree views.

val ppl_PIP_Problem_solution : pip_problem -> pip_tree_node

Returns a checked borrowed root of the native solution tree, retaining the owner. A bottom handle denotes infeasibility in the selected mode. A finite assignment used to interpret a tree must satisfy the initial context and any big-parameter sign assumptions. Observe the lifetime rules of pip_tree_node.

val ppl_PIP_Problem_optimizing_solution : pip_problem -> pip_tree_node

Returns a checked borrowed root of the lexicographically optimizing tree with the assignment scope and lifetime of ppl_PIP_Problem_solution.

val ppl_PIP_Problem_get_big_parameter_dimension : pip_problem -> int

Returns the selected big-parameter coordinate. Raises Invalid_argument when no big parameter has been selected; query ppl_PIP_Problem_has_big_parameter_dimension first.

val ppl_PIP_Problem_set_big_parameter_dimension : pip_problem -> int -> unit

Selects an admissible parameter coordinate as the native big parameter. Tree-view invalidation follows pip_tree_node.

val ppl_PIP_Problem_has_big_parameter_dimension : pip_problem -> bool

Tests whether a big-parameter coordinate has been selected.

val ppl_PIP_Problem_OK : pip_problem -> bool

Tests the native PIP representation invariants. This does not solve the problem.

val ppl_PIP_Problem_clear : pip_problem -> unit

Resets the native problem and invalidates all existing tree views.

val ppl_PIP_Problem_set_control_parameter : pip_problem ->
pip_problem_control_parameter_value -> unit

Sets the cutting or pivot strategy selected by the supplied control value. Tree-view invalidation follows pip_tree_node.

val ppl_PIP_Problem_get_control_parameter : pip_problem ->
pip_problem_control_parameter_name ->
pip_problem_control_parameter_value

Returns the value of the requested PIP control-parameter family.

val ppl_PIP_Problem_swap : pip_problem -> pip_problem -> unit

Exchanges the complete problem states and invalidates existing tree views from both problems. Dimensions can differ.

val ppl_PIP_Problem_ascii_dump : pip_problem -> string

Returns the native ASCII diagnostic representation of the PIP problem.

val ppl_PIP_Tree_Node_constraints : pip_tree_node -> constraint_system

Returns an independent OCaml copy of the constraints attached to a non-bottom node.

val ppl_PIP_Tree_Node_artificials : pip_tree_node ->
artificial_parameter list

Local artificial parameters in native introduction order. Their coordinate indices follow the original coordinates and inherited artificials.

val ppl_PIP_Tree_Node_ascii_dump : pip_tree_node -> string

Returns the diagnostic ASCII representation of a valid tree handle, including a valid bottom handle.

val ppl_PIP_Tree_Node_OK : pip_tree_node -> bool

Checks the native node invariants; a valid bottom handle passes. Invalidated handles are rejected before this test.

val ppl_PIP_Tree_Node_is_bottom : pip_tree_node -> bool

Tests whether a valid handle denotes bottom. An invalidated handle raises Invalid_argument instead.

val ppl_PIP_Tree_Node_is_solution : pip_tree_node -> bool

Tests whether a valid, non-bottom handle denotes a solution node. A valid bottom handle gives false; invalidated handles are rejected.

val ppl_PIP_Tree_Node_parametric_values : pip_tree_node -> int -> linear_expression

Returns an independent OCaml expression for the requested decision coordinate at a solution node. Requires a valid solution node and an admissible non-parameter coordinate. Expressions can refer to inherited and local artificial parameters.

val ppl_PIP_Tree_Node_is_decision : pip_tree_node -> bool

Tests whether a valid, non-bottom handle denotes a decision node. A valid bottom handle gives false; invalidated handles are rejected.

val ppl_PIP_Tree_Node_true_child : pip_tree_node -> pip_tree_node

Returns a checked view of the true branch of a valid decision node. The child independently retains the owning problem; observe pip_tree_node lifetimes.

val ppl_PIP_Tree_Node_false_child : pip_tree_node -> pip_tree_node

Returns a checked view of the false branch of a valid decision node. The child independently retains the owning problem; observe pip_tree_node lifetimes.

val ppl_is_mixed_integer_satisfiable : int -> constraint_system -> int list -> bool

Exact strict mixed-integer feasibility in an explicit ambient space. Inputs are preserved; out-of-space rows and integer indices are errors.