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

I now realize WHY my 'consistency check' was pointless: CLP.
I'm still very much a newbie at Prolog, but one of my first experiments was
to write some code which attempted to find contradictions in the constraints
or attributes of unbound variables, at a point in time before they could be
instantiated.

Since then I've learned that constraints in Prolog, even though they don't
have to be, are often mathematical ones. At which point I added some rules
to my database for finding obvious math contradictions. But it was only
after that, that I really learned what constraints are.

As I understand it now, a constraint differs in how it's used from general
Prolog, in that general Prolog predicates basically require at least one of
their arguments to be instantiated in order to succeed. Which can result in
the other variables becoming instantiated, or in the instruction succeeding
or failing depending on whether the relationship is true. But as I
understand it now, a constraint can be given only unbound variables and
still succeed. Then, this constraint can be called, if you will, two or
three more times, before it solves the system. Or it might solve after being
used *many* more times.

As I understand it now, calling the constraint puts attributes on the
variables which are tested whenever any code tries to instantiate them.
Further, it seems to me, that there exists non-constraint code to help
define the constraint, which tries to assign such values. I would have said
that this code belongs to the constraint and is layered 'under' the
constraint handling rules. But this code suggests solutions to the system.
Importantly, if no attempt is ever made to instantiate the variable, no
solutions are found, and a program might loop for a long time, just adding
more and more attributes to them.

However, general Prolog code which calls the constraint could be said to be
layered 'above' the constraint handling rules, and can be used to synthesize
functions. Or to define the problem.

It's clear to me today, that code which tries to call all the attributes
until either many unbound variables have been unified, or until an exception
is thrown due to uninstantiated ones leading to tentative success, is only
of very limited value. If the attributes contradict each other, this is hard
to determine, and attempts which must exist to instantiate the variable are
doomed to fail anyway. Meanwhile, the constrained variables do not in
general need a test to see if they can stand for something real. Only, the
Prolog interpreter could waste a lot of time when attempts are made to
assign a value to them, because ultimately the backtracking takes time.
Thus, if contradictions in the attributes could be found as early as
possible, it might speed up the program.

And to me this generalized test is probably not worth the effort for most
kinds of programming any more. On the other hand, I also did not put much
effort into writing it either.

Dirk


--
You can visit my CGI at:

http://www.cam.org/~mdirk/GallIndex.htm
(Spelled ... lower-case el - el - Capital Eye ... ndex.htm)



Report this thread to moderator Post Follow-up to this message
Old Post
Dirk Mittler
08-24-05 11:58 PM


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 06:46 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.