chocoteam / choco-solver

An open-source Java library for Constraint Programming
http://choco-solver.org/
BSD 4-Clause "Original" or "Old" License
684 stars 137 forks source link

Docs: Table constraints #688

Closed thetric closed 4 years ago

thetric commented 4 years ago

Expected behavior

The user guide should provide a description and an example on how to define table constraints (model.table()).

A notebook example mentions table constraints in context of expressions. It would be nice if the user guide showed an equivalent solution using expressions.

Actual behavior

The user guide doesn't even mention table constraints.

Possible Solution

Steps to Reproduce (for bugs)

Context

I searched for a way to create table constraints.

Environment

cprudhom commented 4 years ago

I added a tutorial for the TSP, wherein I use table constraints to get distances between cities. Have a look, and tell if that helps (I know, I should update the documentation too...)

https://choco-solver.org/tutos/traveling-salesman-problem/

Best, CP

thetric commented 4 years ago

Thank you for the link! The tutorial describes element constraints as a substitution for table constraints. Is there a rule of thumbs when to choose which?

cprudhom commented 4 years ago

This is true because the table constraint here is very specific (2-dimension, one variable is an index, etc). When an element constraint is needed, a table constraint can be considered, the opposite is not always true. For instance, consider a table constraints over 4 variables, the element constraint will introduce additional variables.

cprudhom commented 4 years ago

https://choco-solver.org/docs/modeling/intconstraints/#table-constraints If you have any comments, let me know

thetric commented 4 years ago

Thank you for the docs update!