root/trunk/examples/searching/heuristic_search1.lgt

Revision 4601, 1.1 KB (checked in by pmoura, 7 weeks ago)

Added svn:mime-type property to source files (set to text/x-logtalk).

  • Property svn:mime-type set to text/x-logtalk
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- object(heuristic_search(_),
3    instantiates(class),
4    specializes(search_strategy)).
5
6    :- info([
7        version is 1.0,
8        author is 'Paulo Moura',
9        date is 1998/3/23,
10        comment is 'Heuristic state space search strategies.',
11        parnames is ['Threshold']]).
12
13    :- public(threshold/1).
14    :- mode(threshold(?number), one).
15    :- info(threshold/1,
16        [comment is 'Search cost threshold.',
17         argnames is ['Threshold']]).
18
19    :- public(solve/4).
20    :- mode(solve(+object, +nonvar, -list, -number), zero_or_more).
21    :- info(solve/4,
22        [comment is 'State space search solution.',
23         argnames is ['Space', 'State', 'Path', 'Cost']]).
24
25    :- protected(search/5).
26    :- mode(search(+object, +nonvar, +number, -list, -number), zero_or_more).
27    :- info(search/5,
28        [comment is 'State space search solution.',
29         argnames is ['Space', 'State', 'Threshold', 'Path', 'Cost']]).
30
31    solve(Space, State, Path) :-
32        ::solve(Space, State, Path, _).
33
34    solve(Space, State, Path, Cost) :-
35        ::threshold(Threshold),
36        ::search(Space, State, Threshold, Path, Cost).
37
38    threshold(Threshold) :-
39        parameter(1, Threshold).
40
41:- end_object.
Note: See TracBrowser for help on using the browser.