Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  quadratic objective

    Posted 06/02/16 01:23 AM

    Originally posted by: sandeepsinghchauhan


    I have this sparsity model and here i include one boolean variable which makes my objective quadratic. so what are the changes i need to do to handle this Z variable

     

    {string} Cities = ...;
    {string} Products = ...;
    float Capacity = ...;

    tuple route {
      string p;
      string o;
      string d;
    }
    {route} Routes = ...;

    tuple supply {
      string p;
      string o;
    }
    {supply} Supplies = { <p,o> | <p,o,d> in Routes };
    float Supply[Supplies] = ...;

    tuple customer {
      string p;
      string d;
    }
    {customer} Customers = { <p,d> | <p,o,d> in Routes };
    float Demand[Customers] = ...;
    float Cost[Routes] = ...;

    {string} Orig[p in Products] = { o | <p,o,d> in Routes };
    {string} Dest[p in Products] = { d | <p,o,d> in Routes };

    assert forall(p in Products)
      sum(o in Orig[p])
        Supply[<p,o>] == sum( d in Dest[p] ) Demand[<p,d>];

    dvar float+ Trans[Routes];
    dvar boolean Z[Routes];  
    constraint ctSupply[Products][Cities];
    constraint ctDemand[Products][Cities];

    minimize
      sum(l in Routes) Cost[l] * Trans[l] * Z[l];
       
    subject to {
      forall( p in Products , o in Orig[p] )

        ctSupply[p][o]:
          sum( d in Dest[p] )
            Trans[< p,o,d >] == Supply[<p,o>];
      forall( p in Products , d in Dest[p] )
        ctDemand[p][d]:  
          sum( o in Orig[p] )
            Trans[< p,o,d >] == Demand[<p,d>];
      ctCapacity:  forall( o , d in Cities )
                     sum( <p,o,d> in Routes )
                       Trans[<p,o,d>] <= Capacity;
                       
      active:
         forall( l in Routes)
                                   
                       Z[l] == minl(1,Trans[l]);
                  
    }

    Error


    CPLEX Error 5002: Q in objective is not positive semi-definite.   

    please help


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: quadratic objective

    Posted 06/02/16 07:28 AM

    Hi,

    Why not using logical constraints ?

    you could try to rewrite

    sum(l in Routes) Cost[l] * Trans[l] * Z[l];

    into

    sum(l in Routes) Cost[l] * ZTrans[l];

    and add in the constraints that for all I

    (ZTrans[i]==0) == (Z[I]==0);

    (ZTrans[i]==Trans[I]) == (Z[i]==1);

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer