====== - Extending Planning Domains with Fluents ====== This class covers usage of the PDDL 2.1 main feature --- so called ''fluents''. Student is expected to understand the new construct and use it to solve some popular logical puzzles. Due to the COVID-19 outbreak, all files related to this class are stored in the [[https://gitlab.com/agh-krr/2019-2020/labs-planning|Gitlab repository]]. This class uses files stored in the ''02_fluents'' folder. Please refer to the ''Readme.md'' on how to submit the solutions. ===== - Preliminaries ===== First attempts to model planning domains were based directly on the first order logic. One of the main disadvantages of this approach was that first order logic (as every monotonic logic) doesn't allow to change truth value of a sentence. In the same time planning domains are often very dynamic and conditions vary in time. You may have noticed that in both STRIPS and ADL some sentences change their truth values according to the taken actions. The predicate that can change it truth value is called [[https://en.wikipedia.org/wiki/Fluent_%28artificial_intelligence%29|a fluent]]. PDDL 2.1 extends this basic notion and introduces //fluents// as something similar to the mutable variables known from classical programming languages. It became possible to introduce functions that return values, which may vary in time. ===== - Tools ===== Please clone [[https://gitlab.com/agh-krr/2019-2020/labs-planning |repository with the PDDL 2.1 solver]]. The package includes also ''pddl'' files in the ''02_fluents'' directory, related to this class. Please run to terminal and switch to the root folder of the package and then try: ./ff -o ./02_fluents/01_hanoi/domain.pddl -f ./02_fluents/01_hanoi/problem.pddl Replace ''ff'' with appropriate one, e.g. ''ff-macos'' on macOS. In case, none of the binaries works for you, you can build the planner according to the instruction in the repo's ''README.md''. ===== - Example: Hanoi ===== The new solver supports some new statements. Please check the files: ''./lab2/hanoi/domain.pddl'' i ''./lab2/hanoi/problem.pddl''. The new things include: * ''(:requirements :fluents)'' --- informs solver that we want to use fluents * '':functions (...)'' --- enumerates all fluents used in the model * arithmetical conditions --- ''<'', ''>'', ''='', etc. * arithmetical expressions --- ''(+ arg1 arg2)'', ''(- ...)'', ''(* ...)'' , ''(/ ...)'' * expression that change fluents' values: ''(increase fluent newValue)'' (in C it would be ''fluent += wartość''), and others, i.e. * ''(decrease ...)'' --- the same as ''-='' in C * ''(assign ...)'' --- the same as ''='' in C * ''(:metric minimize fluent)'' --- informs solver what plans we find interesting / optimal. It should be provided, otherwise solver will complain. If you want to ignore it, run solver with ''-s 0'' option, i.e. ./ff -o ./02_fluents/01_hanoi/domain.pddl -f ./02_fluents/01_hanoi/problem.pddl -s 0 Analyze the hanoi example and use it as a reference for further problems. ===== - First Puzzle: Bruce Willis Has a Problem ===== {{ youtube>BVtQNK_ZUJg }} \\ Please watch fragment of the Die Hard 3 movie above. The puzzle depicted there belongs to a quite popular family of "water pouring'" puzzles. The ''./02_fluents/02_jugs'' folder contains a model of a [[http://www.riddleministry.com/riddles/water-puzzle-19-13-7/1246/|very similar problem]]. ==== Assignments ==== - Fill missing lines of the ''domain.pddl'', so you can solve ''problem.pddl'' in 16 steps. - Remodel the problem so it would use only one action - Modify the problem to include the fountain and help Bruce Willis! In PDDL 2.1 you can formulate conditional effect (the action will have this effect only if the additional condition is fulfilled): (when (additional_condition) (effect) ) ===== - Second Puzzle: Zombies on the Loose! ===== {{ youtube>7yDmGnA8Hw0 }} \\ Watch two first minutes of the movie above. ''./02_fluents/03_zombie-escape'' folder contains files related to this puzzle. Then check the assignments and save yourself! ==== Assignments ==== - Fill missing lines of the ''domain.pddl'', so you can solve ''problem.pddl'' - Remodel the problem so it would use only one action - Solve the similar [[http://www.learn4good.com/games/puzzle/boat.htm|problem of missionaries and cannibals]]