46 Tom, David, Jeremy, Ron,
50 Marilyn, Carolyn, Cathy,
51 Inez, Jean, Heather, Juliet
53 const int noOfEmployees = Juliet+1;
65 const char* employeeToName(Employee e);
66 extern const int stewards[];
67 extern const int noOfStewards;
68 extern const int hostesses[];
69 extern const int noOfHostesses;
70 extern const int spanishSpeaking[];
71 extern const int noOfSpanishSpeaking;
72 extern const int frenchSpeaking[];
73 extern const int noOfFrenchSpeaking;
74 extern const int germanSpeaking[];
75 extern const int noOfGermanSpeaking;
76 extern const Flight requiredCrew[];
77 extern const int noOfFlights;
98 IntSet stewardsDS(stewards,noOfStewards);
99 IntSet hostessesDS(hostesses,noOfHostesses);
100 IntSet spanishDS(spanishSpeaking, noOfSpanishSpeaking);
101 IntSet frenchDS(frenchSpeaking, noOfFrenchSpeaking);
102 IntSet germanDS(germanSpeaking, noOfGermanSpeaking);
104 for (
int i=0; i<noOfFlights; i++) {
110 requiredCrew[i].stewards);
112 requiredCrew[i].hostesses);
114 requiredCrew[i].spanish);
116 requiredCrew[i].french);
118 requiredCrew[i].german);
122 for (
int i=0; i<noOfFlights-2; i++) {
134 for (
int i=0; i<noOfFlights; i++) {
135 os <<
"\tFlight " << i+1 <<
":" << std::endl;
136 os <<
"\t\tCrew\tStew.\tHost.\tFrench\tSpanish\tGerman"
137 << std::endl <<
"\t";
138 os <<
"\t" << requiredCrew[i].staff <<
"\t" << requiredCrew[i].stewards
139 <<
"\t" << requiredCrew[i].hostesses <<
"\t"
140 << requiredCrew[i].spanish
141 <<
"\t" << requiredCrew[i].french <<
"\t" << requiredCrew[i].german
144 os <<
"\t\tSchedule:" << std::endl <<
"\t\t";
145 if (
flight[i].assigned()) {
147 os << employeeToName(static_cast<Employee>(d.val())) <<
" ";
150 os <<
"\tRequired: ";
152 os << employeeToName(static_cast<Employee>(d.val())) <<
" ";
154 os << std::endl <<
"\t\t\tPossible: ";
156 os << employeeToName(static_cast<Employee>(d.val())) <<
" ";
159 os << std::endl << std::endl;
171 return new Crew(*
this);
192 employeeToName(Employee e) {
194 case Tom :
return "Tom";
195 case David :
return "David";
196 case Jeremy:
return "Jeremy";
197 case Ron:
return "Ron";
198 case Joe:
return "Joe";
199 case Bill:
return "Bill";
200 case Fred:
return "Fred";
201 case Bob:
return "Bob";
202 case Mario:
return "Mario";
203 case Ed:
return "Ed";
204 case Carol:
return "Carol";
205 case Janet:
return "Janet";
206 case Tracy:
return "Tracy";
207 case Marilyn:
return "Marilyn";
208 case Carolyn:
return "Carolyn";
209 case Cathy:
return "Cathy";
210 case Inez:
return "Inez";
211 case Jean:
return "Jean";
212 case Heather:
return "Heather";
213 case Juliet:
return "Juliet";
220 const int stewards[] =
221 {Tom, David, Jeremy, Ron, Joe, Bill, Fred, Bob, Mario, Ed};
223 const int noOfStewards =
sizeof(stewards) /
sizeof(
int);
225 const int hostesses[] =
226 { Carol, Janet, Tracy, Marilyn, Carolyn, Cathy, Inez,
227 Jean, Heather, Juliet };
229 const int noOfHostesses =
sizeof(hostesses) /
sizeof(
int);
231 const int frenchSpeaking[] =
232 { Bill, Inez, Jean, Juliet };
234 const int noOfFrenchSpeaking =
sizeof(frenchSpeaking) /
sizeof(
int);
236 const int germanSpeaking[] =
237 { Tom, Jeremy, Mario, Cathy, Juliet };
239 const int noOfGermanSpeaking =
sizeof(germanSpeaking) /
sizeof(
int);
241 const int spanishSpeaking[] =
242 { Joe, Bill, Fred, Mario, Marilyn, Inez, Heather };
244 const int noOfSpanishSpeaking =
sizeof(spanishSpeaking) /
sizeof(
int);
247 const Flight requiredCrew[] =
260 const int noOfFlights =
sizeof(requiredCrew) /
sizeof(Flight);
int main(int argc, char *argv[])
Main-function.
Crew(const Options &opt)
The actual model.
Crew(Crew &s)
Constructor for cloning s.
SetVarArray flight
The crew for each flight.
virtual Space * copy(void)
Copy during cloning.
virtual void print(std::ostream &os) const
Print solution.
void parse(int &argc, char *argv[])
Parse options from arguments argv (number is argc)
static void run(const Options &opt, Script *s=NULL)
void iterations(unsigned int i)
Set default number of iterations.
Iterator for the values in the greatest lower bound of a set variable.
Iterator for the values in the unknown set of a set variable.
Driver::ScriptBase< Driver::IgnoreStepOption< Space > > Script
Base-class for scripts.
void branch(Home home, const FloatVarArgs &x, FloatVarBranch vars, FloatValBranch vals, FloatBranchFilter bf=nullptr, FloatVarValPrint vvp=nullptr)
Branch over x with variable selection vars and value selection vals.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Gecode toplevel namespace
Select first unassigned variable SetVarBranch SET_VAR_NONE(void)
Include smallest element SetValBranch SET_VAL_MIN_INC(void)
LinIntExpr cardinality(const SetExpr &)
Cardinality of set expression.
#define GECODE_NEVER
Assert that this command is never executed.