Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  constraint Big_M is No value

    Posted 05/11/17 03:27 PM

    Originally posted by: MchelLeo


    Hi Alex,

    I have a constraint, using Big_M. But I don't know why profits_value and Q[i] values are No value?. Please help me.

    .............mod...............

    {string} n = ...;
    float bubget=5;

    tuple profit{
    float cost;
    float quantity;
    float availability;
    float null;
    }
    float M = 99999999;

    profit profits [n] = ...;

    dvar float+ Q[n];
    dvar boolean X[n];
    dexpr float profits_value = sum (i in n) X[i] * Q[i];

    maximize profits_value;

    subject to {
    forall (i in n){
    Q[i] <= M * X[i];
    }

    forall (i in n){
    Q[i] <= profits[i].availability;

    }

    forall (i in n){
    sum (i in n) Q[i] * X[i]<=bubget;
    }
    }

    ........dat...........

    n = {n1,n2,n3,n4};

    profits = [<1, 2, 2, 0>

                  <3, 1, 3, 0>

                  <5, 2, 5, 0>

                  <8, 1, 6, 0>];

    Thanks,

    Leo

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: constraint Big_M is No value

    Posted 05/11/17 11:04 PM

    Originally posted by: MchelLeo


    Hi Alex,

    Please help me in advance.

    Thank you,

    Leo


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: constraint Big_M is No value

    Posted 05/12/17 02:15 AM

    Hi

    your problem is not PSD (not positive semi-definite)

    see

    https://twitter.com/AlexFleischer1/status/843806521918132225

    you could rewrite your .mod into

    {string} n = ...;
    float bubget=5;

    tuple profit{
    float cost;
    float quantity;
    float availability;
    float null;
    }
    float M = 99999999;

    profit profits [n] = ...;

    dvar float+ Q[n];
    dvar boolean X[n];
    dvar float QX[n];


    dexpr float profits_value = sum (i in n)  QX[i];

    maximize profits_value;

    subject to {
    forall (i in n){
    Q[i] <= M * X[i];

    forall(i in n) (X[i]==1) => (QX[i]==Q[i]);
    forall(i in n) (X[i]==0) => (QX[i]==0);


    }

    forall (i in n){
    Q[i] <= profits[i].availability;

    }

    forall (i in n){
    sum (i in n) QX[i]<=bubget;
    }
    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: constraint Big_M is No value

    Posted 05/12/17 12:44 PM

    Originally posted by: MchelLeo


    Hi Alex,

    I edited the constraint as follows:

    Why Q3=0, Q4=0 while X3=1, X4=1?. I want, if X=0 then Q=0. Please help me.

    ................mod....................

    {string} n = ...;
    float bubget =10;

    tuple profit{
    float cost;
    float quantity;
    float availability;
    float null;

    float M = 99999999;

    profit profits [n] = ...;

    dvar float+ Q[n];
    dvar boolean X[n];
    dexpr float profits_value = sum (i in n) Q[i];

    maximize profits_value;

    subject to {
    forall (i in n){
    Q[i] <= M * X[i];
    }

    forall (i in n){
    Q[i] <= profits[i].availability;

    forall (i in n){
    sum (i in n) Q[i] * 2 <=bubget;
    }

    ...........................dat.......................................

    n = {n1,n2,n3,n4};
     profits = [<1, 2, 2, 0>
                    <3, 1, 3, 0>
                    <5, 2, 5, 0>
                    <8, 1, 6, 0>]; 

    Thanks,

    Van Can

     

     


    #DecisionOptimization


  • 5.  Re: constraint Big_M is No value

    Posted 05/12/17 12:54 PM

    Hi,

    you have

    , if X=0 then Q=0.

    since in your solution X is always 1

    regards

    PS:

    If you add

    assert forall(i in n) (X[i]==0) => (Q[i]==0);

    after your model you do not get any error


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: constraint Big_M is No value

    Posted 05/14/17 12:13 AM

    Originally posted by: MchelLeo


    Dear Alex,

    I would like to use from Java to make this condition in OPL: (Q[i]==0) => (X[i]==0). Then, how to write?

    Thanks,

    Leo


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: constraint Big_M is No value

    Posted 05/14/17 05:08 AM

    Hi,

    if you want to rewrite that in java then you should use

    public final IloConstraint ifThen(IloConstraint con1, IloConstraint con2) throws IloException

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: constraint Big_M is No value

    Posted 05/14/17 08:33 AM

    Originally posted by: MchelLeo


    Hi Alex,

    Thank you so much for the suggestions.

    Leo


    #DecisionOptimization
    #OPLusingCPLEXOptimizer