| IBM ILOG Solver User's Manual > More on Modeling > Using Set Variables: Crew Scheduling > Solve |
Solve |
INDEX
PREVIOUS
NEXT
|
Now you create an instance of the class IloSolver to solve the problem expressed in the model.
Step 9 - | Create an instance of IloSolver |
Add the following code after the comment //Create an instance of IloSolver
IloSolver solver(model); |
Then you search for a solution using the predefined goal IloGenerate. You use a "for" loop to display the solution using the function Print.
Step 10 - | Search for a solution |
Add the following code after the comment //Search for a solution
You use the Print function to display the solution. You use an iterator to display the values in each set in the array of set variables crews. This code is provided for you:
Step 11 - | Compile and run the program |
Compile and run the program. You should get the following results, though the information displayed by IloSolver::printInformation will vary depending on platform, machine, configuration, and so on:
As you can see, the crew members assigned to each flight are displayed. The complete program is listed in "Complete program". You can also view it online in the file YourSolverHome/examples/src/crews.cpp.
| © Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |