Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: CLP(FD): what is necessary?
Joachim Schimpf wrote:

> You can do it simply with a function, in ECLiPSe called eval/1
> (implemented by predicate eval/2):
>
> ?- X = 1+2, Y is eval(X)*3.
>
> This is type-clean and makes the intention clear.

I like that.

Cheers

Bart Demoen

Report this thread to moderator Post Follow-up to this message
Old Post
Bart Demoen
03-14-08 01:13 PM


Re: CLP(FD): what is necessary?
On 2008-03-14, Bart Demoen <bmd@cs.kuleuven.ac.be> wrote:
> Joachim Schimpf wrote:
> 
>
> I like that.

Nice indeed. If there is sufficient support, I'm happy to add eval(X) as
a function. Of course without dropping the normal evaluation.

--- Jan

Report this thread to moderator Post Follow-up to this message
Old Post
Jan Wielemaker
03-14-08 01:13 PM


Re: CLP(FD): what is necessary?
Dnia Thu, 13 Mar 2008 17:50:54 +0000
Joachim Schimpf <jschimpf@cisco.com> napisa=C5=82(a):

> Yes, delay-clauses were invented first, but are now just
> declarative syntactic sugar for the suspend/3 primitive:
>=20
> delay p(X) if var(X).
> p(X) :- writeln(just_instantiated(X)).
>=20
> is implemented (via clause expansion) as
>=20
> p(X) :- var(X), !, suspend(p(X), 0, X->inst).
> p(X) :- writeln(just_instantiated(X)).
>=20
> Delay clauses are nice for some simple cases, but not
> general enough for most constraint applications.
>=20
Exactly. Moreover they are really clean.

>=20 
>=20
> Hmm, priorities were introduced to _address_ problems with
> constraint implementation, not to create them :-)
>=20
The problems I had:
- priorities break atomicity of propagator. This means
that propagators with higher priority can change=20
situation INSIDE low-level propagator.
I was forced to use:
ic_kernel:exclude(X, Val) =20
instead of clean
X #\=3D Val =20
- It is not clear if there is any policy for=20
priorities. It would be much better to have
priorities defined like this:

Debugging:

suspend( =20
Goal,
debug,
Conditions
)

CLP(FD):
suspend(
Goal,
fd,
Conditions
)

and so on

Of course internally this could be solved
using priority system you have. But such
interface could help users to create
constraints with consistent priorities.

For example, I do not understand why=20
priorities for global constraints
form (ic_global) are different then=20
for other constraints (ic)?

> I am not sure what you mean by "not robust" - do you refer to
> the fact that higher priority propagators can interrupt lower
> priority ones? =20
For example. Moreover priorities is another degree of
freedom. Robust system would be such that would eliminate=20
as much as possible degrees of freedom.
I had to check source code to check at what priority=20
runs different constraints (global use different priorities
then simple constraints).

> I guess this can be confusing when implementing
> a low priority propagator, but you can always create "atomic regions"
> by wrapping them in call_priority/2.
>=20
I know ;) (I used it). But still it is not something that
makes is easier. Much better would be to create
a standard for priorities.

> A real problem of priorities is however that they are hard to
> implement without slowing down the whole waking mechanism.
>=20
What was the main reason for introducing priorities?
Neither SWI, nor SICStus or B-Prolog have=20
priorities. You just declare constraint and off you go ;).=20

Best regards
--=20
[ Wit Jakuczun    <W.Jakuczun [at] wlogsolutions.com> ]
[ WLOG Solutions  http://www.wlogsolutions.com ]


Report this thread to moderator Post Follow-up to this message
Old Post
Wit Jakuczun
03-14-08 01:13 PM


Re: CLP(FD): what is necessary?
Dnia Thu, 13 Mar 2008 14:41:28 -0500
A.L. <alewando@zanoza.com> napisa=C5=82(a):

> On Thu, 13 Mar 2008 17:50:54 +0000, Joachim Schimpf
> <jschimpf@cisco.com> wrote:
> =20 
>=20
> OK, I am bot familiar with current version of ECLIPSE... Are
> priorities defined for each constraint separately, or across teh
> system? And what happens if I am using 2 custom constraints, each with
> its own priorities numbered from 1 to 5?...
>=20
Constraints will be applied according to their priorities.
That would not be a problem. The problem (for me) was
that constraint with higher priority can be activated
inside constraint with lower priority unless you
take special care to prevent this.

Best regards
--=20
[ Wit Jakuczun    <W.Jakuczun [at] wlogsolutions.com> ]
[ WLOG Solutions  http://www.wlogsolutions.com ]


Report this thread to moderator Post Follow-up to this message
Old Post
Wit Jakuczun
03-14-08 01:13 PM


Re: CLP(FD): what is necessary?
Hi!

Well, you have my support :). I'd actually suggest adding a prolog
flag to disable evaluation of generic terms outside eval.

Best

Vitor

On Mar 14, 8:31 am, Jan Wielemaker <j...@nospam.ct.xs4all.nl> wrote:
> On 2008-03-14, Bart Demoen <b...@cs.kuleuven.ac.be> wrote:
> 
> 
> 
> 
> 
>
> Nice indeed. If there is sufficient support, I'm happy to add eval(X) as
> a function. Of course without dropping the normal evaluation.
>
>         --- Jan

Report this thread to moderator Post Follow-up to this message
Old Post
vscosta@gmail.com
03-14-08 01:13 PM


Re: CLP(FD): what is necessary?
On 2008-03-14, vscosta@gmail.com <vscosta@gmail.com> wrote:
>
> Hi!
>
> Well, you have my support :). I'd actually suggest adding a prolog
> flag to disable evaluation of generic terms outside eval.

