# Quick reference How to call the patched HiGHS, as a command or a library, and what it prints. ## Terminal ```bash # Build the highs command line, ./build/bin/highs (fetches and patches HiGHS v1.16.0) git clone https://github.com/spoorendonk/mip-heuristics && cd mip-heuristics cmake -B build -DCMAKE_BUILD_TYPE=Release cmake --build build -j$(nproc) # Install for Python: import mip_heuristics (compiles the patched HiGHS) pip install git+https://github.com/spoorendonk/mip-heuristics # Solve a file at the shipped defaults ./build/bin/highs model.mps # Set options in an options file: they are not command-line flags printf 'mip_heuristic_fj_effort = 0\n' > run.opts ./build/bin/highs --options_file run.opts model.mps # Trace the heuristics: [Heur] and [HeurSol] lines printf 'log_dev_level = 3\n' > trace.opts ./build/bin/highs --options_file trace.opts model.mps # Stop after the heuristics, before the root LP printf 'mip_heuristic_presolve_only = true\n' > presolve.opts ./build/bin/highs --options_file presolve.opts model.mps # HiGHS's own flags: time limit, seed, threads, solution file ./build/bin/highs --time_limit 60 --random_seed 1 --threads 8 --solution_file model.sol model.mps # The command line's flags ./build/bin/highs --help # Every option of the patch and its default (also the Options page) python -c "import mip_heuristics.options as o; print(o.heuristic_options())" ``` - **Output**: a patched binary prints `mip-heuristics patch active` as the third line of its log. At `log_dev_level = 3`, one `[Heur]` line per heuristic dispatch and one `[HeurSol]` line per point the heuristics' pool accepts, which need not become HiGHS's incumbent; early FJ logs plain lines. - **Exit status**: HiGHS's run status: `0` ok, `1` warning (a time, iteration or solution limit; on a MIP, `mip_heuristic_presolve_only` ends at the solution limit, or with `0` when presolve solves it), `255` error, such as an unknown option key, an unknown flag or a flag without its value. A flag value the parser rejects exits with the parser's own code. ## Python ```python import numpy as np from mip_heuristics import Highs from mip_heuristics.options import heuristic_options # Solve from arrays: min -x0 - 2 x1 s.t. x0 + x1 <= 3.5, x0 and x1 integer in [0, 3] cost, lo, up = np.array([-1.0, -2.0]), np.zeros(2), np.full(2, 3.0) row_lo, row_up = np.array([-np.inf]), np.array([3.5]) start, index, value = np.array([0, 1]), np.array([0, 0]), np.array([1.0, 1.0]) integer = np.array([1, 1]) h = Highs() # 2 columns, 1 row, 2 nonzeros, the matrix column-wise (1), minimize (1), offset 0 h.passModel( 2, 1, 2, 1, 1, 0.0, cost, lo, up, row_lo, row_up, start, index, value, integer ) h.run() print(h.getModelStatus(), h.getSolution().col_value) # Solve a file, any option: the patch's or HiGHS's h = Highs() h.setOptionValue("mip_heuristic_fj_effort", 0.0) h.readModel("model.mps") h.run() print(h.getModelStatus(), h.getInfo().objective_function_value) # Every option of the patch and its default print(heuristic_options()) ``` ## C++ Link the target `highs` this project builds: the [C++ reference](cpp.md#using-it-from-cmake) has the CMake lines, and the API of `mip_heuristics_core`, the heuristics without the solver. Reference: [C++](cpp.md); all the docs as text: , .