Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  question about extreme rays

    Posted 08/12/10 02:09 AM

    Originally posted by: Sung_Hwang


    Hi! I am doing implementation of benders decomposition by using concert technoloy.

    I formulated sub problem as dual and use getRays as

    cplex.getRay(IloNumArray val, IloNumVarArray dual1[s]) ...dual1 is 2x1 matrix.

    size of dual1[s] is 1, so I thought size of val is also 1. But size of val is 11.

    This happens to other variables and size and value of val is the same for all other variables.

    What is wrong? or is it correct?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: question about extreme rays

    Posted 08/12/10 10:39 AM

    Originally posted by: SystemAdmin


    > Sung_Hwang wrote:
    > Hi! I am doing implementation of benders decomposition by using concert technoloy.
    >
    > I formulated sub problem as dual and use getRays as
    >
    > cplex.getRay(IloNumArray val, IloNumVarArray dual1[s]) ...dual1 is 2x1 matrix.
    >
    > size of dual1[s] is 1, so I thought size of val is also 1. But size of val is 11.

    Are you saying that when getRay returns, dual1[s] has length 1?

    dual1[s] is an instance of IloNumVarArray, which is extensible. If getRay has more variables to return than the size of dual1[s] at the time of the call, getRay will expand dual1[s] to make room for the number of variables. On return from the call, there should be a 1-1 correspondence between double precision entries of val and IloNumVar entries of dual1[s].

    /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


  • 3.  Re: question about extreme rays

    Posted 08/13/10 12:14 AM

    Originally posted by: Sung_Hwang


    Dear Dr. Rubin.

    thank you for reply.

    I want to ask about how to use getRay function.

    According to cplex manual, getRay (vals, vars) const puts the nonzero values of the

    unbounded direction into the array vals, and puts the corresponding variables of the extracted

    model into the array vars.

    In my model, I have total 25 decision variables and when I call getRay function, I got 11 nonzero values in vals array.

    However, I want to know which variables have nonzero values and which variables have zero values.

    In other words, I want to know information of vars array.
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: question about extreme rays

    Posted 08/13/10 11:25 AM

    Originally posted by: SystemAdmin


    > Sung_Hwang wrote:
    >
    > According to cplex manual, getRay (vals, vars) const puts the nonzero values of the
    > unbounded direction into the array vals, and puts the corresponding variables of the extracted
    > model into the array vars.
    >
    > In my model, I have total 25 decision variables and when I call getRay function, I got 11 nonzero values in vals array.
    >
    > However, I want to know which variables have nonzero values and which variables have zero values.

    Let's say that your variables are x[0],...,x24 and that getRay returns (1.3, 2.7, ..., 4.5) in vals and (x[5], x[2], ..., x[0]) in vars. Then 1.3 is the component of the ray in the x[5] direction, 2.7 is the coefficient of the ray in the x[2] direction, etc. If x[9] is one of the 14 variables that do not appear in vars, then the component of the ray in the x[9] direction is 0.

    /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


  • 5.  Re: question about extreme rays

    Posted 08/13/10 02:10 PM

    Originally posted by: Sung_Hwang


    Thank you for answer.

    How can I know X[5] is in the array of vars?

    Do I have to set decision variable name and use cplex.getName function?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: question about extreme rays

    Posted 08/13/10 03:16 PM

    Originally posted by: SystemAdmin


    > Sung_Hwang wrote:
    > Thank you for answer.
    >
    > How can I know X[5] is in the array of vars?
    >
    > Do I have to set decision variable name and use cplex.getName function?

    No. All extractable objects, such as IloNumVar, are essentially pointers. Assuming that you stored your variables some place (for instance, IloNumVarArray x = ...), you just test whether vars[i] == x[5].

    /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


  • 7.  Re: question about extreme rays

    Posted 08/13/10 04:09 PM

    Originally posted by: Sung_Hwang


    Thank you for quick reply!

    I tried it but it is not working.

    For example, I defined decisoin variable as
    IloNumVarArray2 dual1(env, 2);
    for(p=0; p<2; p++){
    dual1[p] = IloNumVarArray (env, 1, 0, IloInfinity, ILOFLOAT);
    }

    I used getRay(); function as
    cplex.getRay(IloNumArray vals, IloNumVarArray vars);

    As you commented, I tried to check value
    if(vars[0]==dual[1][0]){
    chekc=1;
    }

    But I have error message that C2451: conditoinal expression of type 'IloConstraint' is illega.

    please let me know what's wrong with it

    Thank you againg your help
    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: question about extreme rays

    Posted 08/13/10 04:21 PM

    Originally posted by: SystemAdmin


    What's wrong is that, besides being inherently evil itself, C++ promotes evil practices in programmers, and the designers of CPLEX were not immune. They overloaded the == operator globally so that vars[0]==dual1[1][0] looks like a constraint rather than a comparison. Try comparing vars[0].getId() to dual1[1][0].getId(), which compares the (hopefully unique) id numbers CPLEX assigns to each extractable object, and see if that works any better.

    /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: question about extreme rays

    Posted 08/13/10 04:26 PM

    Originally posted by: Sung_Hwang


    Thank you.

    it works now..:)
    #CPLEXOptimizers
    #DecisionOptimization