Download presentation
Presentation is loading. Please wait.
Published byAllison Norris Modified over 7 years ago
1
Chapter 2: Simplification, Optimization and Implication
Where we learn more fun things we can do with constraints. CSC Simplification, Optimization and Implication
2
CSC5240 - Simplification, Optimization and Implication
Chapter Overview Constraint Simplification Projection Constraint Simplifiers Optimization Implication and Equivalence CSC Simplification, Optimization and Implication
3
Constraint Simplification - 1
Simplification: a transformation to make information implicit in the original system becomes apparent Projection: a form of simplification to express a constraint only in terms of the variables that are of interest Difficult and expensive but needed for presenting answer constraints in a form understandable to the user CSC Simplification, Optimization and Implication
4
Constraint Simplification - 2
Two equivalent constraints represent the same information, but one may be “simpler” than the other Removing redundant constraints, rewriting a primitive constraint, changing order, substituting using an equation all preserve equivalence CSC Simplification, Optimization and Implication
5
Redundant Constraints - 1
One constraint C1 implies another C2 if the solutions of C1 are a subset of those of C2 C2 is said to be redundant wrt C1 It is written CSC Simplification, Optimization and Implication
6
Redundant Constraints - 2
We can remove a primitive constraint which is redundant with respect to the rest of the constraint C without changing C’s meaning This definitely produces a simpler constraint CSC Simplification, Optimization and Implication
7
CSC5240 - Simplification, Optimization and Implication
Solved Form Solvers - 1 Since a solved form (normalizing) solver creates equivalent constraints it can be a simplifier For example using the term constraint solver CSC Simplification, Optimization and Implication
8
CSC5240 - Simplification, Optimization and Implication
Solved Form Solvers - 2 Or using the Gauss-Jordan solver CSC Simplification, Optimization and Implication
9
CSC5240 - Simplification, Optimization and Implication
Projection - 1 It becomes even more important to simplify when we are only interested in some variables in the constraint Simplified wrt to V and I CSC Simplification, Optimization and Implication
10
CSC5240 - Simplification, Optimization and Implication
Projection - 2 The projection of a constraint C onto a set of variables V is a constraint C1 such that Every solution of C is a solution of C1 A solution of C1 can be extended (Defn 2.2) to give a solution of C CSC Simplification, Optimization and Implication
11
CSC5240 - Simplification, Optimization and Implication
Fouriers Algorithm Eliminates variable y from linear ineqs in C Write each ineq with y on one side of ineq For each pair produce a new ineq The result is all new ineqs and those ineqs in C which do not involve y CSC Simplification, Optimization and Implication
12
Fouriers Algorithm Example
Projecting out Y Result only involving X CSC Simplification, Optimization and Implication
13
Projecting Boolean Constraints
Any Boolean constraint C is equivalent to (x Cx) (x Cx) Cx: C with all occurrences of x replaced by 1 Cx: C with all occurrences of x replaced by 0 The projection of C onto vars(C){x} is just Cx Cx CSC Simplification, Optimization and Implication
14
Projecting Term Constraints
We can also project term constraints For example projected onto {X,Z} is But what is X = cons(Y,Z) projected onto X? Answer: there is no such constraint! Must generalize to allow simplification to contain extra “local” variables CSC Simplification, Optimization and Implication
15
Constraint Simplifiers
Constraints C1 and C2 are equivalent wrt a set of variables V if taking any solution of one and restricting it to the variables in V, the restricted solution can be extended to be a solution of the other E.g. X=succ(Y) and X=succ(Z) wrt {X} CSC Simplification, Optimization and Implication
16
Simplifier Definition
A constraint simplifier is a function simpl which takes a constraint C and a set of variables V, and returns a constraint C1 that is equivalent to C wrt V We can construct a simplifier for real inequalities from the Fouriers algorithm CSC Simplification, Optimization and Implication
17
Tree Constraint Simplifier
apply the term solver to C obtaining C1 if C1 is false then return false foreach equation x=t in C1 if x is in V then if t is a variable not in V then substitute x for t throughout C1 and result else add x=t to result return result CSC Simplification, Optimization and Implication
18
Tree Simplification Example - 1
Tree constraint to be simplified wrt {Y,T} Equivalent constraint from tree solver Discard the first two equations, keep the third and use the last to substitute for U by T CSC Simplification, Optimization and Implication
19
Tree Simplification Example - 2
In this example, the simplifier has managed to return the projection of the original constraint onto the variables of interest Finding exact projection is not always possible, unfortunately The answer will sometimes contain extra “local” variables Try X = succ(Y) CSC Simplification, Optimization and Implication
20
Simplifier Properties - 1
Difficult to quantify what “simple” means since there is tradeoff between different notions of simplicity In some cases, the result of a simplifier may not even appear simpler to a human Individuals may argue which of many textual forms of a constraint is the simplest, but there are some guiding principles CSC Simplification, Optimization and Implication
21
Simplifier Properties - 2
Desirable properties of a simplifier are: projecting: weakly projecting: for all constraints C2 that are equivalent to C1 wrt V a weakly projecting simplifier never uses more variables than is required Both properties allow a simplifier to be used as a solver (how?) CSC Simplification, Optimization and Implication
22
CSC5240 - Simplification, Optimization and Implication
Often given some problem which is modelled by constraints we don’t want just any solution, but a “best” solution This is an optimization problem We need an objective function, a mapping from solutions to reals, so that we can rank solutions By convention, we always try to minimize CSC Simplification, Optimization and Implication
23
CSC5240 - Simplification, Optimization and Implication
An optimization problem (C,f) consists of a constraint C and objective function f A valuation v1 is preferred to valuation v2 if f(v1) < f(v2) An optimal solution is a solution of C such that no other solution of C is preferred to it Optimization problems may have more than one optimal solution CSC Simplification, Optimization and Implication
24
CSC5240 - Simplification, Optimization and Implication
Optimization Example An optimization problem Find the closest point to the origin satisfying C. Some solutions and f values Optimal solution CSC Simplification, Optimization and Implication
25
Optimization Peculiarities
Some optimization problems have no solution. Constraint has no solution For any solution, there is a more preferable one. In other words, problem has no optimum. Can you give an example? CSC Simplification, Optimization and Implication
26
Optimization as Simplification
Optimization is closely related to simplification Project the constraint onto the variable that we want to optimize Conjoin the projected constraint with the original constraint to compute an optimal solution to the original constraint Very expensive in general CSC Simplification, Optimization and Implication
27
The Simplex Algorithm - 1
The most widely used optimization algorithm Optimizes a linear function wrt to linear constraints Related to Gauss-Jordan elimination Based on the following observations Linear constraints form convex polygons Optimal solution always occur at a vertex CSC Simplification, Optimization and Implication
28
CSC5240 - Simplification, Optimization and Implication
The Simplex Form An optimization problem (C, f) is in simplex form: C is the conjunction of CE and CI CE is a conjunction of linear equations CI constrains all variables in C to be non-negative f is a linear expression over variables in C CSC Simplification, Optimization and Implication
29
CSC5240 - Simplification, Optimization and Implication
Simplex Form Example An optimization problem in simplex form An arbitrary problem can be put in simplex form by replacing unconstrained var X by new vars and inequality by new vars and CSC Simplification, Optimization and Implication
30
CSC5240 - Simplification, Optimization and Implication
Simplex Solved Form - 1 The simplex method works by repeatedly transforming an optimization problem in “basic feasible solved form” and to another A simplex optimization problem is in basic feasible solved (bfs) form if: The equations are in solved form Each constant on the right hand side is non-negative Only parameters occur in the objective CSC Simplification, Optimization and Implication
31
CSC5240 - Simplification, Optimization and Implication
Simplex Solved Form - 2 Every problem in bfs form has a corresponding “basic feasible solution” which corresponds to a vertex of the polygon defined by the constraint A basic feasible solution is obtained by setting each parameter to 0 and each non-parameter to the constant in its equation CSC Simplification, Optimization and Implication
32
Simplex Solved Form Example
An equivalent problem to the previous example in the bfs form We can read off a solution and its objective value CSC Simplification, Optimization and Implication
33
The Simplex Algorithm - 2
The simplex algorithm finds the optimum by repeatedly looking for an “adjacent” basic feasible solved form whose basic feasible solution decreases the value of the objective function until no such neighbour can be found By adjacent, we mean that the new bfs form can be reached by a single “pivoting” operation CSC Simplification, Optimization and Implication
34
The Simplex Algorithm - 3
starting from a problem in bfs form repeat Choose a variable y with negative coefficient in the obj. func. Find the equation x = b + cy where c<0 and -b/c is minimal Rewrite this equation with y being the subject y = -b/c + 1/c x + ... Substitute -b/c + 1/c x for y in all other eqns and obj. func. until no such variable y exists or no such equation exists if no such y exists then optimum is found else there is no optimum solution CSC Simplification, Optimization and Implication
35
CSC5240 - Simplification, Optimization and Implication
Simplex Example Choose variable Z, the 2nd eqn is only one with neg. coeff Choose variable Y, the first eqn is only one with neg. coeff No variable can be chosen, optimal value 2 is found CSC Simplification, Optimization and Implication
36
Another Simplex Example - 1
An equivalent simplex form is: An optimization problem showing contours of the objective function CSC Simplification, Optimization and Implication
37
Another Simplex Example - 2
Basic feasible solved form: circle Choose S3, replace using 2nd eq Optimal solution: box CSC Simplification, Optimization and Implication
38
CSC5240 - Simplification, Optimization and Implication
The Missing Part - 1 How do we get the initial bfs form and its basic feasible solution? Solve a different simplex problem Add artificial variables to make equations in basic feasible solved form Minimize the sum of the artificial variables If the sum is zero, we can construct a bfs form for the original problem CSC Simplification, Optimization and Implication
39
The Missing Part Example - 1
Original simplex form equations With artificial vars in bfs form: Objective function rewritten: minimize CSC Simplification, Optimization and Implication
40
The Missing Part Example - 2
Problem after minimization of objective function Removing the artificial variables, the original problem is equivalent to CSC Simplification, Optimization and Implication
41
CSC5240 - Simplification, Optimization and Implication
The Missing Part - 2 Must remember to eliminate the basic variables of the resultant bfs form from the original objective function Finding a bfs form of the original constraint is exactly a constraint satisfaction problem, and thus the first phase of the simplex method is an efficient constraint solver for linear inequalities CSC Simplification, Optimization and Implication
42
Canonical Form Simplifiers - 1
A simplifier simpl is a canonical form simplifier if whenever C1 and C2 are equivalent wrt to V The canonical form of a constraint C is CSC Simplification, Optimization and Implication
43
Canonical Form Simplifiers - 2
Canonical form simplifiers are useful in determining if two constraints are equivalent since such simplifiers will simplify equivalent constraints to exactly the same syntactical form Must take variable names into account May have to do systematic variable renaming CSC Simplification, Optimization and Implication
44
Implication and Equivalence - 1
Other important operations involving constraints are implication and equivalence tests implication: test if C1 implies C2 impl(C1, C2) answers true, false or unknown whether C1 has solutions which are a subset of the solutions of C2 CSC Simplification, Optimization and Implication
45
Implication and Equivalence - 2
An arbitrary implication test can be simplified to a sequence of implication tests If C2 is , then if and only if for each i = 1,…,n equivalence: test if C1 and C2 are equivalent equiv(C1, C2) answers true, false or unknown whether C1 and C2 have exactly the same set of solutions CSC Simplification, Optimization and Implication
46
CSC5240 - Simplification, Optimization and Implication
Implication Example For the house constraints CH, will stage B have to be reached after stage C? For this question the answer is false, but if we require the house to be finished in 15 days the answer is true CSC Simplification, Optimization and Implication
47
Implication and Equivalence - 3
We can use impl to define equiv and vice versa We can use a solver to do simple impl tests e.g. CSC Simplification, Optimization and Implication
48
CSC5240 - Simplification, Optimization and Implication
Chapter Summary Equivalent constraints can be written in many forms, hence we desire simplification Particularly if we are only interested in the interaction of some of the variables Many problems desire a optimal solution, there are algorithms (simplex) to find them We may also be interested in asking questions involving implication CSC Simplification, Optimization and Implication
49
CSC5240 - Simplification, Optimization and Implication
Homework Read the entire Chapter 2 of the textbook, including Section 2.11 (very useful) The following would take at most 2 hours Exercises: 2.1, 2.3, 2.5 Practical exercises: 2.1, 2.2, 2.3, 2.4 CSC Simplification, Optimization and Implication
50
CSC5240 - Simplification, Optimization and Implication
Acknowledgement With the consent of Peter Stuckey, I have shamelessly adopted and adapted a number of slides produced by him for use in this presentation I am solely responsible, however, for any errors therein CSC Simplification, Optimization and Implication
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.