| Data: a problem instance of (or ) |
| Result: the optimal solution of (or ) |
| Solve (resp., ) without using any constraint of the form (33) |
| Find cycles on the resulting digraph obtained by using a depth-first search algorithm |
| While (no cycles remain in the optimal solution of (resp., )) do |
| For each cycle found, write a new constraint of the form (33) and add it to the feasible set of (resp., ) |
| Solve (resp., ) |
| Return: the optimal solution found and the objective function value |