This file is indexed.

/usr/share/mozart/doc/cpitut/node22.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>3.2 The Finite Domain Model</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="node21.html#lp.tutorial.intro">&lt;&lt; Prev</A></TD><TD><A href="lp.html">- Up -</A></TD><TD><A href="node23.html#lp.tutorial.lp">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="lp.tutorial.fd"><H2><A name="lp.tutorial.fd">3.2 The Finite Domain Model</A></H2><P>The finite domain model is a one-to-one translation of the LP model. Every problem variable of <IMG alt="\mbox{\bf x}" src="latex113.png"> is represented by a finite domain variable. The inequalities are expressed by appropriate finite domain constraints. </P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">declare</SPAN>&nbsp;<BR><SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">KnapsackFD</SPAN>&nbsp;Problem}<BR>&nbsp;&nbsp;&nbsp;NumProducts&nbsp;=&nbsp;{Length&nbsp;Problem<SPAN class="keyword">.</SPAN>profit}<BR>&nbsp;&nbsp;&nbsp;Resources&nbsp;&nbsp;&nbsp;=&nbsp;Problem<SPAN class="keyword">.</SPAN>resources<BR><SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Sol}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sol(maxprofit:&nbsp;MaxProfit&nbsp;=&nbsp;{FD<SPAN class="keyword">.</SPAN>decl}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;products:&nbsp;Products&nbsp;=&nbsp;{FD<SPAN class="keyword">.</SPAN>list&nbsp;NumProducts&nbsp;0<SPAN class="keyword">#</SPAN>FD<SPAN class="keyword">.</SPAN>sup})<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;Sol<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MaxProfit&nbsp;=&nbsp;{FD<SPAN class="keyword">.</SPAN>sumC&nbsp;Problem<SPAN class="keyword">.</SPAN>profit&nbsp;Products&nbsp;<SPAN class="string">'=:'</SPAN>}<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ForAll&nbsp;{Arity&nbsp;Resources}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;ResourceName}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Resource&nbsp;=&nbsp;Resources<SPAN class="keyword">.</SPAN>ResourceName<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FD<SPAN class="keyword">.</SPAN>sumC&nbsp;Resource<SPAN class="keyword">.</SPAN>npp&nbsp;Products&nbsp;<SPAN class="string">'=&lt;:'</SPAN>&nbsp;Resource<SPAN class="keyword">.</SPAN>ta}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FD<SPAN class="keyword">.</SPAN>distribute&nbsp;naive&nbsp;Products}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN>&nbsp;<BR></PRE></BLOCKQUOTE><P> The function <CODE>KnapsackFD</CODE> returns a procedure abstracting the script. The solution variable <CODE>Sol</CODE> of the script is constrained to a record. The record provides access to the individual quantities of the individual products (under feature <CODE>products</CODE>) to obtain a maximum profit (under feature <CODE>maxprofit</CODE>). </P><P>The variable <CODE>Products</CODE> refers to a list of finite domain problem variables (corresponding to <IMG alt="\left[x_1,\ldots,x_n\right]^T" src="latex114.png"> in the LP model) and <CODE>MaxProfit</CODE> is constrained to be the scalar product of the <CODE>Product</CODE> variable and the profit vector for the problem specification (see <A href="node21.html#lp.tutorial.intro">Section&nbsp;3.1</A>). </P><P>The <CODE>ForAll</CODE> iterator imposes the inequality constraints <IMG alt="a_{1,i} x_1 + \cdots + a_{n,i} x_n \le b_i" src="latex115.png"> to the problem variables. The distribution strategy is straightforwardly chosen to <CODE>naive</CODE>. Experimenting with first fail (<CODE>ff</CODE>) produced even worse results. </P><P>Solving the problem by calling </P><BLOCKQUOTE class="code"><CODE>{ExploreBest&nbsp;{KnapsackFD&nbsp;Problem}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;O&nbsp;N}&nbsp;O<SPAN class="keyword">.</SPAN>maxprofit&nbsp;<SPAN class="keyword">&lt;:</SPAN>&nbsp;N<SPAN class="keyword">.</SPAN>maxprofit&nbsp;<SPAN class="keyword">end</SPAN>}</CODE></BLOCKQUOTE><P> produces the following search tree. </P><DIV align="left"><IMG alt="" class="left" src="mks_fd_explorer.gif" id="mks_fd_explorer.pic"></DIV><P> </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node21.html#lp.tutorial.intro">&lt;&lt; Prev</A></TD><TD><A href="lp.html">- Up -</A></TD><TD><A href="node23.html#lp.tutorial.lp">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~tmueller/">Tobias&nbsp;Müller</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>