/usr/share/mozart/doc/cpitut/node24.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.4 Combining Both Models</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="node23.html#lp.tutorial.lp"><< Prev</A></TD><TD><A href="lp.html">- Up -</A></TD><TD><A href="node25.html#lp.tutorial.eval">Next >></A></TD></TR></TABLE><DIV id="lp.tutorial.fdlp"><H2><A name="lp.tutorial.fdlp">3.4 Combining Both Models</A></H2><P>Combining both models is simply done by adding the finite domain model without distribution to the linear programming model. The propagator <CODE>{RI<SPAN class="keyword">.</SPAN>intBounds F I}</CODE> is used to connect real-interval constraints with finite domain constraints. It constrains <CODE>F</CODE> and <CODE>I</CODE> to denote the same integer either as float or as integer, respectively. </P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">declare</SPAN> <BR><SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">KnapsackFDLP</SPAN> Problem}<BR> NumProducts = {Length Problem<SPAN class="keyword">.</SPAN>profit}<BR> Resources = Problem<SPAN class="keyword">.</SPAN>resources<BR><SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> Sol}<BR> sol(maxprofit: FDMaxProfit = {FD<SPAN class="keyword">.</SPAN>decl}<BR> products: FDProducts = {FD<SPAN class="keyword">.</SPAN>list NumProducts 0<SPAN class="keyword">#</SPAN>FD<SPAN class="keyword">.</SPAN>sup})<BR> = Sol<BR> <BR> ObjFn Constraints<BR> MaxProfit = {RI<SPAN class="keyword">.</SPAN>var<SPAN class="keyword">.</SPAN>decl}<BR> Products = {MakeList NumProducts}<BR> <SPAN class="keyword">in</SPAN> <BR> %<SPAN class="comment"> <BR></SPAN> % <SPAN class="comment">finite domain constraints part<BR></SPAN> %<SPAN class="comment"> <BR></SPAN> FDMaxProfit = {FD<SPAN class="keyword">.</SPAN>sumC Problem<SPAN class="keyword">.</SPAN>profit FDProducts <SPAN class="string">'=:'</SPAN>}<BR> <BR> {ForAll {Arity Resources}<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> ResourceName}<BR> Resource = Resources<SPAN class="keyword">.</SPAN>ResourceName<BR> <SPAN class="keyword">in</SPAN> <BR> {FD<SPAN class="keyword">.</SPAN>sumC Resource<SPAN class="keyword">.</SPAN>npp FDProducts <SPAN class="string">'=<:'</SPAN> Resource<SPAN class="keyword">.</SPAN>ta}<BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> %%<SPAN class="comment"> <BR></SPAN> %% <SPAN class="comment">linear programming part<BR></SPAN> %%<SPAN class="comment"> <BR></SPAN> {ForAll Products<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> V} {RI<SPAN class="keyword">.</SPAN>var<SPAN class="keyword">.</SPAN>bounds 0<SPAN class="keyword">.</SPAN>0 RI<SPAN class="keyword">.</SPAN>sup V} <SPAN class="keyword">end</SPAN>}<BR> <BR> ObjFn = objfn(row: {Map Problem<SPAN class="keyword">.</SPAN>profit {IntToFloat I}}<BR> opt: max)<BR> <BR> Constraints = <BR> {Map {Arity Resources}<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> ResourceName}<BR> Resource = Resources<SPAN class="keyword">.</SPAN>ResourceName<BR> <SPAN class="keyword">in</SPAN> <BR> constr(row: {Map Resource<SPAN class="keyword">.</SPAN>npp IntToFloat}<BR> type: <SPAN class="string">'=<'</SPAN> <BR> rhs: {IntToFloat Resource<SPAN class="keyword">.</SPAN>ta})<BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> %%<SPAN class="comment"> <BR></SPAN> %% <SPAN class="comment">connecting both constraint systems<BR></SPAN> %%<SPAN class="comment"> <BR></SPAN> {RI<SPAN class="keyword">.</SPAN>intBounds MaxProfit FDMaxProfit}<BR> {Map Products<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> R D} {RI<SPAN class="keyword">.</SPAN>intBounds R D} <SPAN class="keyword">end</SPAN> FDProducts}<BR> <BR> <BR> {DistributeKnapSackLP Products ObjFn Constraints<BR> MaxProfit}<BR> <SPAN class="keyword">end</SPAN> <BR><SPAN class="keyword">end</SPAN> <BR></PRE></BLOCKQUOTE><P> </P><P>The Oz Explorer produces the following search tree by calling </P><BLOCKQUOTE class="code"><CODE>{ExploreBest {KnapsackFDLP Problem} <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> O N} O<SPAN class="keyword">.</SPAN>maxprofit <SPAN class="keyword"><:</SPAN> N<SPAN class="keyword">.</SPAN>maxprofit <SPAN class="keyword">end</SPAN>}</CODE></BLOCKQUOTE><P>. </P><DIV align="center"><IMG alt="" src="mks_fdlp_explorer.gif" id="mks_fdlp_explorer.pic"></DIV><P> </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node23.html#lp.tutorial.lp"><< Prev</A></TD><TD><A href="lp.html">- Up -</A></TD><TD><A href="node25.html#lp.tutorial.eval">Next >></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>
|