Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Symmetry detection

    Posted Mon April 16, 2018 01:16 PM

    Originally posted by: LeonFTW


    Hi all,

    i am using Cplex 12.8.0 to solve a Car Sequencing problem. As my model contains 300 cars of 15 different types, the symmetry is very high.

    However to me it seems like Cplex does not detect this symmetry. First reason i think so is: cplex is able to find a very good (probably optimal) solution in just a couple of seconds, but then proofing its optimality is not even done after 30 min (also the gap does not change during this 30 min). The second reason i think cplex does not detect the symmetry: changing the symmetry breaking parameter does not affect the solving times at all.

     

    So my question is: how does cplex detect/identify symmetry? is there anything i can do to "help" this detection?

     

    Thank you for your support!

    Regards, Leon


    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: Symmetry detection

    Posted Tue April 17, 2018 03:06 AM

    Originally posted by: dominiqs81


    Hi Leon,

     

    CPLEX usually does automatic simmetry detection. However, some problem types are not supported (e.g. MIQCP) and in any case symmetry detection code could be stopped by some work limit.

    Can you share the model so that we can double-check internally what is going on?

     

    Domenico


    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: Symmetry detection

    Posted Tue April 17, 2018 05:50 AM

    Originally posted by: LeonFTW


    Hi Domenico,

    thank you for your fast reply! My model is the implementation of Fliedner and Boysen (2008): Solving the car sequencing problem via Branch & Bound.

     

      {string} O = ...;          //set of options relevant for seqeuncing
    int M = ...;            //number of different car models 
    int a [1..M][O]= ...;    // option allocation: which model of car requires which option
    int d[1..M]=...;     //demand per model, or the number of cars from this model that need to be sequenced
    int H[O]=...;       // the max number of cars with option o allowed in any subsequence of length N[o]
    int N[O]=...;      // length of the subsequence to check for rule violations for option o
    int T = sum(m in 1..M)d[m];    //total number of takts 
     
     
     
    dvar boolean x[1..M][1..T];      //decision variable: 1 if model m is produced in takt t, 0 otherwise
    dvar float+ v[O];          // number of rule violations caused by option o
     
     
    execute  {
     cplex.tilim = 600;
    }
     
    minimize sum(o in O) (v[o]);
     
    subject to {
    forall (o in O){      //counting logic for rule violations
    ct0: v[o] == sum(t in 1..T: t<=(T-H[o])) minl ((sum(m in 1..M)(a[m][o]*x[m][t])), maxl (sum(ts in t..(minl((t+N[o]-1),T)),m in 1..M)(a[m][o]*x[m][ts])-H[o],0));
    }
     
     forall (m in 1..M)     // demand has to be met exactly
       ct1: sum (t in 1..T)x[m][t] == d[m];
      
    forall (t in 1..T)       // max 1 car can be assigned to one takt.
      ct2: 
      sum (m in 1..M)x[m][t]== 1;

     

    }

     

    This is the main model. Actually its followed by a short execute block to output some data, but I guess this should not affect the solving.

    Looking forward to your ideas.

     

    Leon


    #DecisionOptimization
    #MathematicalProgramming-General


  • 4.  Re: Symmetry detection

    Posted Tue April 17, 2018 07:41 AM

    Originally posted by: dominiqs81


    Can you also share a .dat file (or export the model yourself to LP or SAV format)?


    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: Symmetry detection

    Posted Wed April 18, 2018 07:33 AM

    Originally posted by: LeonFTW


    Hi,

    please find my .dat file and the connected excel file attached. I hope this helps.

    Thank you!


    #DecisionOptimization
    #MathematicalProgramming-General


  • 6.  Re: Symmetry detection

    Posted Fri April 20, 2018 06:08 AM

    Originally posted by: dominiqs81


    Hi Leon,

     

    I confirm that after presolve there is no symmetry detected (there would be some before presolve, but that is a dummy one between variables that are fixed to zero because of the data...nothing that would influence B&C).

     

    I am no expert in car sequencing, but are you sure the formulation you are using is expected to have any symmetry? According to your data (and common-sense), no two models or options are the same, so there is no symmetry in indexes o and m. And the sequencing nature of the problem kills symmetry on t. Where should symmetry come from?

     

    Domenico


    #DecisionOptimization
    #MathematicalProgramming-General


  • 7.  Re: Symmetry detection

    Posted Fri April 20, 2018 07:22 AM

    Originally posted by: LeonFTW


    Hi Domenico,

    thank you for looking into it.

    The symmetry I can see in there comes form the fact, that in total 341 cars of only 20 different types (type a to t) should be sequenced. In this particular example type j has a demand of 120, meaning in my sequence of 341 cars, 120 of them are identical. 

    So from my understanding, the solver finds a good, probably optimal solution relatively quickly but then cant prove optimality by improving the lower bound. I assume the reason is, that the solver tries to switch the order of these 120 identical cars of type j. But as they are identical the objective value will not change.

    This is where i thought the symmetry breaking build in CPLEX could help to "tell the solver" switching cars of the same type will not improve the solution.

    I hope this explanation is understandable

    Leon


    #DecisionOptimization
    #MathematicalProgramming-General


  • 8.  Re: Symmetry detection

    Posted Fri April 20, 2018 07:57 AM

    Originally posted by: dominiqs81


    Yes, there are identical cars but as far as I can understand that is irrelevant for your model.

    You have a sequence of (time?) slots, no two of which are symmetric because of (temporal) sequencing. It would be different if you had a variable for each car to produce (in that case cars of the same type could be permuted, giving rise to different solutions). But the model you are using is smarter than that, so it bypasses that source of symmetry. And I don't see any other.

     

    As an exercise, you can try to construct (on a much smaller instance) two different solutions that should be symmetric because of swapping of identical cars. I think that with your model you should not be able to do so. If I am wrong then we have something to look at.

     

    Domenico


    #DecisionOptimization
    #MathematicalProgramming-General


  • 9.  Re: Symmetry detection

    Posted Fri April 20, 2018 08:28 AM

    Originally posted by: LeonFTW


    Oh, i think i understand what you are saying! Well that's good news on the one hand, but on the other hand now my question is, what can i do to improve the models so it proves optimality or reduces the gap.

    Do you have any suggestions on that ?

    Kind regards,

    Leon


    #DecisionOptimization
    #MathematicalProgramming-General


  • 10.  Re: Symmetry detection

    Posted Fri April 20, 2018 11:06 AM

    Originally posted by: dominiqs81


    I think you should change the way you express the model. You use a lot of higher level constructs, whose linearization is very poor (hence the bound of zero).

    On the other hand, a pure MIP formulation should not be very hard to get. I tried myself (attached) and, assuming I got it right, the result is that it solves in <1s on my machine.

    But please double-check, I am not very familiar with car sequencing.

     


    #DecisionOptimization
    #MathematicalProgramming-General


  • 11.  Re: Symmetry detection

    Posted Mon April 23, 2018 08:59 AM

    Originally posted by: dominiqs81


    Sorry, I don't really have time to dig deeper into car sequencing models.

    However, it might be somewhat expected that the lower bound gets much weaker if you allow for "optional" cars.


    #DecisionOptimization
    #MathematicalProgramming-General