/usr/share/mozart/doc/demo/node33.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>Problem solver for computing plans: Plan.oz</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="node32.html#code.transportation.germany"><< Prev</A></TD><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node34.html#code.transportation.randomizer">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.transportation.plan"><H3><A name="code.transportation.plan">Problem solver for computing plans: <CODE>Plan.oz</CODE></A></H3><P class="margin"><A href="Transport/Plan.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">import</SPAN> <BR> Search(base)<BR> FD<BR> Country(getDist getDetourDist)<BR> Configure(capacity: Capacity)<BR> <BR><SPAN class="keyword">export</SPAN> <BR> make: MakePlan<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> %%<SPAN class="comment"> <BR></SPAN> %% <SPAN class="comment">Defaults used<BR></SPAN> %%<SPAN class="comment"> <BR></SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">InsertSrc</SPAN> JA<SPAN class="keyword">|</SPAN>Js Src Dst Weight What ?C ?NJs}<BR> <SPAN class="keyword">case</SPAN> Js <SPAN class="keyword">of</SPAN> nil <SPAN class="keyword">then</SPAN> <BR> <SPAN class="keyword">if</SPAN> Src<SPAN class="keyword">==</SPAN>JA<SPAN class="keyword">.</SPAN>city <SPAN class="keyword">then</SPAN> <BR> NJs = [act(city:Src<BR> load:Weight <BR> lift:What<SPAN class="keyword">|</SPAN>JA<SPAN class="keyword">.</SPAN>lift<BR> drop:JA<SPAN class="keyword">.</SPAN>drop)<BR> act(city:Dst<BR> load:0 <BR> lift:nil<BR> drop:[What])]<BR> C = {Country<SPAN class="keyword">.</SPAN>getDist Src Dst}<BR> <SPAN class="keyword">else</SPAN> <BR> NJs = [JA<BR> act(city: Src<BR> load: Weight<BR> lift: [What]<BR> drop: nil) <BR> act(city: Dst<BR> load: 0<BR> lift: nil<BR> drop: [What])]<BR> C = ({Country<SPAN class="keyword">.</SPAN>getDist JA<SPAN class="keyword">.</SPAN>city Src}<BR> <SPAN class="keyword">+</SPAN> {Country<SPAN class="keyword">.</SPAN>getDist Src Dst})<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">[]</SPAN> JB<SPAN class="keyword">|</SPAN>_ <SPAN class="keyword">then</SPAN> <BR> NewLoad = JA<SPAN class="keyword">.</SPAN>load <SPAN class="keyword">+</SPAN> Weight<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> NewLoad<SPAN class="keyword">></SPAN>Capacity <SPAN class="keyword">then</SPAN> <BR> %% <SPAN class="comment">Job cannot placed here, because load would exceed the<BR></SPAN> %% <SPAN class="comment">capacity of the truck<BR></SPAN> NJs=JA<SPAN class="keyword">|</SPAN>{InsertSrc Js Src Dst Weight What ?C}<BR> <SPAN class="keyword">else</SPAN> <BR> <SPAN class="keyword">dis</SPAN> NewJob <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> Src<SPAN class="keyword">==</SPAN>JA<SPAN class="keyword">.</SPAN>city <SPAN class="keyword">then</SPAN> <BR> %% <SPAN class="comment">Okay, the truck drives to this city anyway, so<BR></SPAN> %% <SPAN class="comment">simply add this good<BR></SPAN> NJs = (act(city: Src<BR> load: NewLoad<BR> lift: What<SPAN class="keyword">|</SPAN>JA<SPAN class="keyword">.</SPAN>lift<BR> drop: JA<SPAN class="keyword">.</SPAN>drop) = NewJob)<BR> <SPAN class="keyword">|</SPAN> {InsertDst NewJob Js Dst Weight What ?C}<BR> <SPAN class="keyword">else</SPAN> TmpTour={FD<SPAN class="keyword">.</SPAN>int 0<SPAN class="keyword">#</SPAN>FD<SPAN class="keyword">.</SPAN>sup} <SPAN class="keyword">in</SPAN> <BR> %% <SPAN class="comment">Add the city to the towns the truck has to visit<BR></SPAN> NJs = (JA <BR> <SPAN class="keyword">|</SPAN> (act(city: Src<BR> load: NewLoad<BR> lift: [What]<BR> drop: nil) = NewJob)<BR> <SPAN class="keyword">|</SPAN> {InsertDst NewJob Js Dst Weight What ?TmpTour})<BR> C <SPAN class="keyword">=:</SPAN> TmpTour<BR> <SPAN class="keyword">+</SPAN> {Country<SPAN class="keyword">.</SPAN>getDetourDist JA<SPAN class="keyword">.</SPAN>city Src JB<SPAN class="keyword">.</SPAN>city}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">[]</SPAN> % <SPAN class="comment">...or somewhere else<BR></SPAN> NJs=JA<SPAN class="keyword">|</SPAN>{InsertSrc Js Src Dst Weight What ?C}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">InsertDst</SPAN> JA Js Dst Weight What ?C ?NJs}<BR> %% <SPAN class="comment">JA is loaded with Order. Order.to has to be placed <BR></SPAN> %% <SPAN class="comment">after JA either between planned cities or on planned<BR></SPAN> %% <SPAN class="comment">cities. Recursion tries to keep Order transported up to <BR></SPAN> %% <SPAN class="comment">cities later in Plan<BR></SPAN> <SPAN class="keyword">case</SPAN> Js <SPAN class="keyword">of</SPAN> nil <SPAN class="keyword">then</SPAN> <BR> C = {Country<SPAN class="keyword">.</SPAN>getDist JA<SPAN class="keyword">.</SPAN>city Dst}<BR> NJs = [act(city: Dst<BR> load: 0<BR> lift: nil<BR> drop: [What])]<BR> <SPAN class="keyword">[]</SPAN> JB<SPAN class="keyword">|</SPAN>Jr <SPAN class="keyword">then</SPAN> <BR> <SPAN class="keyword">dis</SPAN> <BR> <SPAN class="keyword">if</SPAN> JB<SPAN class="keyword">.</SPAN>city<SPAN class="keyword">==</SPAN>Dst <SPAN class="keyword">then</SPAN> <BR> C = 0<BR> NJs = {AdjoinAt JB drop What<SPAN class="keyword">|</SPAN>JB<SPAN class="keyword">.</SPAN>drop} <SPAN class="keyword">|</SPAN> Jr<BR> <SPAN class="keyword">else</SPAN> <BR> C = {Country<SPAN class="keyword">.</SPAN>getDetourDist JA<SPAN class="keyword">.</SPAN>city Dst JB<SPAN class="keyword">.</SPAN>city}<BR> NJs = act(city: Dst<BR> load: JA<SPAN class="keyword">.</SPAN>load<SPAN class="keyword">-</SPAN>Weight<BR> lift: nil<BR> drop: [What]) <SPAN class="keyword">|</SPAN> Js<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">[]</SPAN> NewLoad = JB<SPAN class="keyword">.</SPAN>load <SPAN class="keyword">+</SPAN> Weight<BR> NewJob = {AdjoinAt JB load NewLoad}<BR> <SPAN class="keyword">in</SPAN> <BR> NewLoad <SPAN class="keyword">=<:</SPAN> Capacity<BR> <SPAN class="keyword">then</SPAN> <BR> NJs = NewJob <SPAN class="keyword">|</SPAN> {InsertDst NewJob Jr Dst Weight What ?C}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">MakePlan</SPAN> Tour Task ?Cost ?NewTour}<BR> Cost <SPAN class="keyword">#</SPAN> NewTour = <SPAN class="keyword">case</SPAN> {Search<SPAN class="keyword">.</SPAN>base<SPAN class="keyword">.</SPAN>best<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> S}<BR> C <SPAN class="keyword">#</SPAN> NewTour = S<BR> <SPAN class="keyword">in</SPAN> <BR> C <SPAN class="keyword">::</SPAN> 0<SPAN class="keyword">#</SPAN>FD<SPAN class="keyword">.</SPAN>sup<BR> {InsertSrc Tour Task<SPAN class="keyword">.</SPAN>src Task<SPAN class="keyword">.</SPAN>dst Task<SPAN class="keyword">.</SPAN>weight<BR> Task<SPAN class="keyword">.</SPAN>what ?C ?NewTour}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> SA SB} SA<SPAN class="keyword">.</SPAN>1<SPAN class="keyword">>:</SPAN>SB<SPAN class="keyword">.</SPAN>1 <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">of</SPAN> nil <SPAN class="keyword">then</SPAN> <SPAN class="keyword">false#</SPAN>Tour<BR> <SPAN class="keyword">[]</SPAN> [S] <SPAN class="keyword">then</SPAN> S<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR><SPAN class="keyword">end</SPAN> <BR></PRE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node32.html#code.transportation.germany"><< Prev</A></TD><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node34.html#code.transportation.randomizer">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|