Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > d1f06a5336fd6bf4a381b72b8d2b5ce1 > files > 199

gprolog-1.2.16-3mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14">
<TITLE>
 Optimization constraints
</TITLE>
</HEAD>
<BODY TEXT=black BGCOLOR=white>
<A HREF="manual063.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual054.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<HR>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR><TD BGCOLOR="#66dbff"><DIV ALIGN=center><TABLE>
<TR><TD><FONT SIZE=4><B><A NAME="htoc338">8.10</A></B></FONT></TD>
<TD WIDTH="100%" ALIGN=center><FONT SIZE=4><B>Optimization constraints</B></FONT></TD>
</TR></TABLE></DIV></TD>
</TR></TABLE><UL>
<LI><A HREF="manual064.html#toc276"> <TT>fd_minimize/2</TT>,
 <TT>fd_maximize/2</TT></A>
</UL>
<BR>
<A NAME="toc276"></A><TABLE CELLPADDING=0 CELLSPACING=0 WIDTH="100%">
<TR><TD BGCOLOR="#98e7ff"><DIV ALIGN=center><TABLE>
<TR><TD><B><A NAME="htoc339">8.10.1</A></B></TD>
<TD WIDTH="100%" ALIGN=center><B><TT>fd_minimize/2</TT>,
 <TT>fd_maximize/2</TT></B></TD>
</TR></TABLE></DIV></TD>
</TR></TABLE>
 
 <BR>
<B>Templates</B>
<DL COMPACT=compact><DT><DD><TT>
fd_minimize(+callable_term, ?fd_variable)<BR>
fd_maximize(+callable_term, ?fd_variable)</TT></DL>
<B>Description</B><BR>
<BR>
<TT>fd_minimize(Goal, X)</TT> repeatedly calls <TT>Goal</TT> to find a
value that minimizes the variable <TT>X</TT>. <TT>Goal</TT> is a Prolog goal
that should instantiate <TT>X</TT>, a common case being the use of
<TT>fd_labeling/2</TT> (section&nbsp;<A HREF="manual063.html#fd-labeling/2">8.9.1</A>). This predicate uses a
branch-and-bound algorithm with restart: each time <TT>call(Goal)</TT>
succeeds the computation restarts with a new constraint <TT>X #&lt; V</TT>
where <TT>V</TT> is the value of <TT>X</TT> at the end of the last call of
<TT>Goal</TT>. When a failure occurs (either because there are no remaining
choice-points for <TT>Goal</TT> or because the added constraint is
inconsistent with the rest of the store) the last solution is recomputed
since it is optimal.<BR>
<BR>
<TT>fd_maximize(Goal, X)</TT> is similar to <TT>fd_minimize/2</TT> but
<TT>X</TT> is maximized<TT>.</TT><BR>
<BR>
<B>Errors</B><BR>
<TABLE CELLSPACING=2 CELLPADDING=0>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Goal</TT> is a variable</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>instantiation_error</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>Goal</TT> is neither a variable nor a callable term</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(callable, Goal)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left>The predicate indicator <TT>Pred</TT> of <TT>Goal</TT> does not
correspond to an existing procedure and the value of the <TT>unknown</TT>
Prolog flag is <TT>error</TT> (section&nbsp;<A HREF="manual045.html#set-prolog-flag/2">7.22.1</A>)</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>existence_error(procedure, Pred)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR>
<TR><TD VALIGN=top ALIGN=left><TT>X</TT> is neither a variable nor an FD variable nor an integer
</TD>
<TD VALIGN=top ALIGN=center NOWRAP>&nbsp;&nbsp;</TD>
<TD VALIGN=top ALIGN=left><TT>type_error(fd_variable, X)</TT></TD>
</TR>
<TR><TD BGCOLOR=black COLSPAN=3><TABLE BORDER=0 WIDTH="100%" CELLSPACING=0 CELLPADDING=1><TR><TD></TD></TR></TABLE></TD>
</TR></TABLE><BR>
<B>Portability</B><BR>
<BR>
GNU Prolog predicates.

<HR SIZE=2>
Copyright (C) 1999-2002 Daniel Diaz
<BR>
<BR>
Verbatim copying and distribution of this entire article is permitted in any
medium, provided this notice is preserved. <BR>
<BR>
<A HREF="index.html#copyright">More about the copyright</A>
<HR>
<A HREF="manual063.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual054.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
</BODY>
</HTML>