Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

Indicator Constraint and Variable indicator

  • 1.  Indicator Constraint and Variable indicator

    Posted Thu January 07, 2010 07:50 PM

    Originally posted by: giscardf


    Hi all,

    Basically I have a problem, where the Objective Function has terms like
    MIN X1 Y1 Cost1 + X2 Y2 Cost2 + ... + XN YN CostN
    i.e, My objective functions is a Quadratic one and both X1..XN and Y1..YN are BINARY variables

    Hence CPLEX run faster on linear problems I did change my Objective Function to
    MIN T1 Cost1 + T2 Cost2 + ... + TN CostN
    And for each T1..TN a new constraint was created
    X1 + Y1 - T1 <= 1
    X2 + Y2 - T2 <= 1
    ...
    XN + YN - Tn <= 1
    At this way, I will keep the problem integrity (see table below)
    X Y X Y (Quadratic) T (X + Y - T <= 1)
    0 0 0 0 (cplex will pick 0 due to objetive minimization)
    0 1 0 0 (cplex will pick 0 due to objetive minimization)
    1 0 0 0 (cplex will pick 0 due to objetive minimization)
    1 1 1 1 (only value 1 is valid)

    The problem on doing that, is that for each term in objetive function I will have a new
    constraint, and since there are thousand of terms, CPLEX is still taking too long to solve
    the problem.

    Basically my doubt is: What I can do to improve this?

    I just read in the manual about Indicator Constraint where we can use a binary variable to "enable/disable" constraint
    ex: constraint: X1 = 1 -> X1 + X2 + X3 <= 1 //this means, if X1 == 1, let's consider the constraint X1 + X2 + X3

    Now I am wonder if is possible do something like
    ex: X1 + Y1 = 2 -> T1 = 1 //this means, if X1 + X2 == 1, let's force T1 be equal to 1

    One more time any sugestion is very welcome, basically what I need is find at some how a table like the one below
    X Y X Y (Quadratic) X + Y(Helpful Idea)
    0 0 0 0
    0 1 0 0
    1 0 0 0
    1 1 1 1

    Thanks you guys

    Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Indicator Constraint and Variable indicator

    Posted Thu January 07, 2010 07:58 PM

    Originally posted by: giscardf


    Hi guys, some tables are not pretty clear, I am writing them again...

    Hi all,

    Basically I have a problem, where the Objective Function has terms like
    MIN X1 Y1 Cost1 + X2 Y2 Cost2 + ... + XN YN CostN
    

    i.e, My objective functions is a Quadratic one and both X1..XN and Y1..YN are BINARY variables

    Hence CPLEX run faster on linear problems I did change my Objective Function to
    MIN T1 Cost1 + T2 Cost2 + ... + TN CostN
    

    And for each T1..TN a new constraint was created
    X1 + Y1 - T1 <= 1
    X2 + Y2 - T2 <= 1
    ...
    XN + YN - Tn <= 1
    


    At this way, I will keep the problem integrity (see table below)
    X  Y   XY(Quadratic) X+Y-T<=1
    0  0       0           0 (cplex will pick 0 due to objetive minimization)
    0  1       0           0 (cplex will pick 0 due to objetive minimization)
    1  0       0           0 (cplex will pick 0 due to objetive minimization)
    1  1       1           1 (only value 1 is valid)
    


    The problem on doing that, is that for each term in objetive function I will have a new
    constraint, and since there are thousand of terms, CPLEX is still taking too long to solve
    the problem.

    Basically my doubt is: What I can do to improve this?

    I just read in the manual about Indicator Constraint where we can use a binary variable to "enable/disable" constraint
    constraint: X1 = 1 -> X1 + X2 + X3 <= 1 //this means, if X1 == 1, let's consider the constraint X1 + X2 + X3

    Now I am wonder if is possible do something like
    X1 + Y1 = 2 -> T1 = 1 //this means, if X1 + X2 == 1, let's force T1 be equal to 1

    One more time any sugestion is very welcome, basically what I need is find at some how a table like the one below
    X  Y   XY(Quadratic) X+Y(plus help)
    0  0       0               0
    0  1       0               0
    1  0       0               0
    1  1       1               1
    


    Thanks you guys

    Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Indicator Constraint and Variable indicator

    Posted Tue January 12, 2010 04:58 PM

    Originally posted by: SystemAdmin


    To the original poster:

    First, did you already try formulating your model in the natural way and pass it to CPLEX? I'm not sure from your comment about "thousand of terms" whether you already determined that this formulation is computationally intractable, or if you are assuming non-convexity is the obstacle and reformulation is mandatory. While the product of two variables is not a convex quadratic function, the binary declaration allows CPLEX to make an internal reformulation that permits it to solve it. If your model will never contain any nonlinearities other than these simple products, it may not be necessary for you to do any explicit reformulation yourself.

    The growth in model size by using the linearization you described does sound daunting. And indicator constraints hold no promise for improvement in that regard as they are basically linear too - I wouldnt' expect the complexity of the model to be markedly different. While a quadratic model will usually be slower than a linear counterpart of the same size, quadratic methods are still efficient enough that they can do better than a linear model of much larger dimension.

    Integer quadratic models do tend to be plagued by symmetry and fractionality to an even greater degree than linear models are. This seems particularly true for simple initial formulations (proof of concept, etc). A bit paradoxically, as you add more of the real-world constraints to a quadratic model, some of these symmetries may be broken, or "economic" analysis permits variables to be fixed at their optimal values by inspection during Presolve. Although this is only a hand-waving argument, if your model is currently only in a very early prototype form at the moment, it may not be necessary to abandon all hope - see if you can get better performance by a fuller realization of the formulation. (But, I'm not promising miracles, either.)

    As for your final question about how to create a single function that matches your table of values, there are 4 values you are trying to "curve fit", and while a symmetry argument reduces it to 3, it is still one too many for a linear fit, and so I see quadratic as the lowest order polynomial you can hope for.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Indicator Constraint and Variable indicator

    Posted Tue January 12, 2010 06:59 PM

    Originally posted by: giscardf


    Hi Gregory, let's see if I understood what you mean (I am not a CPLEX expert, neither a Optimizer expert)...

    >> did you already try formulating your model in the natural way and pass it to CPLEX?
    The answer is YES. I did try three different models in CPLEX
    1)Using quadratic terms + normal constraints (CPLEX could solve it for N<=6 but not for N=8)
    MIN X1 Y1 Cost1 + X2 Y2 Cost2 + ... + XN YN CostN
    2)Using linear terms + normal constraints + special constraints (CPLEX could solve it for N<=6 but nor for N=8, however for N=6 CPLEX did it 1000 times faster)
    MIN T1 Cost1 + T2 Cost2 + ... + TN CostN
    X1 + Y1 - T1 <= 1
    X2 + Y2 - T2 <= 1
    ...
    XN + YN - Tn <= 1
    3)Using linear terms + normal constraints (CPLEX could solve it for N=40, however this does not result in the right solution due to modification)
    MIN (X1 + Y1) Cost1 + (X2 + Y2) Cost2 + ... + (XN + YN) CostN

    >>I'm not sure from your comment about "thousand of terms" whether you already determined that this formulation is computationally intractable, or if you are assuming non-convexity is the >>obstacle and reformulation is mandatory
    When I mean thousand, I am trying to say that my objective function has 3.(((n-2).n.n.n)-(2.((n-2).(n.n)))+((n-2).n)) + 2.(n.(n-1)) terms

    >>While the product of two variables is not a convex quadratic function, the binary declaration allows CPLEX to make an internal reformulation that permits it to solve it.
    I agree with you

    >>If your model will never contain any nonlinearities other than these simple products, it may not be necessary for you to do any explicit reformulation yourself.
    When I change the products by sums and create the new restrictions CPLEX can solve them faster, so I believe the reformulation helped. However the problem still has
    too much terms and inserting 3.(((n-2).n.n.n)-(2.((n-2).(n.n)))+((n-2).n)) + 2.(n.(n-1)) new restrictions is making things harder to CPLEX

    >> The growth in model size by using the linearization you described does sound daunting. And indicator constraints hold no promise for improvement in that regard as they are basically linear >> too - I wouldnt' expect the complexity of the model to be markedly different. While a quadratic model will usually be slower than a linear counterpart of the same size, quadratic methods
    >> are still efficient enough that they can do better than a linear model of much larger dimension.
    I agree with you, at the begining it sounds daunting for me too. However the reforumation (even adding new restrictions) allowed CPLEX to solve the N=6 problem 150 times faster

    >>As for your final question about how to create a single function that matches your table of values, there are 4 values you are trying to "curve fit", and while a symmetry argument reduces it >>to 3, it is still one too many for a linear fit, and so I see quadratic as the lowest order polynomial you can hope for.
    I did understand your point here. However, let me jot down MY PERSPECTIVE (please, argue it and critic it as much as you want)

    During my experiments I could see that what is taking CPLEX down are the new restrictions (as I said if I force my objective function to be linear and do not create any new restriction it can solve the problem really fast). So I am focusing on transform those new restrictions in lightweight ones. For example if a restrictions

    Xi + Yi - Ti <=1, where all variables are Binary, we have the table
    TABLE
    X Y T
    0 0 0/1
    0 1 0/1
    1 0 0/1
    1 1 1

    In my model T=1 means increment the objective function, while T=0 means decrease, so every time CPLEX have the opportunity to choose between 0 or 1, it will take 0 (it is a MINIMIZE objective functions). Also, in my model, 99% of Xi + Yi expressions will fit the three first rows of the table (i.e., CPLEX will have to try T=0 and T=1 and after that pick T=0). Performing such selection for so many terms taking time and nodes when considering the branch and cut method.

    Since I know that T MUST be 1 for X=1 and Y=1 and T MUST be 0 for all the others, I am supposing that force CPLEX on doing that will allow me to get better results. Right now I am trying to create a Java program to do this, let's see if I can get better results
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Indicator Constraint and Variable indicator

    Posted Wed January 13, 2010 08:37 AM

    Originally posted by: SystemAdmin


    > giscardf wrote:
    http://...
    > MIN T1 Cost1 + T2 Cost2 + ... + TN CostN
    > X1 + Y1 - T1 <= 1
    > X2 + Y2 - T2 <= 1
    > ...
    > XN + YN - Tn <= 1

    http://...

    > In my model T=1 means increment the objective function, while T=0 means decrease, so every time CPLEX have the opportunity to choose between 0 or 1, it will take 0 (it is a MINIMIZE objective functions). Also, in my model, 99% of Xi + Yi expressions will fit the three first rows of the table (i.e., CPLEX will have to try T=0 and T=1 and after that pick T=0). Performing such selection for so many terms taking time and nodes when considering the branch and cut method.
    >
    > Since I know that T MUST be 1 for X=1 and Y=1 and T MUST be 0 for all the others, I am supposing that force CPLEX on doing that will allow me to get better results. Right now I am trying to create a Java program to do this, let's see if I can get better results

    In cases where X + Y < 2, CPLEX should not need to try both child nodes -- the solution to the LP relaxation of the current node (where X and Y are fixed) should have T = 0, and quite possibly CPLEX will fix that value based on bound information. This assumes that T appears in the model only in the objective (positively weighted) and the X + Y - T <= 1 constraint; if it appears in other constraints, all bets are off.

    If you want to experiment with this, try adding

    2*Tn <= Xn + Yn

    which removes (Xn, Yn, Tn) = (0, 0, 1), (0, 1, 1) or (1, 0, 1) from the feasible region.

    /Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Indicator Constraint and Variable indicator

    Posted Wed January 13, 2010 10:25 AM

    Originally posted by: SystemAdmin


    2T <= X + Y as a single constraint may be weaker geometrically than the pair of constraints T <= X and T <= Y - in a continuous LP model such as will be solved along the way, the single aggregated constraint is derivable from the pair, but not in reverse - consider a fractional solution like (x=1,y=0,t=0.5) which is allowed by the aggregated constraint but ruled out by the second of the pair of constraints. Of course the discussion here involves the tradeoff of making the problem bigger versus getting away from the quadratic formulation, so what I'm suggesting here is merely another alternative to try.

    Although this thread mentioned something about optimality considerations keeping T small where necessary, I would be inclined to include a constraint that covers the case (1,1,1), namely 2T - X - Y >= -1 - it is possible that the algorithm will work better if it can "see" what the feasible space is limited to. Together with T - X <= 0 and T - Y <= 0, this defines T as equivalent to X*Y for binaries.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Indicator Constraint and Variable indicator

    Posted Fri January 08, 2010 08:53 AM

    Originally posted by: Didier Vidal


    I moved this question to the ILOG CPLEX forum which seems more appropriate. I hope you will find here the answers you need.

    Regards,

    Didier Vidal.
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: Indicator Constraint and Variable indicator

    Posted Fri January 08, 2010 02:31 PM

    Originally posted by: SystemAdmin


    > giscardf wrote:
    >
    > Basically I have a problem, where the Objective Function has terms like
    > MIN X1 Y1 Cost1 + X2 Y2 Cost2 + ... + XN YN CostN
    > i.e, My objective functions is a Quadratic one and both X1..XN and Y1..YN are BINARY variables
    >
    > Hence CPLEX run faster on linear problems I did change my Objective Function to
    > MIN T1 Cost1 + T2 Cost2 + ... + TN CostN
    > And for each T1..TN a new constraint was created
    > X1 + Y1 - T1 <= 1
    > X2 + Y2 - T2 <= 1
    > ...
    > XN + YN - Tn <= 1

    This is what I would do.

    > The problem on doing that, is that for each term in objetive function I will have a new
    > constraint, and since there are thousand of terms, CPLEX is still taking too long to solve
    > the problem.
    >
    > Basically my doubt is: What I can do to improve this?

    CPLEX is pretty smart about handling non-binding constraints. Still, it might be worth specifying the constraints defining Tn as "lazy constraints". See the User Guide for a discussion of lazy constraints. Basically, they're kept in a pool and introduced when violated.
    >
    > I just read in the manual about Indicator Constraint where we can use a binary variable to "enable/disable" constraint
    > ex: constraint: X1 = 1 -> X1 + X2 + X3 <= 1 //this means, if X1 == 1, let's consider the constraint X1 + X2 + X3
    >
    > Now I am wonder if is possible do something like
    > ex: X1 + Y1 = 2 -> T1 = 1 //this means, if X1 + X2 == 1, let's force T1 be equal to 1

    I think you would have to introduce a binary variable for each sum, which gets you back where you started.

    As far as the solution taking too long, that may not be the fault of the extra constraints; it may just be that your formulation does not produce tight bounds on the objective (so that branch-and-cut has to go deeper into the tree than you might hope before pruning a node).

    /Paul
    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: Indicator Constraint and Variable indicator

    Posted Mon January 11, 2010 07:01 PM

    Originally posted by: giscardf


    Paul,

    First thanks for the comments...
    Second, here I will insert some extra information...

    You said:
    As far as the solution taking too long, that may not be the fault of the extra constraints; it may just be that your formulation does not produce tight bounds on the objective (so that branch-and-cut has to go deeper into the tree than you might hope before pruning a node).

    When I change the Objective Function from
    MIN X1 Y1 Cost1 + X2 Y2 Cost2 + ... + XN YN CostN
    to
    MIN (X1 + Y1) Cost1 + (X2 + Y2) Cost2 + ... + (XN + YN) CostN
    without add the constraints
    X1 + Y1 - T1 <= 1
    X2 + Y2 - T2 <= 1
    ...
    XN + YN - Tn <= 1
    CPLEX solve the problem in couple of seconds, and after add the constraints it takes a long long time. The problem with that is that CPLEX do not get the right answer (since I did relax the objective function)....

    Also, I did the test using Lazy Contraints and things got worst.

    I believe the problem is because every new constraint has to check both 0 and 1 for Ti when Xi/Yi are 0 0 or 0 1 or 1 0, only when Xi/Yi are 1 1 that Ti MUST be 1. And, since I do have a lot of constraints it is taking too long (and what you said, the branch and cut method is not taking too long).

    I will try to use the Java Library plust Conditional Constraints... let's see what I can do with that....
    If your guys have anything else to say... every single comment is welcome

    Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: Indicator Constraint and Variable indicator

    Posted Tue January 12, 2010 04:51 AM

    Originally posted by: SystemAdmin


    It is true that these "and" conditions (x = 1 <-> y = 1 and z = 1) are sometimes very nasty for MIP solvers, because the relaxation (which is the one that you proposed) produces a pretty bad LP bound.

    My advice is that you should try to find better parameter settings. If you have CPLEX 11 or 12, then you can try the tuning tool. I would suspect that probing could be of help for your model. Just try to set the probing parameter to 3 and see whether this speeds things up.
    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: Indicator Constraint and Variable indicator

    Posted Wed January 13, 2010 05:43 PM

    Originally posted by: giscardf



    Paul, I did try,
    2*Tn <= Xn + Yn, In fact LP files MUST use 2*Tn - Xn - Yn <= 0
    Using this we have the following table
    X Y T
    0 0 0
    0 1 0
    1 0 0
    1 1 0/1 ---> This is a problem because CPLEX will keep 0 (due to the MINIMIZE reason)

    However I could see that CPLEX solved the problem really faster, and that is because 99% (which represent the 3 first rows) of the cases CPLEX is forced to set the value of 0, for the remaining 1% it can select between 0 or 1. Summarizing, your solution doesn't solve the problem because every Ti will end equals to 0, however it helped me to make sure that my main problem is that for 99% of the cases CPLEX has to test 0 or 1 (this, when I use my initial model)


    John, I did try
    2T - X - Y >= -1
    Using this we have the following table
    X Y T
    0 0 0/1
    0 1 0/1
    1 0 0/1
    1 1 1

    This table is exactly the same I do have using my previous formulation, also I could see that using your formulation CPLEX took the same amount of time, iterations and number of nodes. Summarizinho your solution does solve the problem but is still not enough for large problem


    I am really thanks for you time spend on help me. Now I am almost sure, that the problem can be solved in a quick time, all that is necessary is an idea to eliminate the restriction, or force the 99% of the cases to have only one choice (like paul models).
    Reading the CPLEX manual I could see that Logical Constraint seems to be able on doing that. However such capability is not available on LP files... So I am trying to create a Java program to use it. However I am still learning how to use the CPLEX java library.

    If your guys has any other comments, they are welcome.

    Thanks and Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: Indicator Constraint and Variable indicator

    Posted Wed January 13, 2010 07:41 PM

    Originally posted by: giscardf


    Folks,

    I just finished the Java program that uses the "Logical Constraint". Below are the results:

    1) Logical Constraint are new restrictions behind the scenes, when we create logical constraint using Java API and export the problem to a LP file we can see
    some new constraints forcing things be equal logical constraint

    2) Basically I create two logical constraint
    Xi + Yi <= 1 <-> Ti = 0
    Xi + Yi = 2 <-> Ti = 1

    3) Comparing to the previous formulation I was able to see that CPLEX take same time to solve the problem, however number of nodes generate are hundred of times samaller.
    That is a good result, because now CPLEX will not run out of memory (at least I hope not)

    So, MY conclusions are:
    • I still did not find the right way to solve my problem, if I will take two days to solve a N=6 problem, guess how long will take to solve a N=30
    • Changing from previous forumation to "Logical Contraint" one helped a little bit, but are still not the bottom line that I need
    • The problem is really the number of Ti variables that CPLEX has to try 0 and 1 in order to take 0 (99% of the cases)
    • I could not understand why the "Logical Constraint" didn't improve the time, hence the number of nodes has decreased (would it be the time spend to
    calculate all new "logical constraint"?

    Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 13.  Re: Indicator Constraint and Variable indicator

    Posted Wed January 13, 2010 07:47 PM

    Originally posted by: SystemAdmin


    Concert is a modeling layer available in C++, Java, and C#. These all sit "on top" of the CPLEX Callable Library (tightly integrated of course). Logical constraints in Concert are implemented via straightforward constraints where possible, and with Indicator Constraints in some cases. If you export the model to an LP file from within your Java program you can see the translation. Anything that can be modeled in Java Concert should be doable in the Callable Library and representable in an LP format file; the modeling layer adds convenience and often improves maintainability (compact programs are easier to read), but generally does not improve solving speed.

    As I said in a previous post, I'll be surprised if indicator constraints help where a correct formulation is giving speed trouble in the solution algorithm; but I would never rule anything out when it comes to MIP.
    #CPLEXOptimizers
    #DecisionOptimization


  • 14.  Re: Indicator Constraint and Variable indicator

    Posted Thu January 14, 2010 03:38 AM

    Originally posted by: giscardf


    John,

    I have no clue from where did you get the statements below:

    1) 2T <= X + Y as a single constraint may be weaker geometrically than the pair of constraints T <= X and T <= Y

    2) Although this thread mentioned something about optimality considerations keeping T small where necessary, I would be inclined to include a constraint that covers the case (1,1,1), namely 2T - X - Y >= -1 - it is possible that the algorithm will work better if it can "see" what the feasible space is limited to. Together with T - X <= 0 and T - Y <= 0, this defines T as equivalent to X*Y for binaries.

    However you are completely right, CPLEX could find solutions faster, with less iterations and less number of nodes for N=4 - And the 2nd statement is still better than the 1st one.

    Now I am trying to run it with N=6, I can see CPLEX is consuming less memory and already point a better result than before (and using my forumation I did let CPLEX running for two days...:-)

    I don't believe that using the second statement I will be able to use it for N=8 or bigger, In fact I will be very happy just to find a optimum solution for N=6. However I still will have to find a way to improve the formulation...

    Thank you very much

    Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 15.  Re: Indicator Constraint and Variable indicator

    Posted Thu January 14, 2010 11:26 AM

    Originally posted by: SystemAdmin


    > giscardf wrote:
    >
    > I have no clue from where did you get the statements below:
    >
    > 1) 2T <= X + Y as a single constraint may be weaker geometrically than the pair of constraints T <= X and T <= Y

    John's right about this. Suppose the LP relaxation at some node yields X = 0 and Y = 1. With John's pair of constraints, T <= 0 (so T = 0); with my single constraint, 2T <= 1 so T could be anything between 0 and 0.5.
    >
    > 2) Although this thread mentioned something about optimality considerations keeping T small where necessary, I would be inclined to include a constraint that covers the case (1,1,1), namely 2T - X - Y >= -1

    Turnabout is fair play :-). I think John's constraint can/should be tightened to T - X - Y >= -1.

    /Paul
    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 16.  Re: Indicator Constraint and Variable indicator

    Posted Thu January 14, 2010 04:00 PM

    Originally posted by: giscardf


    Paul and John,

    First: Paul your Turnabout is right, Howecer John trick is still the faster one....:-)

    Second: I did try something new which was supposed to work better than John trick, however it didn't... John, do you have any explanation for that (see bellow):

    For each pair X*Y that I replace by T, I created a new constraint
    X = 1 -> T - Y = 0

    This uses Indicator Constraint, and keep the same table than before
    When X = 0, CPLEX can use any value for T, so it will use 0
    When X = 1, CPLEX will force T = Y, i.e., only when Y= 1 -> T = 1

    The result was OK, however it still took more time/iterations/nodes than John previous trick

    Also I am putting this idea here to see if there is any turnabout for that too....

    One more time, thank you guys for all the tips
    #CPLEXOptimizers
    #DecisionOptimization


  • 17.  Re: Indicator Constraint and Variable indicator

    Posted Wed January 20, 2010 07:39 PM

    Originally posted by: giscardf


    Paul/John,

    Did your guys have a change to look on my last post? It is on the second page of the thread....

    Well, just to summarize, John's trick was the best solution up until now.... However it still not enough to
    put CPLEX to solve the problem in a good time...

    I mean, for N=6 I let CPLEX running (and it is still running) for one week and it could not find the optimal solution.
    To be hones with your guys I don't believe it will, after one week CPLEX has visited 6,5M of nodes and there are
    still 4,5M nodes left (number of nodes left are still increasing).

    I really don't know what else to do...:-(

    Thanks and Regards
    #CPLEXOptimizers
    #DecisionOptimization


  • 18.  Re: Indicator Constraint and Variable indicator

    Posted Fri January 22, 2010 05:53 PM

    Originally posted by: SystemAdmin


    There's a very good chance that whatever is preventing faster solution is unrelated, or at best tangentially related, to how you are modeling the "logic tables". Without a much deeper understanding of the entire model, I doubt anyone in the forum can provide specific advice. A variety of factors can cause or contribute to long solution times.

    Just to name one possibility, symmetry in the model can be a killer. As a simple example, consider a bin packing problem with n identical bins. You typically end up with an array x of integer variables such that x_ij is the number of type i items packed into bin j. Since the bins are identical, taking any solution and permuting the columns of x creates a functionally identical solution that CPLEX considers to be different. It lives in a different node of the tree and, until you find a strictly superior incumbent, that node (and the nodes corresponding to other permutations) will not be fathomed. I recall one instance where somebody had a team assignment model that suffered from this sort of symmetry. Adding a constraint that eliminated most but not all of the symmetry cut her solution time by a factor of 10. You might consider whether your model suffers from any kind of symmetry. There is research on ways to modify the branch-and-cut process to eliminate symmetry, and sometimes a reformulation can mitigate most or all of it.

    Then again, there could be something unrelated to symmetry messing up your model.

    What about decomposition? Is the model such that you can decompose it into submodels and link them in a master problem?

    Does it help if you relax the bulk of the "logic table" constraints and then assert them only as needed (using cut callbacks)?

    /Paul
    #CPLEXOptimizers
    #DecisionOptimization


  • 19.  Re: Indicator Constraint and Variable indicator

    Posted Sun January 24, 2010 02:20 PM

    Originally posted by: SystemAdmin


    First, I concur with both giscardf and Paul's "turnabout" view on the formulation I proposed to force t=1 when x=y=1. I can't even claim it was a typographical error on my part, since the better formulation contains no character for me to mistype, where I placed '2'. :) And if I hadn't made the error, I would have noticed you had the better formulation for that part of it, already in your first message. That's the problem with approaching things from first principles. :)

    I have to say I am still unclear on the dimensionality of this problem. In the original posting the objective function was labeled going from 1 to N, but then later N is mentioned as being 6 or 8 with 8 being very tough. I assume this is two different meanings for what 'N' is, and in the latter case it represents a dimension in the underlying problem (warehouses, etc) that turns into many more variables, but it still would help a little to know how many variables are actually in the formulation CPLEX is being fed.

    Millions of nodes (with no prospect of being close to finished) suggests that the integer variables don't interact with each other very strongly - i.e. a branch on one decides very little about any of the others. In the extreme case, there could be a decomposition as Paul suggested. If not decomposable, maybe there exist some additional constraints that could be included that would make more explicit the reasons (say) certain groups of binary variables can not take certain combinations of values. Adding constraints usually makes the continuous relaxations harder, so one does not do it lightly (and potentially there are a combinatorial number of such constraints that could be added), but things at present sound hopeless so any tactic is at least worth a try.

    Since it sounds like the model instances are large, I don't know whether it's practical to provide one here via attachment in this forum. I'd propose not providing the ones taking a week or longer, since I bet the difficulty shows up even on easier instances that do eventually solve. That is, what you're describing sounds like worst-case brute-force behavior, and it "works" on smaller instances in the sense of converging eventually but still demonstrates the underlying difficulty, and the smaller the instance the easier it is to try to analyze.

    Quadratic models tend to have continuous relaxations with many more fractional variables than their linear counterparts, e.g.
    minimize x + y + z
    subject to x + y + z >= 1
    usually will give a solution like x=1, while
    minimize x^2 + y^2 + z^2 / 2
    subject to x + y + z >= 1
    gives x=y=z=0.33333..., which for a MIP means that the MILP version solves at the root while the MIQP needs additional processing to achieve integrality. It's not uncommon at all for MIQP models to have every integer variable take a fractional value at the root relaxation. I'm probably just stating the obvious here, but thought to mention it as a reason behind the difficulty you're facing.
    #CPLEXOptimizers
    #DecisionOptimization