Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Relation between the matrices

    Posted 12/07/17 08:11 AM

    Originally posted by: felycite28


    Hello everyone ,

    I have small question .

    I am computing a summation

    po=sum( a in t)p[a] and tying to minimum value greater than po in a list ; My po=65 it is good so far , after thta I have to find 70 from the list

    I did :

    int A=...;
    range a=1..A;

    range k=1..K;

    AR=[20 30 40 50 60 70]

    po=sum( a in t)p[a]

    minValue=(min(k in a : AR[k] >= po));

     

    and it did not work ? Can you give me an idea to correct it or ay other suggestion to find 70 ?

     

    Thanks in advance

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Relation between the matrices

    Posted 12/07/17 10:10 AM

    Hi,

     int A=6;
    range k=1..A;

    int AR[k]=[20 ,30, 40, 50, 60, 70];

    int po=65;

    int MinValue=AR[min(k in k : AR[k]>=po)k];

    execute
    {
    writeln(MinValue);
    }

    gives

    70

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Relation between the matrices

    Posted 12/07/17 10:52 AM

    Originally posted by: felycite28


    Thanks Alex ,

    In my case , po is a decision variable , this time is 65, next time it might be 80, I should have told you before . That swhhy when I try the way you showed I get this error:
    Variable de décision (ou expression) "po" non autorisée. 

     

    I could not know how can I handle it ?

     

    Thanks

     

    Is not it possible to compare with a decision variable and the elements of a list?

     

     


     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Relation between the matrices

    Posted 12/07/17 01:14 PM

    Hi,

    Logical constraints could help.

    Then you could write

    int A=6;
    range K=1..A;

    int AR[K]=[20 ,30, 40, 50, 60, 70];

    dvar int po;
    dvar boolean ARofkismorethanpo[K];
    dvar int indexMin in K;
    dvar int MinValue;


    subject to
    {
    po==65;

    forall(k in K) ARofkismorethanpo[k]==(AR[k]>=po);

    indexMin==A+1-max(k in K) ARofkismorethanpo[k]*(A+1-k);

    forall(i in K) (i==indexMin) => (MinValue==AR[i]);

    }

    int MinValue2=AR[min(k in K : AR[k]>=po)k];
    execute
    {
    writeln(MinValue);
    writeln(MinValue2);
    }

    regards

     

    https://www.linkedin.com/pulse/how-opl-alex-fleischer/


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Relation between the matrices

    Posted 12/07/17 05:00 PM

    Originally posted by: felycite28


    Than you so much Alex, Million thanks ,

    Now, I need to ask my real question. I found 70 as you taught, I want to reach another matrix which is data again ,  related this 70.Basically,

    I did something:

    int A=6;

    t=3;
    range K=1..A;

    int AR[K]=[20 ,30, 40, 50, 60, 70];

    M[k][t]=[[1 2 3 ]// this line corresponds 20

                [0.2 0.3 0.4]// this line corresponds 30 so on

               [.................]

              [ 2   5  7]] // this line corresponds 70

    So I should be able to choose this last line which is related to 70? I will use this line as data for the constraint.

    How can I do that ? I tried to use M[indexMin][t] but did not work .

    Thank you so much in advance

     

     

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Relation between the matrices



  • 7.  Re: Relation between the matrices

    Posted 12/08/17 04:53 AM

    Originally posted by: felycite28


    Yes , it helped but it still got en error , I have to use indexMin again for the other operation . Imagine a; data. b is also decision variable. Y[t] is the latest line which will correspond the latest line , corresponds 70  in the previous post. It will multiply with 2,5,7 in order.

     

    min (sum z in t) Y[z]*a*b

    int A=6;

    z=3;
    range K=1..A;

    int AR[K]=[20 ,30, 40, 50, 60, 70];

    M[k][z]=[[1 2 3 ]// this line corresponds 20

                [0.2 0.3 0.4]// this line corresponds 30 so on

               [.................]

              [ 2   5  7]] // this line corresponds 70

     

    I did:

    forall (z in t, i in K)(i==indexMin)=>(Y[z]==M[i][z]);

    It did not turn result, and said

     


    CPLEX Error  5002: Q in objective is not positive semi-definite.  since I described the Y[z] as dvar, it gives this result but It is not that much decision variable . Is there any other way to do it ? It must be , I guess.

    Thank you so much

     

     

     

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: Relation between the matrices

    Posted 12/08/17 05:36 AM

    Hi,

    can you post your model so that other users could help ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer