Logtalk 2.20.0 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1114 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -13,9 +13,6 @@
|
||||
source is 'Example adopted from the SICStus Objects documentation.']).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
|
||||
|
||||
move(X, Y) :-
|
||||
::check_bounds(x, X),
|
||||
::check_bounds(y, Y),
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -4,13 +4,14 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
date is 1998/3/23,
|
||||
version is 1.1,
|
||||
date is 2004/8/15,
|
||||
author is 'Paulo Moura',
|
||||
comment is 'Concentric polygons as a constrained binary relation.']).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
:- uses(list,
|
||||
[member/2, select/3]).
|
||||
|
||||
|
||||
descriptor_([x1, x2]).
|
||||
@@ -33,7 +34,7 @@
|
||||
|
||||
add_tuple([Polygon| Polygons]) :-
|
||||
Polygon::position(X, Y),
|
||||
forall(list::member(Polygon2, Polygons), {Polygon2::move(X, Y)}),
|
||||
forall(member(Polygon2, Polygons), {Polygon2::move(X, Y)}),
|
||||
^^add_tuple([Polygon| Polygons]).
|
||||
|
||||
|
||||
@@ -45,24 +46,24 @@
|
||||
|
||||
|
||||
propagate(after, move(X, Y), Polygon, _, Tuple) :-
|
||||
list::select(Polygon, Tuple, Polygons),
|
||||
select(Polygon, Tuple, Polygons),
|
||||
!,
|
||||
forall(
|
||||
(list::member(Polygon2, Polygons),\+ Polygon2::position(X, Y)),
|
||||
(member(Polygon2, Polygons),\+ Polygon2::position(X, Y)),
|
||||
{Polygon2::move(X, Y)}).
|
||||
|
||||
propagate(after, transX(X), Polygon, _, Tuple) :-
|
||||
list::select(Polygon, Tuple, Polygons),
|
||||
select(Polygon, Tuple, Polygons),
|
||||
!,
|
||||
forall(
|
||||
(list::member(Polygon2, Polygons), \+ Polygon2::position(X, _)),
|
||||
(member(Polygon2, Polygons), \+ Polygon2::position(X, _)),
|
||||
{Polygon2::transX(X)}).
|
||||
|
||||
propagate(after, transY(Y), Polygon, _, Tuple) :-
|
||||
list::select(Polygon, Tuple, Polygons),
|
||||
select(Polygon, Tuple, Polygons),
|
||||
!,
|
||||
forall(
|
||||
(list::member(Polygon2, Polygons), \+ Polygon2::position(_, Y)),
|
||||
(member(Polygon2, Polygons), \+ Polygon2::position(_, Y)),
|
||||
{Polygon2::transY(Y)}).
|
||||
|
||||
|
||||
|
@@ -11,9 +11,6 @@
|
||||
comment is 'Polygon predicates.']).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
|
||||
|
||||
:- public(move/2).
|
||||
:- mode(move(+integer, +integer), one).
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -3,14 +3,14 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.1,
|
||||
version is 1.2,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/6/30,
|
||||
date is 2004/8/15,
|
||||
comment is 'Call executing time profiler.']).
|
||||
|
||||
|
||||
:- uses(time).
|
||||
:- uses(loop).
|
||||
:- uses(time, [cpu_time/1]).
|
||||
:- uses(loop, [forto/3]).
|
||||
|
||||
|
||||
:- public(timer/2).
|
||||
@@ -34,19 +34,19 @@
|
||||
|
||||
|
||||
timer(Call, Time) :-
|
||||
time::cpu_time(Start),
|
||||
cpu_time(Start),
|
||||
(call(Call) -> true; true),
|
||||
time::cpu_time(End),
|
||||
cpu_time(End),
|
||||
Time is End - Start.
|
||||
|
||||
|
||||
timer(Call, Times, Time) :-
|
||||
time::cpu_time(Start),
|
||||
loop::forto(1, Times, Call),
|
||||
time::cpu_time(End),
|
||||
time::cpu_time(Start2),
|
||||
loop::forto(1, 0, true),
|
||||
time::cpu_time(End2),
|
||||
cpu_time(Start),
|
||||
forto(1, Times, Call),
|
||||
cpu_time(End),
|
||||
cpu_time(Start2),
|
||||
forto(1, 0, true),
|
||||
cpu_time(End2),
|
||||
Overhead is End2 - Start2,
|
||||
Time is (End - Start - Overhead) / Times.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -9,12 +9,12 @@ http://www.csci.csusb.edu/dick/cs320/prolog/Potions.htm
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
date is 2004/4/29,
|
||||
version is 1.1,
|
||||
date is 2004/8/15,
|
||||
author is 'Paulo Moura',
|
||||
comment is 'Harry Potter potions logical puzzle.']).
|
||||
|
||||
:- uses(list).
|
||||
:- uses(list, [select/3]).
|
||||
|
||||
:- public(potions/7).
|
||||
:- mode(potions(?atom, ?atom, ?atom, ?atom, ?atom, ?atom, ?atom), zero_or_one).
|
||||
@@ -27,17 +27,17 @@ http://www.csci.csusb.edu/dick/cs320/prolog/Potions.htm
|
||||
|
||||
potions(P1, P2, P3, P4, P5, P6, P7) :-
|
||||
contents(H1),
|
||||
list::select(P1, H1, H2),
|
||||
list::select(P7, H2, H3),
|
||||
select(P1, H1, H2),
|
||||
select(P7, H2, H3),
|
||||
P1 \= P7, P1 \= forward, P7 \= forward, % second clue
|
||||
list::select(P2, H3, H4),
|
||||
select(P2, H3, H4),
|
||||
P2 \= poison,
|
||||
list::select(P3, H4, H5),
|
||||
select(P3, H4, H5),
|
||||
P3 \= poison, % third clue
|
||||
P2 = P6,
|
||||
list::select(P6, H5, H6), % fourth clue
|
||||
list::select(P4, H6, H7),
|
||||
list::select(P5, H7, []),
|
||||
select(P6, H5, H6), % fourth clue
|
||||
select(P4, H6, H7),
|
||||
select(P5, H7, []),
|
||||
two_pairs_poison_wine([P1, P2, P3, P4, P5, P6, P7]). % first clue
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -5,13 +5,14 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 3,
|
||||
date is 2000/7/24,
|
||||
version is 3.1,
|
||||
date is 2004/8/15,
|
||||
author is 'Paulo Moura',
|
||||
comment is 'Enables the representation of relations with constraints on the state of participating objects.']).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
:- uses(list,
|
||||
[member/2, memberchk/2, subtract/3]).
|
||||
|
||||
|
||||
:- private(activ_points_/3).
|
||||
@@ -106,7 +107,7 @@
|
||||
|
||||
del_object_monitors(Object, Role) :-
|
||||
::plays_roles(Object, Roles) ->
|
||||
(list::member(Role, Roles) ->
|
||||
(member(Role, Roles) ->
|
||||
true
|
||||
;
|
||||
del_object_monitors(Object, Role, Roles))
|
||||
@@ -145,7 +146,7 @@
|
||||
|
||||
activ_point(Role, Event, Message) :-
|
||||
::activ_points_(Role, Event, Messages),
|
||||
list::member(Message, Messages).
|
||||
member(Message, Messages).
|
||||
|
||||
|
||||
activ_points(Role, Event, List) :-
|
||||
@@ -160,7 +161,7 @@
|
||||
|
||||
set_activ_points(Role, Event, List) :-
|
||||
::descriptor(Descriptor),
|
||||
list::memberchk(Role, Descriptor),
|
||||
memberchk(Role, Descriptor),
|
||||
::retractall(activ_points_(Role, Event, _)),
|
||||
::assertz(activ_points_(Role, Event, List)).
|
||||
|
||||
@@ -174,7 +175,7 @@
|
||||
|
||||
filter_messages([Role| Roles], Original, Event, Messages) :-
|
||||
::activ_points_(Role, Event, Excluded),
|
||||
list::subtract(Original, Excluded, Rest),
|
||||
subtract(Original, Excluded, Rest),
|
||||
filter_messages(Roles, Rest, Event, Messages).
|
||||
|
||||
|
||||
@@ -196,13 +197,13 @@
|
||||
::descriptor(Descriptor),
|
||||
write('call activation points:'), nl,
|
||||
findall(Messages,
|
||||
(list::member(Role, Descriptor),
|
||||
(member(Role, Descriptor),
|
||||
::activ_points(Role, before, Messages)),
|
||||
CallList),
|
||||
write(' '), writeq(CallList), nl,
|
||||
write('exit activation points:'), nl,
|
||||
findall(Messages,
|
||||
(list::member(Role, Descriptor),
|
||||
(member(Role, Descriptor),
|
||||
::activ_points(Role, after, Messages)),
|
||||
ExitList),
|
||||
write(' '), writeq(ExitList), nl.
|
||||
|
@@ -6,15 +6,16 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.1,
|
||||
date is 2004/5/9,
|
||||
version is 1.2,
|
||||
date is 2004/8/15,
|
||||
author is 'Esteban Zimanyi, Paulo Moura',
|
||||
comment is 'Enables the representation of relations between independent objects.']).
|
||||
|
||||
|
||||
:- uses(before_event_registry).
|
||||
:- uses(after_event_registry).
|
||||
:- uses(list).
|
||||
:- uses(list,
|
||||
[length/2, member/2, memberchk/2, nth1/3, same_length/2]).
|
||||
|
||||
|
||||
tuple(Tuple) :-
|
||||
@@ -33,7 +34,7 @@
|
||||
|
||||
add_tuple(Tuple) :-
|
||||
::descriptor(Descriptor),
|
||||
\+ list::same_length(Tuple, Descriptor),
|
||||
\+ same_length(Tuple, Descriptor),
|
||||
self(Self),
|
||||
sender(Sender),
|
||||
throw(error(invalid_length, Self::add_tuple(Tuple), Sender)).
|
||||
@@ -49,8 +50,8 @@
|
||||
|
||||
add_tuple(Tuple) :-
|
||||
::descriptor(Descriptor),
|
||||
list::nth1(Position, Tuple, Object),
|
||||
list::nth1(Position, Descriptor, Role),
|
||||
nth1(Position, Tuple, Object),
|
||||
nth1(Position, Descriptor, Role),
|
||||
::cardinality(Role, _, Maximum),
|
||||
::plays_role_n_times(Object, Role, Number),
|
||||
Maximum = Number,
|
||||
@@ -60,8 +61,8 @@
|
||||
|
||||
add_tuple(Tuple) :-
|
||||
::descriptor(Descriptor),
|
||||
list::nth1(Position, Tuple, Object),
|
||||
list::nth1(Position, Descriptor, Role),
|
||||
nth1(Position, Tuple, Object),
|
||||
nth1(Position, Descriptor, Role),
|
||||
::domain(Role, Domain),
|
||||
(Domain::strict_instance ->
|
||||
\+ Domain::valid(Object)
|
||||
@@ -79,7 +80,7 @@
|
||||
make_tuple_template([], [], _, []).
|
||||
|
||||
make_tuple_template([Object| Objects], [Role| Roles], Key, [Var| Rest]) :-
|
||||
(list::member(Role, Key) ->
|
||||
(member(Role, Key) ->
|
||||
Var = Object
|
||||
;
|
||||
true),
|
||||
@@ -94,8 +95,8 @@
|
||||
|
||||
remove_tuple(Tuple) :-
|
||||
::descriptor(Descriptor),
|
||||
list::nth1(Position, Tuple, Object),
|
||||
list::nth1(Position, Descriptor, Role),
|
||||
nth1(Position, Tuple, Object),
|
||||
nth1(Position, Descriptor, Role),
|
||||
::cardinality(Role, Minimum, _),
|
||||
::plays_role_n_times(Object, Role, Number),
|
||||
Minimum = Number,
|
||||
@@ -115,34 +116,34 @@
|
||||
|
||||
number_of_tuples(Number) :-
|
||||
findall(1, ::tuple_(_), List),
|
||||
list::length(List, Number).
|
||||
length(List, Number).
|
||||
|
||||
|
||||
plays_roles(Object, Roles) :-
|
||||
::descriptor(Descriptor),
|
||||
setof(Role,
|
||||
Tuple^Position^ (::tuple(Tuple),
|
||||
list::member(Object, Tuple),
|
||||
list::nth1(Position, Tuple, Object),
|
||||
once(list::nth1(Position, Descriptor, Role))),
|
||||
member(Object, Tuple),
|
||||
nth1(Position, Tuple, Object),
|
||||
once(nth1(Position, Descriptor, Role))),
|
||||
Roles).
|
||||
|
||||
|
||||
plays_role_in_tuple(Object, Role, Tuple) :-
|
||||
::descriptor(Descriptor),
|
||||
::tuple(Tuple),
|
||||
list::nth1(Position, Tuple, Object),
|
||||
list::nth1(Position, Descriptor, Role).
|
||||
nth1(Position, Tuple, Object),
|
||||
nth1(Position, Descriptor, Role).
|
||||
|
||||
|
||||
plays_role_n_times(Object, Role, Number) :-
|
||||
::descriptor(Descriptor),
|
||||
list::nth1(Position, Descriptor, Role),
|
||||
nth1(Position, Descriptor, Role),
|
||||
setof(Tuple,
|
||||
(::tuple(Tuple),
|
||||
list::nth1(Position, Tuple, Object)),
|
||||
nth1(Position, Tuple, Object)),
|
||||
Tuples),
|
||||
list::length(Tuples, Number).
|
||||
length(Tuples, Number).
|
||||
|
||||
|
||||
domains(Domains) :-
|
||||
@@ -193,7 +194,7 @@
|
||||
|
||||
degree(Degree) :-
|
||||
::descriptor_(Descriptor),
|
||||
list::length(Descriptor, Degree).
|
||||
length(Descriptor, Degree).
|
||||
|
||||
|
||||
set_descriptor(Descriptor) :-
|
||||
@@ -258,8 +259,8 @@
|
||||
|
||||
valid_keys([Key| Keys], Descriptor) :-
|
||||
forall(
|
||||
list::member(Role, Key),
|
||||
list::memberchk(Role, Descriptor)),
|
||||
member(Role, Key),
|
||||
memberchk(Role, Descriptor)),
|
||||
valid_keys(Keys, Descriptor).
|
||||
|
||||
|
||||
@@ -294,7 +295,7 @@
|
||||
|
||||
set_delete_options(Options) :-
|
||||
::descriptor(Descriptor),
|
||||
\+ list::same_length(Options, Descriptor),
|
||||
\+ same_length(Options, Descriptor),
|
||||
self(Self),
|
||||
sender(Sender),
|
||||
throw(error(invalid_length, Self::set_delete_options(Options), Sender)).
|
||||
@@ -413,7 +414,7 @@
|
||||
|
||||
del_monitors([Object| Objects]) :-
|
||||
((instantiates_class(Object, Class),
|
||||
\+ (::tuple(Other), list::member(Object, Other))) ->
|
||||
\+ (::tuple(Other), member(Object, Other))) ->
|
||||
self(Self),
|
||||
before_event_registry::del_monitors(Class, delete(Object, _), _, Self)
|
||||
;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -3,9 +3,16 @@
|
||||
instantiates(heuristic_state_space)).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
:- uses(numberlist).
|
||||
:- uses(set).
|
||||
:- info([
|
||||
version is 1.1,
|
||||
author is 'Paulo Moura',
|
||||
date is 2004/8/15,
|
||||
comment is 'Bridge puzzle.']).
|
||||
|
||||
|
||||
:- uses(list, [append/3]).
|
||||
:- uses(numberlist, [min/2, max/2]).
|
||||
:- uses(set, [insert/3, insert_all/3, select/3]).
|
||||
|
||||
|
||||
initial_state(start, ([], right, [1,3,6,8,12])).
|
||||
@@ -15,32 +22,32 @@
|
||||
|
||||
|
||||
next_state((Left1, left, Right1), (Left2, right, Right2), Slower) :- % two persons
|
||||
list::append(List, [Person1| Persons], Left1),
|
||||
set::select(Person2, Persons, Others),
|
||||
list::append(List, Others, Left2),
|
||||
set::insert_all([Person1, Person2], Right1, Right2),
|
||||
append(List, [Person1| Persons], Left1),
|
||||
select(Person2, Persons, Others),
|
||||
append(List, Others, Left2),
|
||||
insert_all([Person1, Person2], Right1, Right2),
|
||||
(Person1 > Person2 ->
|
||||
Slower = Person1
|
||||
;
|
||||
Slower = Person2).
|
||||
|
||||
next_state((Left1, right, Right1), (Left2, left, Right2), Slower) :- % two persons
|
||||
list::append(List, [Person1| Persons], Right1),
|
||||
set::select(Person2, Persons, Others),
|
||||
list::append(List, Others, Right2),
|
||||
set::insert_all([Person1, Person2], Left1, Left2),
|
||||
append(List, [Person1| Persons], Right1),
|
||||
select(Person2, Persons, Others),
|
||||
append(List, Others, Right2),
|
||||
insert_all([Person1, Person2], Left1, Left2),
|
||||
(Person1 > Person2 ->
|
||||
Slower = Person1
|
||||
;
|
||||
Slower = Person2).
|
||||
|
||||
next_state((Left1, left, Right1), (Left2, right, Right2), Person) :- % one person
|
||||
set::select(Person, Left1, Left2),
|
||||
set::insert(Right1, Person, Right2).
|
||||
select(Person, Left1, Left2),
|
||||
insert(Right1, Person, Right2).
|
||||
|
||||
next_state((Left1, right, Right1), (Left2, left, Right2), Person) :- % one person
|
||||
set::select(Person, Right1, Right2),
|
||||
set::insert(Left1, Person, Left2).
|
||||
select(Person, Right1, Right2),
|
||||
insert(Left1, Person, Left2).
|
||||
|
||||
|
||||
heuristic((Left, Lamp, Right), Heuristic) :-
|
||||
|
@@ -4,13 +4,13 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
version is 1.1,
|
||||
author is 'Paulo Moura',
|
||||
date is 1998/3/23,
|
||||
date is 2004/8/15,
|
||||
comment is 'Eight puzzle heuristic state space search problem.']).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
:- uses(list, [member/2]).
|
||||
|
||||
|
||||
initial_state(four_steps, [2/2,1/3,3/2,2/3,3/3,3/1,2/1,1/1,1/2]).
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
|
||||
print_state([S0,S1,S2,S3,S4,S5,S6,S7,S8]) :-
|
||||
list::member(Y, [3, 2, 1]),
|
||||
member(Y, [3, 2, 1]),
|
||||
nl,
|
||||
list::member(X, [1, 2, 3]),
|
||||
list::member(Tile-X/Y, [' '-S0,1-S1,2-S2,3-S3,4-S4,5-S5,6-S6,7-S7,8-S8]),
|
||||
member(X, [1, 2, 3]),
|
||||
member(Tile-X/Y, [' '-S0,1-S1,2-S2,3-S3,4-S4,5-S5,6-S6,7-S7,8-S8]),
|
||||
write(Tile),
|
||||
fail.
|
||||
|
||||
|
@@ -4,21 +4,22 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
version is 1.1,
|
||||
author is 'Paulo Moura',
|
||||
date is 1998/3/23,
|
||||
date is 2004/8/15,
|
||||
comment is 'Hill climbing heuristic state space search strategy.',
|
||||
parnames is ['Threshold']]).
|
||||
|
||||
|
||||
:- uses(list).
|
||||
:- uses(list,
|
||||
[member/2, reverse/2, sort/2]).
|
||||
|
||||
:- private(hill/7).
|
||||
|
||||
|
||||
search(Space, State, Threshold, Solution, Cost) :-
|
||||
hill(Space, State, Threshold, [], Path, 0, Cost),
|
||||
list::reverse(Path, Solution).
|
||||
reverse(Path, Solution).
|
||||
|
||||
|
||||
hill(Space, State, _, Path, [State| Path], Cost, Cost) :-
|
||||
@@ -28,12 +29,12 @@
|
||||
findall(
|
||||
(Estimate, Cost, Next),
|
||||
(Space::next_state(State, Next, Cost),
|
||||
\+ list::member(Next, [State| Path]),
|
||||
\+ member(Next, [State| Path]),
|
||||
Space::heuristic(Next, Guess),
|
||||
Estimate is Guess + Cost),
|
||||
States),
|
||||
list::sort(States, SortedStates),
|
||||
list::member((_, Cost2, Next2), SortedStates),
|
||||
sort(States, SortedStates),
|
||||
member((_, Cost2, Next2), SortedStates),
|
||||
SoFar2 is SoFar + Cost2,
|
||||
SoFar2 =< Threshold,
|
||||
hill(Space, Next2, Threshold, [State| Path], Solution, SoFar2, Total).
|
||||
|
@@ -10,7 +10,7 @@
|
||||
comment is 'Missionaries and cannibals heuristic state space search problem.']).
|
||||
|
||||
|
||||
:- uses(loop).
|
||||
:- uses(loop, [forto/3]).
|
||||
|
||||
|
||||
initial_state(start, ((3,3), left, (0,0))).
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
|
||||
print_state(((Me,Ce), B, (Md,Cd))) :-
|
||||
loop::forto(1, Me, write('M')),
|
||||
loop::forto(1, Ce, write('C')),
|
||||
forto(1, Me, write('M')),
|
||||
forto(1, Ce, write('C')),
|
||||
(B = left ->
|
||||
write('.<__>..........')
|
||||
;
|
||||
write('..........<__>.')),
|
||||
loop::forto(1, Md, write('M')),
|
||||
loop::forto(1, Cd, write('C')),
|
||||
forto(1, Md, write('M')),
|
||||
forto(1, Cd, write('C')),
|
||||
nl.
|
||||
|
||||
|
||||
|
@@ -4,18 +4,18 @@
|
||||
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
version is 1.1,
|
||||
author is 'Paulo Moura',
|
||||
date is 1998/3/23,
|
||||
date is 2004/8/15,
|
||||
comment is 'Performance monitor for state space searches.']).
|
||||
|
||||
|
||||
:- uses(event_registry).
|
||||
:- uses(before_event_registry).
|
||||
:- uses(after_event_registry).
|
||||
:- uses(list).
|
||||
:- uses(numberlist).
|
||||
:- uses(time).
|
||||
:- uses(list, [length/2]).
|
||||
:- uses(numberlist, [min/2, max/2, sum/2]).
|
||||
:- uses(time, [cpu_time/1]).
|
||||
|
||||
|
||||
:- private(transitions/3).
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
transitions(Number) :-
|
||||
findall(N, ::transitions(_, _, N), List),
|
||||
numberlist::sum(List, Number).
|
||||
sum(List, Number).
|
||||
|
||||
|
||||
time(Time) :-
|
||||
@@ -85,12 +85,12 @@
|
||||
Length,
|
||||
(::transitions(State1, _, _),
|
||||
findall(State2, ::transitions(State1, State2, _), States2),
|
||||
list::length(States2, Length)),
|
||||
length(States2, Length)),
|
||||
Lengths),
|
||||
list::min(Lengths, Minimum),
|
||||
list::max(Lengths, Maximum),
|
||||
numberlist::sum(Lengths, Sum),
|
||||
list::length(Lengths, Length),
|
||||
min(Lengths, Minimum),
|
||||
max(Lengths, Maximum),
|
||||
sum(Lengths, Sum),
|
||||
length(Lengths, Length),
|
||||
Average is Sum / Length.
|
||||
|
||||
|
||||
@@ -114,13 +114,13 @@
|
||||
|
||||
before(_, solve(_, _, _), _) :-
|
||||
!,
|
||||
time::cpu_time(Time),
|
||||
cpu_time(Time),
|
||||
::retractall(start_time(_)),
|
||||
::asserta(start_time(Time)).
|
||||
|
||||
before(_, solve(_, _, _, _), _) :-
|
||||
!,
|
||||
time::cpu_time(Time),
|
||||
cpu_time(Time),
|
||||
::retractall(start_time(_)),
|
||||
::asserta(start_time(Time)).
|
||||
|
||||
@@ -145,19 +145,19 @@
|
||||
|
||||
after(_, solve(_, _, Solution), _) :-
|
||||
!,
|
||||
time::cpu_time(Time),
|
||||
cpu_time(Time),
|
||||
::retractall(end_time(_)),
|
||||
::asserta(end_time(Time)),
|
||||
list::length(Solution, Length),
|
||||
length(Solution, Length),
|
||||
::retractall(solution_length(_)),
|
||||
::asserta(solution_length(Length)).
|
||||
|
||||
after(_, solve(_, _, Solution, _), _) :-
|
||||
!,
|
||||
time::cpu_time(Time),
|
||||
cpu_time(Time),
|
||||
::retractall(end_time(_)),
|
||||
::asserta(end_time(Time)),
|
||||
list::length(Solution, Length),
|
||||
length(Solution, Length),
|
||||
::retractall(solution_length(_)),
|
||||
::asserta(solution_length(Length)).
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
@@ -1,6 +1,6 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.19.1
|
||||
Release 2.20.0
|
||||
|
||||
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
Reference in New Issue
Block a user