Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  summation with max function

    Posted 12/01/12 12:44 PM

    Originally posted by: SystemAdmin


    Hi all,

    I have an objective function listed in below. But I can not compile it, the CPLEX said "cannot extract extractable". Can anyone help me to solve this. Thanks

    rangeI = 1..M;
    rangeJ2 = 1..M;

    minimize
    sum(j in rangeJ2)(
    t[j] +
    (max(i in rangeI)
    (d[i] -a[i]) * z[i][j]
    )
    )
    ;
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: summation with max function

    Posted 12/03/12 11:04 AM
    Hi,

    which are data and which are decision variables?
    If you post your real model maybe someone will be able to help you.

    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: summation with max function

    Posted 12/26/12 11:17 AM

    Originally posted by: SystemAdmin


    Hi, thanks for your reply.
    Here are my code with comments.

    This is a toy code to test my idea.

    using CP;
    int M = 10;//M number of newly arrival jobs
    int N = 100; //N number of running instances
    int maximumMachineCapacity = 100;
    int maximumJobConsumption = 100;
    int numberOfRunningMachines = 100;

    range rangeI = 1..M; //M number of jobs
    range rangeJ = 1..M;
    range rangeJ2= 1..N; // there are N number of running VM
    float ci in rangeI = 1;
    int wnewi in rangeI = 100; //w'_k, capacity of new provisioned vm
    int ri in rangeI = ((i % 10)+1) * 10;
    int wj in rangeJ2 = 20; //w_j
    int tj in rangeJ = 1; //the boot time of each running instance
    int dj in rangeI = 1; //departureTime of each jobs, in second
    int aj in rangeI = 1; //arrival of each jobs, in second
    dvar int xi in rangeIj in rangeJ in 0..1; //whether job i is assigned to new provisioned-machine j
    dvar int zi in rangeIj in rangeJ2 in 0..1; //whether job i is assigned to running machine j
    dvar int yj in rangeI in 0..1; //whether machine j is provisioned
    minimize
    sum(j in rangeJ2)(
    t[j] +
    (max(i in rangeI)
    (d[i] -a[i]) * z[i][j]
    )
    )
    ;

    subject to {

    forall(j in rangeJ2)
    sum(i in rangeI)
    z[i][j] * r[i] <= w[j];

    forall(j in rangeI)
    sum(i in rangeI)
    x[i][j] * r[i] <= wnew[j] * y[j];

    forall(i in rangeI)
    sum(j in rangeJ2)
    z[i][j] +
    sum(k in rangeJ)
    x[i][k] == 1;

    forall(j in rangeI)
    forall(i in rangeI)
    x[i][j] <= y[j];

    }
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: summation with max function

    Posted 12/26/12 08:02 PM

    Originally posted by: SystemAdmin


    Look at these two lines:

    int t[j in rangeJ] = 1; //the boot time of each running instance
     
    minimize sum(j in rangeJ2)(t[j] + (max(i in rangeI) (d[i] -a[i]) * z[i][j]));
    


    t is defined over rangeJ (1..10), but the sum to minimize is defined over rangeJ2 (1..100), so you have an Index Out Of Bound Exception at Runtime. You probably want either to define t over rangeJ2, or to define the sum over rangeJ.

    Regards,
    Stefano
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: summation with max function

    Posted 12/30/12 09:16 PM

    Originally posted by: SystemAdmin


    Thank you very much.
    This problem is solved.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer