Constraint programming
https://www.coursera.org/learn/discrete-optimization
General introduction
Constraint programming is an optimization technique that emerged from the field of artificial intelligence. It is characterized by two key ideas: To express the optimization problem at a high level to reveal its structure and to use constraints to reduce the search space by removing, from the variable domains, values that cannot appear in solutions.
Computation paradigm:
- Use constraint to reduce the set of values that each variable can take.
- Make a choice when no deduction can be performed. (assign a value to a variable)
- Choices can be wrong. Then the solver backtracks, tries another value.
Branch and prune:
Branch: decompose the problem into subproblem and explore the subproblems. (try all possible values of a variable until a solution is found or it can be proved that no solution exists.)
Prune: reduce the search space as much as possible. Use constraints to remove, from the variable domains, value that cannot belong to any solution.
A constraint just does two things:
- Feasibility checking. A constraint checks if it can be satisfied given the values in the domains of its variables.
- Pruning. If satisfiable, a constraint determines which values in the domains cannot be part of any solution.
The propagation engine(pseudocode)
def propagate ()
repeat until no constraint can remove any value from the domain of its variable
select a constraint c
if c is infeasible
return False
else
prune ()
return True
global constraint:
Sometimes if you take the constraints one by one to check feasibility, it will lose some information. Because the constraints are not independent, so global constraint help you to consider all the constraints at the same time and make it earlier to prune the infeasibility.
Optimize:
Impose a constraint that the next solution must be better.
Symmetric breaking constraint:
-impose an ordering on the variables
-impose a lexicographic constraint
Redundant constraint:
Motivation: they do not exclude any solution, but they reduce the search space. They express the properties not captured by the model.
-boost the propagation of other constraints
-provide a more global view
-combine existing constraint
Dual modeling:
Sometimes there are multiple ways to modeling the problem. And the two models may have complementary strengths. Some constraints are easier to express in one model and other in another one. Dual modeling is the idea of stating multiple models of a problem and linking them with constraints.
First-fail principle
Try first where you are most likely to fail. Do not spend time doing easy stuff first and avoid redoing the difficult part.
Variable-value labeling:
- Choose the variable to assign
- Choose the value to assign
-first fail principle: choose the variable with smallest domain
-reconsider the selection of the variable after each choice(the variable ordering is dynamic)
-value ordering: often choose a value that leaves as many options as possible to the other variables
Value-variable labeling:
- Choose the value to assign
- Choose the variable to assign
-you may know that value must be assigned
-often the case in scheduling and resource allocation problems
Domain splitting
Sometimes assign a value to a variable is too strong(too arbitrary). so, we can split the domain of the value into two parts and decide which part should we choose. It is a much weaker commitment.
Randomization and restarts
Sometimes it is not obvious ordering. The key idea of randomization is to try a random ordering and if no solution is found after some limit(e.g. limit searching time), restart the search.
来源:CSDN
作者:louislin_buaa
链接:https://blog.csdn.net/louislin_buaa/article/details/104194380