Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1efde40e73
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 23 lines (18 sloc) 0.619 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

:- object(a_star_interpreter(_W),
imports(best_first)).

:- info([
version is 1.0,
author is 'Victor Lagerkvist',
date is 2010/06/13,
comment is 'A* interpreter for general logic programs. The parameter W is used to fine tune the behaviour. W = 0 gives us a breadth-first search and W = 1 gives us a greedy best-first search. The default value for W is 0.5.',
parnames is ['W']]).

f(Length1, Length2, Depth, Cost) :-
parameter(1, W),
( var(W) ->
% use a default value
W = 0.5
; % use parameter value
true
),
Cost is Depth * (1 - W) + (Length1 + Length2 - 1) * W.

:- end_object.
Something went wrong with that request. Please try again.