Added.  No flag.  I just agree this is better style.  When Bart&Tom
finish their type checker we can flag the is/2 type errors and people
can wrap the victim variables in eval(Var).

Flags changing runtime behaviour are far more evil than evaluating
terms under is/2 :-)

Cheers --- Jan

Report this thread to moderator Post Follow-up to this message
Old Post
Jan Wielemaker
03-15-08 12:29 AM


Re: CLP(FD): what is necessary?
On 14 Mar 2008 13:31:56 GMT, Jan Wielemaker <jan@nospam.ct.xs4all.nl>
wrote:

>On 2008-03-14, vscosta@gmail.com <vscosta@gmail.com> wrote: 
>
>Added.  No flag.  I just agree this is better style.  When Bart&Tom
>finish their type checker we can flag the is/2 type errors and people
>can wrap the victim variables in eval(Var).
>
>Flags changing runtime behaviour are far more evil than evaluating
>terms under is/2 :-)
>

OK, but what standard says about this? Does it say at all?...

A.L.

Report this thread to moderator Post Follow-up to this message
Old Post
A.L.
03-15-08 12:29 AM


Re: CLP(FD): what is necessary?
Joachim Schimpf wrote:
> Wit Jakuczun wrote: 
>
> Hopefully answered above.  You will also see that the new G12
> constraint platform being developed in Melbourne has opted for
> having priorities.
>

The other main reason is for debugging, especially if your debugging
code (e.g. the debugger itself) is written in the source language, like
ECLiPSe. You want this code to run at a very high priority, so that the
state of the code you are debugging does not change as you are running
the debugger code.

Cheers,

Kish Shen

Report this thread to moderator Post Follow-up to this message
Old Post
Kish Shen
03-15-08 12:29 AM


Re: CLP(FD): what is necessary?
"Wit Jakuczun" <wit@mefisto.hades> wrote in message
news:20080313124649.580be484@mefisto.hades...
>   Good environment for developing software that
> is based on clp should provide its users with clean
> and robust interface. By clean I mean mainly
> clear syntax. Delay clauses
> (http://eclipse.crosscoreop.com/doc/...umsroot111.html)
> are good approach. In ECLiPSe there is also another
> mechanism based on suspensions (Internally both
> approaches are equivalent). The problem with

A successor of Delay Clauses, called Action Rules, have been developed for
implementing constraint propagators. Take a look at my TPLP paper to see how
nicely and efficiently various kinds of propagators can be implemented in
the language. Bart Demoen has added a package for action rules to SWI, but I
don't know how efficient his implementation is.

Cheers,
Neng-Fa




Report this thread to moderator Post Follow-up to this message
Old Post
Neng-Fa Zhou
03-15-08 12:29 AM


Re: CLP(FD): what is necessary?
Neng-Fa Zhou wrote:
...
> A successor of Delay Clauses, called Action Rules, ...

I don't think you should say that, because they are conceptually
very different.  Delay clauses are meta level annotations that
don't affect the declarative meaning of the program (you can remove
them without changing the meaning of your prgram).  If I am not mistaken,
Action rules do affect the meaning (because they contain "actions"), right?


-- Joachim

Report this thread to moderator Post Follow-up to this message
Old Post
Joachim Schimpf
03-15-08 12:29 AM


Sponsored Links




Last Thread Next Thread Next
Pages (5): « 1 2 [3] 4 5 »
Search this forum -> 
Post New Thread

Prolog archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:18 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.