Modeling

What do you need to know to express a problem?

The Model

The object Model is the key component. It should be imported :

import org.chocosolver.solver.Model;
from pychoco import Model

Then, an instance of a model is built as follows:

Model model = new Model();
model = Model()

A name can be attached to an instance:

Model model = new Model("my problem");
model = 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 graph variables

Overview of constraints based on graph variables.

Constraints over real variables

How to declare constraints based on real variables?

Last modified October 2, 2023: start doc for python (a772569)