Declaring variables
How to declare variables?
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.
How to declare variables?
How to handle constraints?
Overview of constraints based on boolean and integer variables.
How to build and use expressions?
Overview of constraints based on set variables.
Overview of constraints based on graph variables.
How to declare constraints based on real variables?