CONSTRAINTS CHIP COPS ILOG Exhaustive Search TopP where
- Slides: 69
约束语言 CONSTRAINTS CHIP COPS ILOG 史忠植 高级人 智能
穷尽搜索方法 即产生所有可能的树,然后根据评价标 准选择一棵最优的树。 Exhaustive Search Top(P) {where P is a CSP of the form(V, D, C)} 1. f: = the null assignment 2. return Exhaustive Search(f, P) 史忠植 高级人 智能
穷尽搜索方法 Exhaustive Search(f, P) 1. if f is a total assignment of the variables in P 2. if f satisfies the constraints in P 3. answer : = f 4. else 5. answer : = Unsat 6. else 7. v : = some variable in P that is not yet assigned a value by f 8. answer : = Unsat 9. for each value while answer = Unsat 10. f(v) : = 11. answer : = Exhaustive Search(f, P) 史忠植 高级人 智能 12. return answer
Backtracking Algorithm • Based on depth first recursive search • Approach 1. Tests whether solution has been found 2. If found solution, return it 3. Else for each choice that can be made a) Make that choice b) Recur c) If recursion returns a solution, return it 4. If no choices remain, return failure 史忠植 高级人 智能 • Some times called “search tree”
Solution to 8 Queens Puzzle 史忠植 高级人 智能
4 Queens Puzzle 2/20/2021 史忠植 高级人 智能 31
回溯算法 Backtracking Top(P) 1 f : = the null assignment 2 return Backtracking(f, P) 史忠植 高级人 智能
回溯算法 Backtracking(f, P) 1 if f is a total assignment of the variables in P 2 answer : = f 3 else 4 v : = some variable in P that is not yet assigned a value by f 5 answer : = Unsat 6 for each value while answer = Umsat 7 f(v) : = x 8 if f satisfies the constraints in P 9 answer : = Backtracking(f, P) 10 return answer 史忠植 高级人 智能
3. 3 约束传播 CONSTRAINT PROPAGATION 弧一致性 Arc consistency 史忠植 高级人 智能
3. 3 CONSTRAINT PROPAGATION All of the Mackworth algorithms make use of a Revise procedure. Let Dv be the current domain of v, Let Dw be the current domain of w, Let P be the constraint predicate that holds between v and w, then Revise updates Dv as follows: 史忠植 高级人 智能
CONSTRAINT PROPAGATION Mackworth 1977 AC-1 AC-2 AC-3 史忠植 高级人 智能
约束传播修改算法 REVISE(Vi, Vj) 1 DELETE false; 2 for each x Di do 3 if there is no such yj Dj 4 such that(x, yj) is consistent, 5 then 6 delete x from Di; 7 DELETE true; 8 endif 9 endfor 10 return DELETE; 史忠植 高级人 智能 11 end REVISE
AC-1 1 Q ; 2 repeat 3 CHANGE false; 4 for each (Vi, Vj) Q do 5 CHANGE REVISE(Vi, Vj) CHANGE; 6 endfor; 7 until not(CHANGE); 8 end AC 1 史忠植 高级人 智能
AC-3 1 Q ; 2 While Q not empty 3 Select and delete any arc(Vk, Vm) from Q; 4 If (REVISE(Vk, Vm)) 5 Then Q {(Vi, Vk) such that (Vi, Vk) arcs(G), 6 i k, i m}; 6 endfor; 7 endwhile; 8 end AC 3 史忠植 高级人 智能
Backjumping Top(P) 1 f : = the null assignment 2 <answer, conflict set> : = Backjumping(f, P) 3 return answer 史忠植 高级人 智能
Backjumping(f, P) 1 if f is a total assignment of the variables in P 2 answer : = <f, > 3 else 4 v : = some variable in P that is not yet assigned a value by f 5 answer : = Unsat 6 conflict set : = 7 for each value 8 f(v) : = x 9 if f satisfies the constraints in P 史忠植 高级人 智能 10 <answer, new conflicts> : = Backjumping(f, P)
Backjumping 11 else 12 new conflicts : = the set of variables in a violated constraint 13 if answer Unsat 14 return <answer, > 15 else if v new conflicts 16 return <Unsat, new conflicts> 17 else 18 conflict set : = conflict set (new conflicts {v}) 19 return <Unsat, conflict set> 史忠植 高级人 智能
COPS Constraint : predicate expression P(t 1, . . . , tn) where P is built in function, such as sum times eq(equal) neq(not equal) ge(great than or equal to) gt(great than) also can be defined by users 史忠植 高级人 智能
COPS Conditional constraint condition 1: constraint 1; . conditionn: constraintn where condition 1, . . . , conditionn are boolean expressions. constraint 1, . . . constraintn are constraints or contraints table. 史忠植 高级人 智能
COPS RULE Rule is used to define new function, method, predicate, or add new constraint into object. RULE [class: : ] predicate(varibles) (boolean expression) { constraint_1; constraint_n; CASE boolean expression_1: constraint_1; 史忠植 高级人 智能 boolean expression_m: constraint_m;
COPS For example: RULE multiple(INTEGER: *x, INTEGER: y, INTEGER: z) (neq(y, 0)) { equal(x, divide(z, y)); } z = x * y 史忠植 高级人 智能
COPS CLASS [class_name][: superclass_name] { // attributes definition date type: attribute_name; . . . // rule definition rule_name; � . . . //function definition function_name; . . . // method definition method_name; . . . 史忠植 高级人 智能
COPS Implementation Program written by COPS consists of classes and rules. COPS constraint programming language is a declarative language, providing classes, methods which are exist in object oriented language. It is similar with C++. COPS has the features: constraint object oriented logic programming production system 史忠植 高级人 智能
COPS COPS_Compiler 1 { 2 Call yacc to parse the program and 3 to generate internal structures. 4 Initializatiion 5 Create Cops Constant true. Node; 6 Allocate memories for global variables. 史忠植 高级人 智能
COPS 7 Interprte the program with the internal structures. 8 Constraint networks are built up for Unsolved 9 constraints and variables. 10 while some constraints in the constraint networks are triggered, 11 inteprete the triggered constraints. 12 } 史忠植 高级人 智能
COPS Interpreter: 1 { 2 switch (constraint type) 3 case Constant: 4 return Constant: 5 case global variable: 6 interprete global variable: 7 case local variable or argument: 8 interprete local variable or argument: 9 case object attribute pair; 10 interprete object attribute pair: 史忠植 高级人 智能 11 case function call:
COPS 12 interprete function call: 13 case method call: 14 interprete method call: 15 case CASE expression: 16 interprete CASE expression: 17 . . . 18 default: 20 report error 21 } 史忠植 高级人 智能
ILOG SOLVER Combines object oriented programming with constraint logic programming, containing logic variables, incremental constraint satisfaction and backtracking. variables : C++ object integer variable Ct. Int. Var floating variable Ct. Float. Var boolean variable Ct. Bool. Var Memory Management new: 史忠植 高级人 智能 delete:
ILOG SOLVER Constraints Ct. Tell(x == (y + z)); Basic constraints: =, , , <, >, +, -, *, /, subset, superset, union, intersection, member, boolean or, boolean and, boolean not, boolean xor, Ct. Tell((x==0) || (y==0)); Ct. If. Then (x < 100, x = x+1); 史忠植 高级人 智能 Search
ILOG SOLVER CTGOALn: how to execute CTGOAL 1(Ct. Instantiate, Ct. Int. Var* x){ Ct. Int a = x->choose. Value(); Ct. Or(Constraint(x == a), Ct. And(Constraint(x != a), Ct. Instantiate(x))); } 史忠植 高级人 智能
ILOG Schedule 1. 0 Schedule Ct. Schedule class Global object: time original ---tine. Min time horizon ---time. Max 史忠植 高级人 智能
ILOG Schedule 1. 0 Resources Ct. Resource Ct. Discrete. Resource Ct. Unary. Resource Ct. Discrete. Energy Ct. State. Resource 史忠植 高级人 智能
ILOG Schedule 1. 0 Activities Ct. Activity class Ct. Interval. Activity An activity is defined by its start time, end time and duration Activities require, provide, consume and produce resources 史忠植 高级人 智能
Scheduling Problem Prices paid as tasks begin $1000 per day 史忠植 高级人 智能 Availability: Day 0: $20000, Day 15: +$9000
Constraints // To create a schedule with origin 0 and given horizon. Ct. Schedule* schedule = new Ct. Schedule(0, horizon); // To create an activity with the given duration. Ct. Interval. Activity* act = new Ct. Interval. Activity(schedule, duration); //To post a precedence constraint between act 1 and act 2 >starts. After. End(act 1, 0); 史忠植 高级人 智能
Constraints //To create a total budget of limited capacity (here 29000). Ct. Discrete. Resource* res = new Ct. Discrete. Resource(schedule, Ct. Required. Resource, capacity); // To state that only cap (here 20000) is available prior to a // given date (here 15). res >set. Capacity. Max(0, date, cap); // To state that an activity act consumes c units of res. act >consumes(res, c); 史忠植 高级人 智能
Algorithm Program Ct. Boolean Is. Un. Scheduled(Ct. Activity* act){ // Return true if act does not have a fixed start time. if (act >get. Start. Variable() >is. Bound()) return Ct. False; else return Ct. True; } 史忠植 高级人 智能
Algorithm Program Ct. Boolean Is. More. Urgent(Ct. Activity* act 1, Ct. Activity* act 2){ // Returns true if act 1 is more urgent than act 2. // Returns true if act 2 is unbound (==0) if (act 2 == 0) return Ct. True; else if (act 1 >get. Start. Max() < act 2 >get. Start. Max()) return Ct. True; else return Ct. False; } 史忠植 高级人 智能
Algorithm Program Ct. Activity* Select. Activity(Ct. Schedule* schedule){ // Returns the unscheduled activity with the smallest latest // statrt time. Returns 0 if all activities are scheduled. Ct. Activity* best. Activity = 0; //Creates an iterator to iterate on all activities. Ct. Activity. Iterator* iterator(schedule); Ct. Activity* new. Activity; while(iterator. next(newactivity)) if((Is. Un. Scheduled(new. Activity)) && (Is. More. Ugent(new. Activity, best. Activity))) bestactivity = new. Activity; return best. Activity; 史忠植 高级人 智能 }
Algorithm Program void Solve. Problem(Ct. Schedule* schedule){ // Solve the problem assuming constraints have been posted. Ct. Activity* act = Select. Activity(schedule); while (act !=0) { act >set. Start. Time(act >get. Start. Min()); act = Select. Activity(schedule); } } 史忠植 高级人 智能
Optimal Solution to the Scheduling Problem 史忠植 高级人 智能
- Exhaustive key search
- Difference between brute force and exhaustive search
- Exhaustive key search
- Wyoassessment
- Topp gene
- Ann sophie kimmel hot
- Methylation & chip-on-chip microarray platform
- Cops monitoring 10024 vanderbilt circle rockville md 20850
- Cops orton gillingham
- Cops monitoring 10024 vanderbilt circle rockville md 20850
- Cops coco the clown
- Webinar ilog cplex
- Anyong tubig halimbawa
- Ibm ilog opl
- Nakapagbibigay ng mga salitang magkatugma
- Ang terminong kabihasnan at sibilisasyon
- Webinar ilog cplex
- Mga likas na yaman ng asya
- Ilog jrules tutorial
- Perbedaan mutually exclusive dan collectively exhaustive
- Mutually exclusive collectively exhaustive
- Hofmann exhaustive methylation
- Collectively exhaustive
- Exhaustive statistics
- Http://eval.depp.taocloud.org
- Exhaustive events
- Exhaustive events
- Contoh collectively exhaustive
- Http://tw
- Images search yahoo
- Video.search.yahoo.com search video
- Local search vs global search
- Semantic search vs cognitive search
- Best first search
- Binary tree advantages and disadvantages
- Uninformed search algorithm
- Federated search vs distributed search
- Comparison of uninformed search strategies
- Blind search dan heuristic search
- Linear search vs binary search
- Federated search vs discovery
- What is informed search and uninformed search
- Http://search.yahoo.com/search?ei=utf-8
- Yahoo search video
- Gtt design process
- Logical constraints example in hci
- Biba n 445 ddl
- Lagranges equations of undetermined multiplier
- Quadruple constraints in project management
- Unitar united nations
- Marriages and families 8th edition
- Improperly constrained
- Non negativity constraints
- Synchronous manufacturing
- Conversational constraints theory
- Quadruple constraints in project management
- Sql integrity constraints
- Cost benefit constraint in accounting
- Specifications and constraints
- Shortest path linear programming
- Big m method minimization example
- Nx sketch constraints
- In a marketing decision constraints are
- Scleronomous constraints have
- Design process outline
- Drew rosen
- The theory of constraints
- Incremental life cycle
- What are biological constraints
- Theory of constraints