Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Which method is much better to solve the non-convex objective?Using CP or through adding “execute" order?

  • 1.  Which method is much better to solve the non-convex objective?Using CP or through adding “execute" order?

    Posted 12/26/17 11:44 PM

    Originally posted by: Eillien


    Hicommunity,

    I am trying to solve a mixed integer quadratic programming with CPLEX 12.7.0, where the objective function is as the attachments shown. Both g_j and x_ij are decision variables.

    Actually, I found that there may be two ways to solve it. One is "using CP", and the other one is through adding "execute {cplex.params[1131] = 3; }". But the problem is that the respective results using two methods are different.

    So I am confused. I don't know what the reason is. Is it because the two solving principles in two methods? If so, which one is better? Could you give me some suggestions? Thank you so much in advance!

    Here are my codes.And I put the results I've got into the attachments .

    The first kind of code is as follows:

    .mod

    using CP;

     

    {string}Subc=...;

    {string}Disa=...;

    intcapacity[Subc]=...;

    floattransc[Subc][Disa]=...;

    floatderec[Disa]=...;

    floatamount[Disa]=...;

    floatrate[Disa]=...;

    floatdensity[Disa]=...;

    dvar  int+x[Subc][Disa] ;

    dvar  intscalep[Disa];

    dvar  intscaleg[Disa];

    intscale=1000;

     

    dexpr  floatp[j in Disa]=scalep[j]/scale;

    dexpr  floatg[j in Disa]=scaleg[j]/scale;

    dexpr floatmaxg= max(j in Disa) g[j];

    dexpr floatming= min(j in Disa) g[j];

     

    maximize

    sum(jin Disa)(p[j]-derec[j])*amount[j]*g[j]-sum(i in Subc,j in Disa)transc[i][j]*x[i][j];

     

    subject to{

    forall(i in Subc)

         ct1:

          sum (j in Disa) x[i][j]<=capacity[i];

      forall (j in Disa)

          ct2:

           amount[j]*g[j]<=(sum(i in Subc)x[i][j])*8334;

       forall (j in Disa)

             ct3:

          p[j]==(-0.00000556)*amount[j]*g[j]+16.6;

       forall(j in Disa)

         ct4:

        g[j]>=0.2;

          ct5:

         maxg-ming<=0.4;

        forall(j in Disa)

          ct7:

           g[j]>=0&& g[j]<=1;

        forall(i in Subc,j in Disa)

          ct8:

           x[i][j]>=0;   

      }

     

    .dat

    Subc={A1 A2 A3 A4 A5 A6};

    Disa={B1 B2};

    capacity=#[A1:50 A2:50 A3:50 A4:50 A5:50 A6:50]#;

    transc=#[A1: #[B1:1151.04 B2:1086.73]#

             A2: #[B1:1151.04 B2:1032.23]#

             A3: #[B1:546.09 B2:521.02]#

             A4: #[B1:831.67 B2:834.94]#

             A5: #[B1:851.29 B2:825.13]#

             A6: #[B1:771.72 B2:736.84]#]#;

    derec=#[B1:0.4 B2:0.4]#;

    amount=#[B1:2500000 B2:100000]#;

    rate=#[B1:100 B2:100]#;

    density=#[B1:500 B2:500]#;

    Then, the second type of code as follows:

    {string} Subc=...;

    {string} Disa=...;

    int capacity[Subc]=...;

    float transc[Subc][Disa]=...;

    float derec[Disa]=...;

    float amount[ Disa]=...;

    float rate[ Disa]=...;

    float density[ Disa]=...;

    dvar int+ x[Subc][Disa]  ;

    dvar float+ p[Disa];

    dvar float+ g[Disa];

    dexpr float maxg= max(j in Disa) g[j];

    dexpr float ming= min(j in Disa) g[j];

     

    execute { cplex.params[1131] = 3; } 

    maximize

    sum(j in Disa)(p[j]-derec[j])*amount[j]*g[j]-sum(i in Subc,j in Disa)transc[i][j]*x[i][j];

     

    subject to {

      forall (i in Subc)

         ct1:

           sum (j in Disa) x[i][j]<=capacity[i];

      forall (j in Disa)

          ct2:

           amount[j]*g[j]<=(sum(i in Subc)x[i][j])*8334;

       forall (j in Disa)

          ct3:

          p[j]==(-0.00000556)*amount[j]*g[j]+16.6;

       forall(j in Disa)

          ct4:

           g[j]>=0.2;

          ct5:

           maxg-ming<=0.4;

        forall(j in Disa)

          ct6:

           p[j]>=0;

        forall(j in Disa)

          ct7:

           g[j]>=0 && g[j]<=1;

        forall(i in Subc,j in Disa)

          ct8:

           x[i][j]>=0; 

      }

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Which method is much better to solve the non-convex objective?Using CP or through adding “execute" order?

    Posted 12/27/17 02:04 AM

    As you can see in the output, at least the 'execute' run did not stop with a solution that was proven optimal. The output says 'solution (integer optimal, tolerance)' which means that CPLEX stopped early because the current solution was optimal within tolerances.

    As long as you allow any of the approaches to stop with solutions that are optimal within tolerances they may produce different results, If you want to compare the results of the two methods then you have to set the gap tolerances (absolute and relative MIP gap) for CPLEX to 0. What to do for CP you will have to ask on one of the CP Forums.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Which method is much better to solve the non-convex objective?Using CP or through adding “execute" order?

    Posted 01/18/18 08:37 AM

    Originally posted by: Eillien


     Hi,

        Thank  you very much! Your suggestion helped me a lot.


    #CPLEXOptimizers
    #DecisionOptimization