Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Incorrect results for MIP problem

    Posted 02/12/10 07:44 PM

    Originally posted by: Bo7


    Hi for the example attached with this post i get as optimal result 382 instead of 362 (the correct result).
    I think that the problem is ill conditioned and this why i get this error because when i reduce some high coefficients the result become correct but for a bigger problem i have to reduce more those coefficients but i can't .
    i use very high coefficients in some constraints( in the order 1e+9) and they must be like this.

    I hope that you could tell me how to fix this problem with changing some parameters but without changing the constraints.

    Thank you in advance.

    Ps : the problem is MIP and the file format is lp
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Incorrect results for MIP problem

    Posted 02/13/10 08:51 AM

    Originally posted by: SystemAdmin


    It seems that you are using the binary alpha variables to turn on and off individual constraints. Because the bounds of your variables are so large, you need to use big-M coefficients in the order of 1e+9. This is really terrible for the numerics in a floating point based solver.

    CPLEX provides a feature for exactly this purpose: indicator variables.

    For example, you have the following constraint and bounds in your model:

    IloC14: - c2 + r1 - 1000000000 alph0 <= 33
    Bounds
    -2000000000 <= c2 <= 2000000000
    -2000000000 <= r1 <= 2000000000
    Binaries
    alph0

    You can rewrite IloC14 with indicator constraints as follows:
    IloC14: - c2 + r1 <= 1000000033
    IloC14ind: alph0 = 1 -> -c2 + r1 <= 33

    This can still be hard to solve, but it should remove most of the numerical issues from your model. I wonder whether you really need the new IloC14 constraint. If alph=0, it looks like you wanted to model that the constraint should not be enforced at all. If this is true, you only need the IloC14ind constraint.

    As an additional remark: all of your variables are general integer variables, even though the bounds are of +/-2e+9. This is again terrible for a MIP solver, and it usually does not make any sense from the modeling point of view. For example, if you model currency exchange in large quantities. Of course, it is true that you cannot buy dollars in fractional cents. But if the dollar values in the problem are in the order of several millions, then fractional cents just do not matter. Just model them as continuous variables and round the final solution to an integral cent amount. Of course, this rounded solution may not be feasible or optimal in the strict mathematical sense of the model, but I doubt that this would ever matter in practice.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Incorrect results for MIP problem

    Posted 02/14/10 10:57 AM

    Originally posted by: Bo7


    Thank you very much for your help it resolved the problem.
    In fact what im trying to do is
    r1 <= max(a2+99,c2+33)
    and max is a non-linear function so i linearize it with using M im knew to cplex i didn t knew about variable indicator or if there is another better solution to modelize this.

    Can you tell me why using big coefficients is bad for numerical solvers.
    and if you have any idea how to write variable indicator with C# beacause im using API.

    Thank you again for your help.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Incorrect results for MIP problem

    Posted 02/14/10 11:17 AM

    Originally posted by: SystemAdmin


    Yes, max is an issue for MIP models, and incidator constraints are certainly a good option to deal with it if you do not have tight bounds for the involved variables (if you have, a standard big-M formulation, which you tried, can sometimes be better than indicator constraints).

    In C, the method to add indicator constraints is called CPXaddindconstr(). Since the various interfaces are pretty similar in the naming scheme, you need to search the docs for a C# method of a similar name. I don't have the docs in front of me at the moment, but I guess the method should be called something like cplex.addIndConstr().

    Big-M formulations are terrible in terms of numerics because you can easily satisfy a big-M constraint by introducing a tiny non-zero value to the variable. For example, the constraint

    (1) x - 1000000000y <= 0

    with a continuous variable x and binary y can be easily satisfied by almost integral solutions like (x=10,y=1e-8). The 1e-8 is so small that CPLEX treats this as an integral value. Additionally, a mix of big and small numbers can be very harmful to the LU factoriziation code. Assume that there is another constraint

    (2) 0.33333z - y = 0,

    and the factorization decides to eliminate y. Then we need to multiply (2) with 1e+9 and subtract it from (1). The result is

    (1)-1e+9*(2) x - 333330000z <= 0.

    As you can see, imprecise input data (the 0.33333 probably should actually be 1/3) and round-off errors in previous calculations can be scaled up to a significant error if the factorization needs to use large row weights to eliminate non-zeros.

    Indicator constraints help for both of these issues. The first one is addressed, because we deal with indicator constraints by branching: after branching on y=0 x is forced to be exactly 0. The second issue is addressed because indicator constraints do not appear in the coefficient matrix and thus do not hurt the LU factorization.
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Incorrect results for MIP problem

    Posted 02/14/10 01:47 PM

    Originally posted by: Bo7


    Thank you again for the explanation and the help.
    #CPLEXOptimizers
    #DecisionOptimization