IBM ILOG Solver User's Manual > More on Modeling > Using the Distribute Constraint: Car Sequencing > Review exercises

For answers, see "Suggested answers".

  1. What are global constraints?
  2. What parameters does the global constraint IloDistribute take?
  3. Modify the car sequencing problem. Assume that you have 20 cars to paint in 4 available colors: green, yellow, blue, and white. Due to technical limitations on the assembly line, no more than 6 cars can be painted green, exactly 5 cars must be painted yellow, no more than 7 cars can be painted blue, and no less than 5 cars and no more than 12 cars can be painted white. The first car off the assembly line cannot be painted green.
  4. Use the IloDistribute constraint to solve for a magic sequence. A magic sequence is a sequence of n + 1 values (x0, x1, ..., xn) such that 0 appears in the sequence x0 times, 1 appears x1 times, ..., and n appears in the sequence xn times. The numbers in the magic sequence have a sum equal to n + 1.
  5. For example, for n = 3, the following sequence is a solution: (1, 2, 1, 0). That is, 0 is present once, 1 is present twice, 2 is present once, and 3 is not present (present zero times, as it were).
    Describe, model, and solve this problem. Write the code so that you can solve magic sequences of different sizes, but find a solution for a magic sequence of size n = 10. This is a problem with a high level of modeling difficulty.