/usr/share/mozart/doc/cpitut/node19.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>A Simple Propagator</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node18.html#ct.casestudy.impl.expect"><< Prev</A></TD><TD><A href="node13.html">- Up -</A></TD></TR></TABLE><DIV id="ct.casestudy.impl.propagator"><H4><A name="ct.casestudy.impl.propagator">A Simple Propagator</A></H4><P>The description of the implementation of real-interval constraints is closed with the discussion of the propagation function of a simple propagator, namely a propagator for the constraint <IMG alt="x \le
y" src="latex89.png">. The rest of the class definition of that propagator is similar to other propagators and therefore omitted here. </P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="type">OZ_Return</SPAN> <SPAN class="reference">RILessEq</SPAN>::<SPAN class="functionname">propagate</SPAN>(<SPAN class="type">void</SPAN>)<BR>{<BR> <SPAN class="type">RIVar</SPAN> <SPAN class="variablename">x</SPAN>(_x), y(_y);<BR> <BR> // <SPAN class="comment">step (1)<BR></SPAN> <SPAN class="keyword">if</SPAN> (x->upperBound() <= y->lowerBound()) {<BR> x.leave(); y.leave();<BR> <SPAN class="keyword">return</SPAN> OZ_ENTAILED;<BR> }<BR> <BR> // <SPAN class="comment">step (2)<BR></SPAN> <SPAN class="keyword">if</SPAN>((*x <= y->upperBound()) < 0.0) <BR> <SPAN class="keyword">goto</SPAN> <SPAN class="reference">failure</SPAN>;<BR> <BR> // <SPAN class="comment">step (3)<BR></SPAN> <SPAN class="keyword">if</SPAN>((*y >= x->lowerBound()) < 0.0) <BR> <SPAN class="keyword">goto</SPAN> <SPAN class="reference">failure</SPAN>;<BR> <BR> <SPAN class="keyword">return</SPAN> (x.leave() | y.leave()) <BR> ? OZ_SLEEP : OZ_ENTAILED;<BR> <BR><SPAN class="reference">failure</SPAN>:<BR> x.fail(); y.fail();<BR> <SPAN class="keyword">return</SPAN> OZ_FAILED;<BR>}<BR></PRE></BLOCKQUOTE><P> Assume that the propagator stores in its state references to its parameters on the Oz heap by the members <CODE><SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">_x</SPAN>, <SPAN class="variablename">_y</SPAN>;</CODE>. The function <CODE>propagate()</CODE> obtains access to the constraint store by declaring two instances of class <CODE>RIVar</CODE> and passing the Oz terms <CODE>_x</CODE> and <CODE>_y</CODE> as arguments. </P><P>The propagation proceeds in three steps. </P><OL type="1"><LI><P>Test if the constraint <IMG alt="x \le y" src="latex90.png"> is subsumed by the constraint store, i. e., <IMG alt="\overline{x} \le \underline{y}" src="latex91.png">. </P></LI><LI><P>Constrain the upper bound of <IMG alt="x" src="latex4.png">: <IMG alt="x \le
\overline{y}" src="latex92.png">. </P><P> That is implemented by <CODE><SPAN class="type">ri_float</SPAN> <SPAN class="reference">RI</SPAN>::<SPAN class="keyword">operator</SPAN> <BR><SPAN class="functionname"><=</SPAN> (<SPAN class="type">ri_float</SPAN>)</CODE>. </P></LI><LI><P>Constrain the lower bound of <IMG alt="y" src="latex5.png">: <IMG alt="y \ge
\underline{x}" src="latex93.png">. </P><P> That is implemented by <CODE><SPAN class="type">ri_float</SPAN> <SPAN class="reference">RI</SPAN>::<SPAN class="keyword">operator</SPAN> <BR><SPAN class="functionname">>=</SPAN> (<SPAN class="type">ri_float</SPAN>)</CODE>. </P></LI></OL><P> As said in <A href="node16.html#ct.casestudy.impl.constraint">Section ``The Actual Real-Interval Constraint''</A> these operators return the width of the computed constraint. A width less than 0 indicates that the constraint has become inconsistent and propagation branches to label <CODE>failure</CODE>. </P><P>The function <CODE><SPAN class="reference">OZ_CtVar</SPAN>::leave()</CODE> returns <CODE>OZ_True</CODE> if the constraint does not denotes a value. This is used to detect whether the propagator has to be rerun (indicated by <CODE>OZ_SLEEP</CODE>) or not (indicated by <CODE>OZ_ENTAILED</CODE>). </P><P> The return value <CODE>OZ_FAILED</CODE> informs the runtime system that the constraint is inconsistent with the constraint store. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node18.html#ct.casestudy.impl.expect"><< Prev</A></TD><TD><A href="node13.html">- Up -</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~tmueller/">Tobias Müller</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|