Modeling

What do you need to know to express a problem?

The Model

The object Model is the key component. It is built as follows:

Model model = new Model();

or:

Model model = new Model("my problem");

Model is the top-level object that stores declared variables, posted constraints and gives access to the Solver.

This should be the first instruction, prior to any other modeling instructions, as it is needed to declare variables and constraints.

Once the model is created, variables and constraints can be defined.


Declaring variables

How to declare variables?

Handling constraints

How to handle constraints?

Constraints over integer variables

Overview of constraints based on boolean and integer variables.

Building expressions on integer variables

How to build and use expressions?

Constraints over set variables

Overview of constraints based on set variables.

Constraints over real variables

How to declare constraints based on real variables?