A User's Guide to gringo, clasp, clingo, and iclingo
A User's Guide to gringo, clasp, clingo, and iclingo
A User's Guide to gringo, clasp, clingo, and iclingo
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Contents<br />
1 Introduction 4<br />
2 Quickstart 6<br />
2.1 Problem Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />
2.2 Problem Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . 7<br />
2.3 Problem Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
3 Input Languages 9<br />
3.1 Input Language of <strong>gringo</strong> <strong>and</strong> <strong>clingo</strong> . . . . . . . . . . . . . . . 9<br />
3.1.1 Normal Programs <strong>and</strong> Integrity Constraints . . . . . . . . . . 9<br />
3.1.2 Classical Negation . . . . . . . . . . . . . . . . . . . . . . . 11<br />
3.1.3 Disjunction . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
3.1.4 Built-In Arithmetic Functions . . . . . . . . . . . . . . . . . 12<br />
3.1.5 Built-In Comparison Predicates . . . . . . . . . . . . . . . . 13<br />
3.1.6 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
3.1.7 Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
3.1.8 Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 16<br />
3.1.9 Pooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
3.1.10 Aggregates . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />
3.1.11 Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . 22<br />
3.1.12 Meta-Statements . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
3.1.13 Integrated Scripting Language . . . . . . . . . . . . . . . . . 26<br />
3.2 Input Language of i<strong>clingo</strong> . . . . . . . . . . . . . . . . . . . . . . 29<br />
3.3 Input Language of <strong>clasp</strong> . . . . . . . . . . . . . . . . . . . . . . . 31<br />
4 Examples 32<br />
4.1 N-Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
4.1.1 Problem Instance . . . . . . . . . . . . . . . . . . . . . . . . 32<br />
4.1.2 Problem Encoding . . . . . . . . . . . . . . . . . . . . . . . 33<br />
4.1.3 Problem Solution . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
4.2 Traveling Salesperson . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />
4.2.1 Problem Instance . . . . . . . . . . . . . . . . . . . . . . . . 34<br />
4.2.2 Problem Encoding . . . . . . . . . . . . . . . . . . . . . . . 35<br />
4.2.3 Problem Solution . . . . . . . . . . . . . . . . . . . . . . . . 36<br />
4.3 Blocks-World Planning . . . . . . . . . . . . . . . . . . . . . . . . . 37<br />
4.3.1 Problem Instance . . . . . . . . . . . . . . . . . . . . . . . . 37<br />
4.3.2 Problem Encoding . . . . . . . . . . . . . . . . . . . . . . . 38<br />
4.3.3 Problem Solution . . . . . . . . . . . . . . . . . . . . . . . . 39<br />
5 Comm<strong>and</strong> Line Options 40<br />
5.1 <strong>gringo</strong> Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40<br />
5.2 <strong>clingo</strong> Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41<br />
5.3 i<strong>clingo</strong> Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 42<br />
5.4 <strong>clasp</strong> Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43<br />
5.4.1 General Options . . . . . . . . . . . . . . . . . . . . . . . . 43<br />
5.4.2 Search Options . . . . . . . . . . . . . . . . . . . . . . . . . 45<br />
5.4.3 Lookback Options . . . . . . . . . . . . . . . . . . . . . . . 46<br />
2