120 likes | 244 Views
Introduction. ECLiPSe Components. Constraint Logic Programming system, consisting of A runtime core Data-driven computation, backtracking, garbage collection A collection of libraries Constraint propagators, search support, application support, development support
E N D
ECLiPSe Components Constraint Logic Programming system, consisting of • A runtime core • Data-driven computation, backtracking, garbage collection • A collection of libraries • Constraint propagators, search support, application support, development support • A modelling and control language • Logic programming • A development environment • Tkeclipse • Interfaces for embedding into host environments • Java, Tcl/Tk, C/C++ • Interfaces to third-party solvers • Xpress-MP, Cplex, COIN-OR IC-Parc
ECLiPSe Uses ECLiPSe is intended for • General programming tasks • especially rapid prototyping • Problem solving • using the CLP paradigm • using the available solver libraries • Development of new constraint solvers • employing ECLiPSe's lower-level language features • possibly based on the existing solvers IC-Parc
Xi Cj How Does It Work - The C(L)P Paradigm Efficient Algorithms Model Heuristics Search IC-Parc
Constraint (Logic) Programming Declarative Problem model Program = Logic + Control Control = Reasoning + Search Constraint propagation Clever algorithms Heuristics Problem specific knowledge IC-Parc
Why use Logic Programming and Prolog? • Predicates over logical variables • Constraints over mathematical variables • (unlike ‘variable’ = storage location as in imperative languages!) • Program = Logic + Control • Solution = Model + Solver • Symbolic manipulation and metaprogramming • Program/data interchangeability is good for implementing solvers, programming search, preprocessing constraints, etc • Built-in backtracking • A general default mechanism for handling disjunctions • A convenient primitive for programming more complex search IC-Parc
Constraint Program Template Algorithms deterministic efficiency :- lib(...). solve(Variables) :- setup_constraints(Variables), search(Variables). Model deterministic correctness Search nondeterministic choices & heuristics efficiency IC-Parc
Logic Programming for Modelling X1{1..9} • Variables • can have attributes • e.g. domain, type • Constraints • = predicates, involving 1 or more variables • Model • = setup program _ #> _ _ #\= _ X2{3..9} alldifferent([ _, _, _ ]) [X1,X2,X3,X4]::1..9, X1 #> X2, alldifferent([X2,X3,X4]), X1 #\= X4. X4{1..7} X3{5..9} IC-Parc
Logic Programming for Search • Binary choice ( X=0 ; X=1 ) • Enumerate ( X=1 ; X=2 ; X=3 ; X=4 ) X :: 1..4, indomain(X) • Split ( X #=< 5 ; X #> 5 ) • Heuristic choice ( X = Guess ; X #\= Guess ) IC-Parc
Related Languages • Formal specification languages (e.g. B, Z, VDM) • More expressive power than ECLiPSe, but not executable • Mathematical modelling languages (e.g. OPL, AMPL) • Similar to ECLiPSe, but usually limited expressive power • (e.g. fixed set of constraints) and limited control • Search languages (Salsa, ToOls) • For expressing search strategies, special-purpose • Mainstream programming languages (e.g. C++ with ILOG) • Variables and constraints are “aliens” in the language • Specification mixed up with procedural control • Other CLP/high-level languages (e.g. CHIP, SICStus, Oz) • Most similar to ECLiPSe. Less support for hybrid problem solving. • Harder to define new constraints IC-Parc
Components Covered in this Course • ECLiPSe Programming language • Constraint Solver Libraries • e.g. ic, eplex, ic_global, ic_sets, ic_symbolic, suspend • Search & Optimization Support Libraries • e.g. ic_search, branch_and_bound, repair • Constraint Building Support Libraries • e.g. propia, chr/ech • General Programming Support Libraries • e.g. lists, hash, … • Development Tools • e.g. tkeclipse, visualisation, coverage, profile, document IC-Parc
Constraint Solver Libraries IC-Parc