Page
Library
Module
Module type
Parameter
Class
Class type
Source
Currently only a subset of CP-SAT is supported.
Pull requests providing the missing features are welcome, but please pay attention to documentation and tests.
This project provides two packages:
ortools is an OCaml interface for building CP-SAT models. It does not require an installation of OR-Tools as it simply works with the protocol buffer format. See utils/sat_solve_pb.{c,py} for examples of interfacing with the CP-SAT solver.ortools_solvers builds on ortools to provide a simple OCaml interface for calling CP-SAT. Building and installing it requires an OR-Tools installation (see below).Ensure that libortools.9.dylib (macOS) or libortools.so.9 (Linux), and the other runtime libraries, are accessible by your compiler and loader.
For example, on macOS, set the LIBRARY_PATH (for compilation) and DYLD_LIBRARY_PATH (for execution) environment variables.
On Linux, set the LD_LIBRARY_PATH (for compilation and execution) environment variable.
There are several options for obtaining the runtime libraries.
pip. The OR-Tools runtime can be found in site-packages/ortools/.libs.Google.OrTools.runtime.<os>-<arch>.9.<minor>.<patch>.nupkg where os ∈ { linux, osx, win } and arch ∈ { arm64, x64 } and unzip it. The required files are in runtimes/*/native.I would have liked all this to be automatic, but:
download branch for a prototype).The Protocol Buffers interfaces have been generated with ocaml-protc (with pull/263).
If required, they can be regenerated as follows.
git clone git@github.com:google/or-tools.git
cd or-tools
git checkout v9.14 % TODO: update with required version
opam install ocaml-protoc
ocaml-protoc --binary --pp --make --ml_out src/model \
<path-to-or-tools>/ortools/sat/cp_model.proto
ocaml-protoc --binary --pp --make --ml_out src/model \
<path-to-or-tools>/ortools/sat/sat_parameters.proto