package hexaly

Build not yet checked
  1. Overview
  2. Docs
OCaml bindings for the Hexaly Optimizer

Install

dune-project
 Dependency

Authors

Maintainers

Sources

hexaly-0.1.1.tar.gz
sha256=1ba0ccdaf2ba90a2c2f4908efbbb0a88e3ce9e032a66ed7a93fc70bf97f3a035
sha512=8c2072c022d930af26ca25ae25a595cbc2da9ec8358add14419b2fc8402b761bac27d77c0562bccf9eda2d2e2300a5b5a1d3c39f12866bdbc58d0d62142f6bb8

doc/CHANGELOG.html

Changelog

All notable changes to ocaml-hexaly will be documented in this file. Format follows Keep a Changelog; this project uses semantic versioning.

[0.1.1] - 2026-11-23

Packaging fixes found by opam-repository CI. No API changes.

Fixed

  • Test suite: detect the mock backend with Hexaly.backend () instead of the HEXALY_BACKEND variable. A build that falls back to the mock without that variable set (as in opam CI) ran real-solver-only tests against the mock and failed.
  • Link the C++ runtime on every non-MSVC toolchain: -lc++ on macOS and the BSDs, -lstdc++ elsewhere. It was previously added only when OCaml reported system = linux, so linking failed on FreeBSD, mingw, and Linux ppc64/s390x with OCaml 4.14.
  • Depend on conf-c++, so opam installs a C++ compiler where one is missing (e.g. Cygwin).

[0.1.0] - 2026-11-22

First release. Working binding for the Hexaly Optimizer 14.5 C++ API.

Added

  • Core modeling: bool/int/float decision variables; arithmetic, comparison, boolean, conditional, and array operators; constraints; single and multi-objective minimize/maximize.
  • Scheduling support: interval_var, optional_interval_var, start/end_/length/presence operators, interval_value solution readback.
  • Routing support: list_var, set_var, count/index_of/contains/ partition/disjoint/distinct/find/sort/intersection/union_/ hull operators, collection_value solution readback.
  • Math functions: sqrt, log, exp, pow, cos, sin, tan, ceil, floor, round.
  • Typed errors: Hexaly_error of Error.code * string with the 9-way HxErrorCode mirror.
  • Callbacks: add_callback / remove_callback with all 7 event types. The optimizer owns its callbacks; the C side holds a closure as a GC root only while solve runs, so an optimizer whose callback captures it is still collected.
  • Backend query: Hexaly.backend () returns Real or Mock. Hexaly.create warns once on stderr when running on the mock unless HEXALY_BACKEND=mock is set. Trampoline manages OCaml runtime lock across Hexaly's worker threads.
  • Inconsistency analysis: compute_inconsistency returning an Inconsistency.t with nb_causes, cause, to_string.
  • Warm start: set_int_value / set_float_value / set_interval_value on a solution before solve.
  • Advanced parameters: set_advanced_int / _double / _string for Hexaly's named attribute knobs, plus set_warning_level, set_time_between_displays, set_time_between_ticks, set_iteration_between_ticks, objective thresholds, log file.
  • Version / license: Version.major / minor / string / platform, programmatic license-path override.
  • Environment save: save_environment writes a .hxm Hexaly Modeler script (loadable by the Hexaly CLI; round-trip via load_environment is not currently supported by Hexaly itself).
  • Solver introspection: state (Modeling/Running/Paused/Stopped), running_time, nb_iterations.
  • Pretty printers for Error.code, State.t, Status.t, Callback_type.t, Inconsistency.t.
  • Mock backend: auto-selected when Hexaly isn't installed; passes the full test suite (interval/list/set/math tests skip on mock).
  • Test suite: 23 alcotest tests covering core, regression, errors, scheduling, routing, math, introspection, callbacks, warm start, advanced params, environment, IIS.
  • Examples: knapsack (optimum 309), TSP via list-var (optimum 24), single-machine scheduling via interval-var + pairwise non-overlap (optimum makespan 15).
  • Benchmark: bench/build_million measures 1M-expression model build.
  • CI: GitHub Actions matrix on macOS + Linux × OCaml 4.14 / 5 (mock backend); odoc deployed to GitHub Pages.

Known limitations

  • No lambdaFunction / range / array(range, lambda, default); the Pythonic Hexaly TSP idiom isn't expressible; TSP example unrolls.
  • No HxExternalFunction (custom evaluation callbacks during search).
  • load_environment accepts a different format than save_environment produces (a Hexaly limitation, documented in the .mli).

Multi-objective phases (added post 0.1.0 scope)

  • Hexaly.Phase module bound: create, get, nb_phases, set_time_limit / time_limit, set_iteration_limit / iteration_limit, set_optimized_objective / optimized_objective, set_enabled / is_enabled, to_string / pp.
  • Lexicographic optimization demonstrated in examples/multi_objective.ml: bi-objective assignment finds cost-optimal 16, then balances load 3/3 across two workers.

Cross-platform build (added post 0.1.0 scope)

  • Replaced the POSIX bash configure.sh with src/config/discover.ml, a portable OCaml configurator using dune-configurator. The same source needs no shell. Tested on Linux and macOS; Windows untested.
  • Library auto-detection from $HEXALY_HOME, /opt/hexaly_*, /Library/hexaly_*, $HOME/hexaly_*, C:/hexaly_*, $ProgramFiles/hexaly_*.
  • Versioned soname discovery (e.g. libhexaly145.dylib → -lhexaly145) instead of hardcoding -lhexaly.