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

X #= -Y fails in clp(FD)
Any ideas why? (Running Sicstus Prolog)

| ?- X in -1..1, Y in -1..1, X#= -Y.
! Domain error in user: #= /2
! expected constraint, found _1126#= -(_1124)
! goal:  _1126#= -(_1124)
! goal:  user:(_451#= -(_506))
! Domain error in user: #= /2
! expected constraint, found _140#= -(_105)
! goal:  _140#= -(_105)


Bes regards,

Andrey

Report this thread to moderator Post Follow-up to this message
Old Post
Andrey Rybalchenko
08-16-07 03:13 AM


Re: X #= -Y fails in clp(FD)
after a quick look at the manual:

unary negation symbol is missing in clp(FD) language.
a workaround is to multiply by -1:

| ?- X in -1..1, Y in -1..1, X#= -1*(Y).
X in-1..1,
Y in-1..1 ?
yes

> Any ideas why? (Running Sicstus Prolog)
>
> | ?- X in -1..1, Y in -1..1, X#= -Y.
> ! Domain error in user: #= /2
> ! expected constraint, found _1126#= -(_1124)
> ! goal:  _1126#= -(_1124)
> ! goal:  user:(_451#= -(_506))
> ! Domain error in user: #= /2
> ! expected constraint, found _140#= -(_105)
> ! goal:  _140#= -(_105)
>
>
> Bes regards,
>
> Andrey

Report this thread to moderator Post Follow-up to this message
Old Post
Andrey Rybalchenko
08-16-07 03:13 AM


Re: X #= -Y fails in clp(FD)
I think this is something that should be standardized for CLP(FD). In
B-Prolog, I got what are expected.

| ?- X in -1..1, Y in -1..1, X#= -Y,labeling([X,Y])
X = -1
Y = 1 ?;
X = 0
Y = 0 ?;
X = 1
Y = -1 ?;
no
| ?- X in -1..1, T = (X#=0), #\ T, labeling([], [X]).
X = -1
T = -1#=0 ?;
X = 1
T = 1#=0 ?;
no

Cheers,
Neng-Fa

"Andrey Rybalchenko" <first_dot_last_at_epfl_dot_ch> wrote in message
news:1187210291_654@sicinfo3.epfl.ch...
> after a quick look at the manual:
>
> unary negation symbol is missing in clp(FD) language.
> a workaround is to multiply by -1:
>
> | ?- X in -1..1, Y in -1..1, X#= -1*(Y).
> X in-1..1,
> Y in-1..1 ?
> yes
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Neng-Fa Zhou
08-17-07 12:10 AM


Sponsored Links




Last Thread Next Thread Next
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 04:55 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.