IBM ILOG Solver User's Manual > More on Modeling > Using Table Constraints: Scheduling Teams > Solve |
Solve |
INDEX
![]() |
Now you create an instance of the class IloSolver
to solve the problem expressed in the model.
Step 14 - | 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 member function IloSolver::solve
. The solution is displayed using two nested for
loops. For each period and week, the home team and the away team are displayed.
Step 15 - | Search for a solution |
Add the following code after the comment //Search for a solution
Step 16 - | 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:
The first period (period 0
) has the following schedule. In Week 1, Team 0 is home and Team 1 is away. In Week 2, Team 0 is home and Team 2 is away. In Week 3, Team 1 is home and Team 2 is away. In Week 4, Team 3 is home and Team 4 is away. In Week 5, Team 3 is home and Team 5 is away. In Week 6, Team 4 is home and Team 5 is away. In Week 7, Team 6 is home and Team 7 is away. You can follow the schedule for the other three periods.
The complete program is listed in "Complete program". You can also view it online in the file YourSolverHome/examples/src/sports_basic.cpp
.
© Copyright IBM Corp. 1987, 2009. Legal terms. | PREVIOUS NEXT |