Modelling


Creation of a Model instance


Model is the central object in the Choco-solver library

  • Creating a model is the first essential step in declaring and solving a problem.
  • Variables are declared via the model
  • Constraints too

In fact, almost anything can be done via a Model instance$^1$.

$1$: So you don’t have to know all the objects in advance.


Several builders

Model m = new Model();								 							 // 1
Model m = new Model(String name);					 					 // 2
Model m = new Model(settings settings);				 			 // 3
Model m = new Model(String name, Settings settings); // 4

Prefer choices 1 and 2 to start with.


package apetizer;



public class Example{

    public static void main(String[] args){

    }
}

package apetizer;

import org.chocosolver.solver.Model;

public class Example{

    public static void main(String[] args){
        Model myModel = new Model("My first model");
    }
}