Using Huub from MiniZinc
For many users, the easiest way to use Huub is through MiniZinc. In this workflow, MiniZinc is used as the modelling language and Huub is used as the backend solver. You write a MiniZinc model, MiniZinc compiles it with given instance data, and MiniZinc instructs Huub to solve it.
This chapter has two purposes. First, it explains how to install Huub as a MiniZinc solver. Second, it introduces the Huub-specific functionality that is exposed through the MiniZinc library shipped with Huub.
Installing Huub as a MiniZinc solver
Huub releases contain both the solver executable and the MiniZinc integration files needed to make Huub available to MiniZinc. In particular, the release archive contains a MiniZinc solver configuration and the Huub MiniZinc library files.
To install Huub as a MiniZinc solver, perform the following steps.
- Download a Huub release for your platform from the GitHub releases page.
- Extract the archive to a suitable location on your system. The structure of the archive follows the conventional Unix directory layout.
- Ensure the
share/minizinc/solvers/directory from the extracted archive is on the standard solver path or add it to theMZN_SOLVER_PATHenvironment variable. - Verify the installation by running
minizinc --solvers.
If the installation was successful, Huub should appear in the list of available solvers.
It should then also be available from the MiniZinc IDE.
Once this is configured, Huub can be selected in the same way as any other MiniZinc solver. For example, from the command line a model can be solved using the following command.
minizinc --solver huub model.mzn data.dzn
You can use the following command to inspect the available command line flags for Huub.
huub --help
Alternatively, you can inspect them through MiniZinc as follows.
minizinc --help huub
Huub-specific MiniZinc functionality
In the Huub MiniZinc library, used to compile MiniZinc instances to Huub specific FlatZinc, we include an additional user-facing huub.mzn file.
This file contains the MiniZinc definitions to expose Huub-specific functionality in models.
When selecting the Huub solver and using the Huub solver configuration file, the huub.mzn library file can be included simply as follows.
include "huub.mzn";
% [Huub-specific usage]
We will now outline the different exposed functionality.
Circuit propagation
The Huub MiniZinc library contains two annotations that let a model request particular propagation algorithms for the circuit and subcircuit constraints.
The annotations are:
circuit_no_cyclerequests the no-cycle propagation, which follows the chains of successors that are already fixed and forbids the edge that would close such a chain into a cycle that does not cover the whole constraint. This algorithm is enabled by default.circuit_sccrequests the strongly-connected-component propagation, which reasons about the connectivity of the graph of remaining successor edges. It is stronger than the no-cycle propagation, but also considerably more expensive. This algorithm is disabled by default. Whenever either of the annotations is present on acircuitorsubcircuitconstraint, it overrides the default enabled propagation methods, disabling any other propagation methods that would be enabled by default. As with thedisjunctiveannotations, these are best thought of as tuning mechanisms rather than annotations to add to every constraint.
Note that disabling both algorithms would leave the constraint unenforced during the search, so Huub re-enables the no-cycle propagation and reports a warning when it is asked to disable both.
Cumulative propagation
The Huub MiniZinc library contains three annotations that let a model request particular propagation algorithms for the cumulative constraint, on top of the time-table propagation that is always used.
The annotations are:
cumulative_energy_overloadrequests the time-table-edge-finding energy overload check, which detects time windows in which the tasks require more of the resource than it can supply. It has an effect only whencumulative_edge_findingis not requested, since the bounds filtering already reports those overloads.cumulative_edge_findingrequests time-table-edge-finding bounds filtering, which additionally tightens the start times of the tasks that cannot fit in such a window.cumulative_opportunistic_edge_findingextends that filtering with the opportunistic extended-edge-finding rules, which are stronger but more expensive. It has an effect only alongsidecumulative_edge_finding. All three algorithms are enabled by default, the configuration that solves the most instances of the MiniZinc benchmark suite. As fordisjunctive, the presence of any of the annotations on acumulativeconstraint overrides the defaults, disabling any propagation method that is not requested.
Disjunctive Propagation
The Huub MiniZinc library contains three annotations that let a model request particular propagation algorithms for the disjunctive constraint.
They allow the users to choose which propagation techniques should be enabled for that constraint.
The annotations are:
disjunctive_edge_findingrequests edge-finding propagation.disjunctive_not_lastrequests not-last propagation.disjunctive_detectable_precedencerequests detectable-precedence propagation. Whenever any of the annotations is present on thedisjunctiveconstraint, it overrides the default enabled propagation methods, disabling any other propagation methods that would be enabled by default. This is best thought of as tuning mechanisms rather than adding these annotations for eachdisjunctiveconstraint.