Constraint programming is a way of instructing computers, you enter rigorously defined problem, and then the compute uses built in algorithms to find the solution.

Variables: A unknown value that we want to find a solution for. Domain: A set of values that it’s possible for each variable to take. Constraint: Rules that relate variables together.

Its common for constraint programming languages have a pre-existing constraint function call “all_distinct(..)”, which requires that the variables passed in have to be distinct.

Constraint propagation: A information propagates from one variable to another via constraints. The objective is to discover if a variable must be some value from the domain and use the new information discovered to infers recursively more variables values.

In more complex problems is common that, at some point on the problem solving, that no variable can have their value determined and they have more than 1 possible final result. If it was a human doing some deduction is common to try have do have more increasingly sophisticated logical inferences, but computers can just be dumb and guess the solution. They randomly pick a possible solution for any open variable and try to continue to find the solution. If the solution is valid, all the variables have a valid outcome, it finished. If not, the algorithm does a backtrack where he did the guessing, removes the guessing value as a possible solution and try again.

Every time that the algorithm does a backtrack, it reduces the domain for at least one variable, so if there’s a solution, eventually will be terminating.

References

ïœĄïœ„:*:★,ïœĄïœ„:*:☆ ïœĄïœ„:*:★,ïœĄïœ„:*:☆ ïœĄïœ„:*:

Contact Info:Contact Info:

E-mail: pamabeltrani@gmail.com

Discord: pamnawi