# C++ reference A caller of `highs` sets [options](options.md) and includes nothing of ours. The sections after *Using it from CMake* are for a caller of `mip_heuristics_core`, the heuristics without the solver: build the view with `make_problem`, receive what the workers find through a `SolutionSink`, and run one FJ or LocalMIP worker on a thread of your own with `run_until_stopped`. The contracts are in the headers' comments, which this page does not render: [`heuristic_context.h`](https://github.com/spoorendonk/mip-heuristics/blob/main/src/heuristic_context.h), [`solution_sink.h`](https://github.com/spoorendonk/mip-heuristics/blob/main/src/solution_sink.h), [`fj.h`](https://github.com/spoorendonk/mip-heuristics/blob/main/src/fj.h) and [`local_mip.h`](https://github.com/spoorendonk/mip-heuristics/blob/main/src/local_mip.h). ## Using it from CMake Build it inside your project and link `highs`, HiGHS v1.16.0 with the patch and the heuristics compiled in, static; `#include "Highs.h"` works as is: ```cmake include(FetchContent) FetchContent_Declare(mip_heuristics GIT_REPOSITORY https://github.com/spoorendonk/mip-heuristics.git GIT_TAG v0.1.12) FetchContent_MakeAvailable(mip_heuristics) target_link_libraries(my_solver PRIVATE highs) # the solver target_link_libraries(my_workers PRIVATE mip_heuristics_core) # the heuristics alone ``` - **Clone or submodule** in your source tree: `add_subdirectory(mip-heuristics)` replaces the `FetchContent` lines. - **First configure** clones and patches HiGHS: it needs network access. - **No `highs` of your own** (a `FetchContent` declaration or a target) before this one: FetchContent keeps the first declaration, without the patch. - **Nothing else registers**: no tests, lint or bench targets in your build; HiGHS's own extras (`highs-bin`, install rules) come along as upstream defines them. HiGHS's switches (`BUILD_TESTING`, `BUILD_SHARED_LIBS`, ...) are set in this project's scope only. - **Installed** (`cmake --install`): `highs::highs` and `highs::mip_heuristics_core` in HiGHS's `find_package(highs)` package; outside CMake, `pkg-config --static --libs highs`. - **HiGHS patches of your own**: [`MIP_HEURISTICS_EXTRA_HIGHS_PATCHES`](https://github.com/spoorendonk/mip-heuristics/blob/main/dev/development.md#as-a-subproject). ## The model view ```{doxygenfunction} make_problem ``` ```{doxygenstruct} ProblemView ``` ```{doxygenstruct} ProblemStorage ``` ```{doxygenstruct} ProblemError ``` ## Budget and execution ```{doxygenstruct} HeuristicBudget ``` ```{doxygenfunction} make_until_stopped_budget ``` ```{doxygenstruct} ExecutionContext ``` ```{doxygentypedef} RestartSource ``` ## Solutions ```{doxygenclass} SolutionSink ``` ```{doxygenfunction} make_solution_pool ``` ## Workers on your own threads ```{doxygenfunction} fj::run_until_stopped ``` ```{doxygenfunction} local_mip::run_until_stopped ```