This file is indexed.

/usr/share/mozart/doc/fst/node5.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>5 A Crew Allocation Problem</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="node4.html#fset.examples.binpacking">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node6.html#fset.examples.golf">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="fset.examples.crew"><H1><A name="fset.examples.crew">5 A Crew Allocation Problem</A></H1><P class="margin">Problem Specification</P><P> A small air-line has to assign their 20 flight attendants to 10 flights. Each flight has to be accompanied by a certain number of cabin crew (see <A href="node5.html#table.crew_per_flight">Table&nbsp;5.1</A>) that has to meet a couple of constraints. First, to serve the needs of international clients the cabin crew has to be able to speak German, Spanish, and French (see <A href="node5.html#table.foreign_lang_per_flight">Table&nbsp;5.2</A>). Further, a minimal number of stewardesses resp. stewards have to attend a flight (see <A href="node5.html#table.sex_per_flight">Table&nbsp;5.3</A>). Finally, every cabin crew member has two flights off after an attended flight. </P><DIV class="table" id="table.crew_per_flight"><HR><P><A name="table.crew_per_flight"></A></P></DIV><TABLE align="center" class="dyptic"><TR valign="top"><TD><P></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TH><P>flight #</P></TH><TH><P># of cabin staff</P></TH></TR><TR valign="top"><TD><P>1</P></TD><TD><P>4</P></TD></TR><TR valign="top"><TD><P>2</P></TD><TD><P>4</P></TD></TR><TR valign="top"><TD><P>3</P></TD><TD><P>5</P></TD></TR><TR valign="top"><TD><P>4</P></TD><TD><P>5</P></TD></TR><TR valign="top"><TD><P>5</P></TD><TD><P>6</P></TD></TR></TABLE><P></P></TD><TD><P></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TH><P>flight #</P></TH><TH><P># of cabin staff</P></TH></TR><TR valign="top"><TD><P>6</P></TD><TD><P>4</P></TD></TR><TR valign="top"><TD><P>7</P></TD><TD><P>4</P></TD></TR><TR valign="top"><TD><P>8</P></TD><TD><P>5</P></TD></TR><TR valign="top"><TD><P>9</P></TD><TD><P>5</P></TD></TR><TR valign="top"><TD><P>10</P></TD><TD><P>6</P></TD></TR></TABLE><P></P></TD></TR></TABLE><DIV class="table"><P class="caption"><STRONG>Table&nbsp;5.1:</STRONG> Cabin crew per flight.</P><HR></DIV><P> </P><DIV class="table" id="table.foreign_lang_per_flight"><HR><P><A name="table.foreign_lang_per_flight"></A></P></DIV><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TD><P></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TH><P>flight #</P></TH><TH><P>French</P></TH><TH><P>Spanish</P></TH><TH><P>German</P></TH></TR><TR valign="top"><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>2</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>3</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>4</P></TD><TD><P>2</P></TD><TD><P>2</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>5</P></TD><TD><P>2</P></TD><TD><P>2</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>6</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>7</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>8</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>9</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>10</P></TD><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR></TABLE><P></P></TD></TR></TABLE><DIV class="table"><P class="caption"><STRONG>Table&nbsp;5.2:</STRONG> Cabin crew speaking foreign language per flight.</P><HR></DIV><P> </P><DIV class="table" id="table.sex_per_flight"><HR><P><A name="table.sex_per_flight"></A></P></DIV><TABLE align="center" class="dyptic"><TR valign="top"><TD><P></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TH><P>flight #</P></TH><TH><P>male</P></TH><TH><P>female</P></TH></TR><TR valign="top"><TD><P>1</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>2</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>3</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>4</P></TD><TD><P>2</P></TD><TD><P>2</P></TD></TR><TR valign="top"><TD><P>5</P></TD><TD><P>3</P></TD><TD><P>2</P></TD></TR></TABLE><P></P></TD><TD><P></P><TABLE align="center" bgcolor="#f0f0e0"><TR valign="top"><TH><P>flight #</P></TH><TH><P>male</P></TH><TH><P>female</P></TH></TR><TR valign="top"><TD><P>6</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>7</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>8</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>9</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR><TR valign="top"><TD><P>10</P></TD><TD><P>1</P></TD><TD><P>1</P></TD></TR></TABLE><P></P></TD></TR></TABLE><DIV class="table"><P class="caption"><STRONG>Table&nbsp;5.3:</STRONG> Male resp. female cabin crew per flight.</P><HR></DIV><P> </P><P class="margin">Model</P><P> The cabin crew for every flight is represented as a set. The constraints on cabin crews of individual flights are modeled in terms of constraints on the cardinality of the intersection of the cabin crew set of that flight with the sets associated with particular restrictions. Therefore the following subsets of the cabin crew are introduced: male, female, Spanish-speaking, French-speaking, and German-speaking cabin crew. The constraint that a crew member has two flights off after an attended flight is expressed by the disjointness of the appropriate sets representing a crew per flight. </P><P class="margin">Solver</P><P> The function <CODE>AssignCrew</CODE> returns a solver configured according to its arguments <CODE>FlightData</CODE> and <CODE>Crew</CODE>. As previously mentioned, the constraints on the cabin crew of a flight are expressed in terms of sets of crew members meeting these constraints. For that reason the following variables are defined: </P><UL><LI><P><CODE>Stewards</CODE> (male cabin crew members), </P></LI><LI><P><CODE>Stewardesses</CODE> (female cabin crew members), </P></LI><LI><P><CODE>FrenchSpeaking</CODE>, <CODE>GermanSpeaking</CODE>, and <CODE>SpanishSpeaking</CODE> (French-, German-, resp. Spanish-speaking cabin crew members). </P></LI></UL><P> Procedure <CODE>TeamConstraint</CODE> imposes the abovementioned constraints on the individual flight cabin crew sets intersecting them with appropriate sets (<CODE>FS<SPAN class="keyword">.</SPAN>intersection</CODE>), and constrains the intersection's cardinality according to <A href="node5.html#table.crew_per_flight">Table&nbsp;5.1</A>, <A href="node5.html#table.foreign_lang_per_flight">Table&nbsp;5.2</A>, and <A href="node5.html#table.sex_per_flight">Table&nbsp;5.3</A> (using <CODE>FS<SPAN class="keyword">.</SPAN>card</CODE> and <CODE><SPAN class="keyword">&gt;=:</SPAN></CODE>). </P><P> The procedure <CODE>SequenceDisjoint</CODE> is responsible to ensure that every crew member may enjoy a two-flight break between two flights. It is a recursive procedure imposing <CODE>FS<SPAN class="keyword">.</SPAN>disjoint</CODE> upon every 3 subsequent sets. </P><P> The actual solver declares the local variable <CODE>Flights</CODE> that contains the list of sets representing the individual crew assignments. Then, the constraints of the procedure <CODE>TeamConstraint</CODE> are imposed on <CODE>Flights</CODE> by the <CODE>Map</CODE> loop, by mapping the data provided by <CODE>FlightData</CODE> to <CODE>Flights</CODE>. The distribution is straightforward and has no particularities. </P><P class="margin">Dealing with sets of literals</P><P> Often real-life applications deal with sets of names, descriptions and the like rather than integers, which can be represented by Oz literals. The functions <CODE>SetOfLiterals</CODE>, <CODE>Lits2Ints</CODE>, and <CODE>Ints2Lits</CODE> allow to model sets of literals. The function <CODE>SetOfLiterals</CODE> returns an abstract data structure that enables <CODE>Lits2Ints</CODE> and <CODE>Ints2Lits</CODE> to map literals to integers and vice versa. The last line of the solver procedure converts the internal solution to a representation corresponding to the format of <CODE>AssignCrew</CODE>'s argument <CODE>Crew</CODE> (see below). </P><P></P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">declare</SPAN>&nbsp;<BR>&nbsp;<BR><SPAN class="keyword">local</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;Lit2Int&nbsp;=&nbsp;{NewName}<BR>&nbsp;&nbsp;&nbsp;Int2Lit&nbsp;=&nbsp;{NewName}<BR><SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">SetOfLiterals</SPAN>&nbsp;Lits}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sol(Lit2Int:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{NewChunk<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{List<SPAN class="keyword">.</SPAN>toRecord&nbsp;l2i<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{List<SPAN class="keyword">.</SPAN>mapInd&nbsp;Lits&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;I&nbsp;L}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L<SPAN class="keyword">#</SPAN>I<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}}}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Int2Lit:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{NewChunk<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{List<SPAN class="keyword">.</SPAN>toRecord&nbsp;i2l<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{List<SPAN class="keyword">.</SPAN>mapInd&nbsp;Lits&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;I&nbsp;L}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I<SPAN class="keyword">#</SPAN>L<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}}})<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">Lits2Ints</SPAN>&nbsp;SetOfLiterals&nbsp;Literals}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Map&nbsp;Literals&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Lit}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetOfLiterals<SPAN class="keyword">.</SPAN>Lit2Int<SPAN class="keyword">.</SPAN>Lit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">Ints2Lits</SPAN>&nbsp;SetOfLiterals&nbsp;Ints}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Map&nbsp;Ints&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Int}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetOfLiterals<SPAN class="keyword">.</SPAN>Int2Lit<SPAN class="keyword">.</SPAN>Int<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;<BR><SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">CrewProb</SPAN>&nbsp;FlightData&nbsp;Crew}<BR>&nbsp;&nbsp;&nbsp;CabinStaff&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{Append&nbsp;Crew<SPAN class="keyword">.</SPAN>stewards&nbsp;Crew<SPAN class="keyword">.</SPAN>stewardesses}<BR>&nbsp;&nbsp;&nbsp;CrewSet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{SetOfLiterals&nbsp;CabinStaff}<BR>&nbsp;&nbsp;&nbsp;Stewards&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>value<SPAN class="keyword">.</SPAN>make<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Lits2Ints&nbsp;CrewSet&nbsp;Crew<SPAN class="keyword">.</SPAN>stewards}}<BR>&nbsp;&nbsp;&nbsp;Stewardesses&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>value<SPAN class="keyword">.</SPAN>make<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Lits2Ints&nbsp;CrewSet&nbsp;Crew<SPAN class="keyword">.</SPAN>stewardesses}}<BR>&nbsp;&nbsp;&nbsp;FrenchSpeaking&nbsp;&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>value<SPAN class="keyword">.</SPAN>make<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Lits2Ints&nbsp;CrewSet&nbsp;Crew<SPAN class="keyword">.</SPAN>frenchspeaking}}<BR>&nbsp;&nbsp;&nbsp;GermanSpeaking&nbsp;&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>value<SPAN class="keyword">.</SPAN>make<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Lits2Ints&nbsp;CrewSet&nbsp;Crew<SPAN class="keyword">.</SPAN>germanspeaking}}<BR>&nbsp;&nbsp;&nbsp;SpanishSpeaking&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>value<SPAN class="keyword">.</SPAN>make<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Lits2Ints&nbsp;CrewSet&nbsp;Crew<SPAN class="keyword">.</SPAN>spanishspeaking}}<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">TeamConstraint</SPAN>&nbsp;Team&nbsp;Flight}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flight(no:_&nbsp;crew:N&nbsp;stewards:NStew&nbsp;stewardesses:NHost<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:NFrench&nbsp;germanspeaking:NGerman<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spanishspeaking:NSpanish)&nbsp;=&nbsp;Flight<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>card&nbsp;Team&nbsp;&nbsp;N}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>card<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>intersect&nbsp;Team&nbsp;Stewards}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">&gt;=:</SPAN>&nbsp;NStew<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>card<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>intersect&nbsp;Team&nbsp;Stewardesses}}&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">&gt;=:</SPAN>&nbsp;NHost<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>card<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>intersect&nbsp;Team&nbsp;FrenchSpeaking}}&nbsp;&nbsp;<SPAN class="keyword">&gt;=:</SPAN>&nbsp;NFrench<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>card<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>intersect&nbsp;Team&nbsp;GermanSpeaking}}&nbsp;&nbsp;<SPAN class="keyword">&gt;=:</SPAN>&nbsp;NGerman<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>card<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>intersect&nbsp;Team&nbsp;SpanishSpeaking}}&nbsp;<SPAN class="keyword">&gt;=:</SPAN>&nbsp;NSpanish<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">SequencedDisjoint</SPAN>&nbsp;L}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">case</SPAN>&nbsp;L&nbsp;<SPAN class="keyword">of</SPAN>&nbsp;A<SPAN class="keyword">|</SPAN>B<SPAN class="keyword">|</SPAN>C<SPAN class="keyword">|</SPAN>T&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>disjoint&nbsp;A&nbsp;B}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>disjoint&nbsp;A&nbsp;C}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{SequencedDisjoint&nbsp;B<SPAN class="keyword">|</SPAN>C<SPAN class="keyword">|</SPAN>T}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">elseof</SPAN>&nbsp;A<SPAN class="keyword">|</SPAN>B<SPAN class="keyword">|</SPAN>nil&nbsp;<SPAN class="keyword">then</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>disjoint&nbsp;A&nbsp;B}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<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;Flights&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>var<SPAN class="keyword">.</SPAN>list<SPAN class="keyword">.</SPAN>upperBound<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Length&nbsp;FlightData}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Lits2Ints&nbsp;CrewSet&nbsp;CabinStaff}}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Map&nbsp;FlightData&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;D&nbsp;F}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{TeamConstraint&nbsp;F&nbsp;D}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;Flights}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{SequencedDisjoint&nbsp;Flights}<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>distribute&nbsp;naive&nbsp;Flights}<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sol&nbsp;=&nbsp;{Map&nbsp;Flights<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;F}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Ints2Lits&nbsp;CrewSet&nbsp;{FS<SPAN class="keyword">.</SPAN>monitorIn&nbsp;F}}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN>&nbsp;<BR></PRE></BLOCKQUOTE><P> </P><P> The following sample data can be used to test the solver: </P><P></P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">declare</SPAN>&nbsp;<BR>Flights&nbsp;=<BR>[flight(no:&nbsp;1&nbsp;crew:4&nbsp;stewards:1&nbsp;stewardesses:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;2&nbsp;crew:5&nbsp;stewards:1&nbsp;stewardesses:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;3&nbsp;crew:5&nbsp;stewards:1&nbsp;stewardesses:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;4&nbsp;crew:6&nbsp;stewards:2&nbsp;stewardesses:2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;5&nbsp;crew:7&nbsp;stewards:3&nbsp;stewardesses:3<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;6&nbsp;crew:4&nbsp;stewards:1&nbsp;stewardesses:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;7&nbsp;crew:5&nbsp;stewards:1&nbsp;stewardesses:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;8&nbsp;crew:6&nbsp;stewards:1&nbsp;stewardesses:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:&nbsp;9&nbsp;crew:6&nbsp;stewards:2&nbsp;stewardesses:2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)<BR>&nbsp;flight(no:10&nbsp;crew:7&nbsp;stewards:3&nbsp;stewardesses:3<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:1&nbsp;spanishspeaking:1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:1)]<BR>&nbsp;<BR>Crew&nbsp;=<BR>crew(stewards:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[tom&nbsp;david&nbsp;jeremy&nbsp;ron&nbsp;joe&nbsp;bill&nbsp;fred&nbsp;bob&nbsp;mario&nbsp;ed]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stewardesses:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[carol&nbsp;janet&nbsp;tracy&nbsp;marilyn&nbsp;carolyn&nbsp;cathy&nbsp;inez<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jean&nbsp;heather&nbsp;juliet]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;frenchspeaking:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[inez&nbsp;bill&nbsp;jean&nbsp;juliet]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;germanspeaking:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[tom&nbsp;jeremy&nbsp;mario&nbsp;cathy&nbsp;juliet]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spanishspeaking:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[bill&nbsp;fred&nbsp;joe&nbsp;mario&nbsp;marilyn&nbsp;inez&nbsp;heather])<BR></PRE></BLOCKQUOTE><P> Running the solver by <CODE>{ExploreOne&nbsp;{AssignCrew&nbsp;Flights&nbsp;Crew}}</CODE>. and invoking the Oz Browser on the solution node results in: </P><P></P><DIV align="center"><IMG alt="" src="crew_browser.gif" id="pic.crew_browser"></DIV><P> </P><P> The flights are to be attended in the order they appear in the solution list. Each sublist denotes the assignment for an individual flight. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node4.html#fset.examples.binpacking">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node6.html#fset.examples.golf">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>