| 1 | ================================================================ |
|---|
| 2 | Logtalk - Open source object-oriented logic programming language |
|---|
| 3 | Release 2.35.0 |
|---|
| 4 | |
|---|
| 5 | Copyright (c) 1998-2009 Paulo Moura. All Rights Reserved. |
|---|
| 6 | Logtalk is free software. You can redistribute it and/or modify |
|---|
| 7 | it under the terms of the "Artistic License 2.0" as published by |
|---|
| 8 | The Perl Foundation. Consult the "LICENSE.txt" file for details. |
|---|
| 9 | ================================================================ |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | To load this example and for sample queries, please see the SCRIPT.txt file. |
|---|
| 13 | |
|---|
| 14 | You will also need to load the following files in the library directory: |
|---|
| 15 | dates_loader, types_loader, events_loader, metapredicates_loader, and |
|---|
| 16 | hierarchies_loader. Alternatively, you can just load the library all_loader |
|---|
| 17 | file. |
|---|
| 18 | |
|---|
| 19 | Some of the code in this folder is adapted, with permission, from the book |
|---|
| 20 | "Prolog Programming for Artificial Intelligence" by Ivan Bratko. |
|---|
| 21 | |
|---|
| 22 | For a description of the search problems, please see a classical AI book |
|---|
| 23 | (such as the one above) or visit the url <http://www.plastelina.net/games>. |
|---|
| 24 | |
|---|
| 25 | This example defines two hierarchies of objects, one for representing |
|---|
| 26 | state-spaces and another for representing search methods: |
|---|
| 27 | |
|---|
| 28 | state_space |
|---|
| 29 | farmer |
|---|
| 30 | water_jug |
|---|
| 31 | salt(Quantity, Measure1, Measure2) |
|---|
| 32 | heuristic_state_space |
|---|
| 33 | bridge |
|---|
| 34 | eight_puzzle |
|---|
| 35 | miss_cann |
|---|
| 36 | |
|---|
| 37 | search_strategy |
|---|
| 38 | blind_search(Bound) |
|---|
| 39 | breadth_first(Bound) |
|---|
| 40 | depth_first(Bound) |
|---|
| 41 | heuristic_search(Threshold) |
|---|
| 42 | best_first(Threshold) |
|---|
| 43 | hill_climbing(Threshold) |
|---|
| 44 | |
|---|
| 45 | Taken together, these two hierarchies implement a framework for solving |
|---|
| 46 | state-space search problems in Logtalk. There is also a monitor object, |
|---|
| 47 | "performance", which tries to measure the time taken to find a solution, |
|---|
| 48 | the branching factor while searching for a solution, and the number of |
|---|
| 49 | transitions made to find a solution. |
|---|