Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  I have a Mixed Integer Programming problem,there's some mistake

    Posted 11/14/11 07:28 PM

    Originally posted by: chinaboy


    programme is here:

    int nbJobs = ...;
    int nbMchs = ...;

    {int} M={2};
    {int} M2={0,1};

    range Jobs = 0..nbJobs;
    range Mchs = 0..nbMchs-1;

    int arrivalTimehttp://0..nbJobs=...;
    int OpDurationsj in Jobsm in Mchs = ...;

    dvar float+ sj in Jobsm in Mchs;
    dvar float+ cj in Jobsm in Mchs;
    dvar float+ gj in Jobsk in Jobsm in Mchs;
    dvar int hj in Jobsm in Mn in M2= s[j][m]> s[j][n]?1:0;

    execute {
    cp.param.FailLimit = 100000000;
    }

    minimize max(j in Jobs, m in Mchs) c[j][m];
    subject to {
    forall (j in Jobs,m in Mchs)
    s[j][m]>=arrivalTime[j];
    forall (j,k in Jobs:j!=k,m in Mchs)
    s[j][m]>=(s[k][m]+OpDurations[k][m])*g[j][k][m];
    forall (j in Jobs,m in M2,n in M)
    s[j][m]>=(s[j][n]+OpDurations[j][n])*h[j][m][n]&&s[j][n]>=(s[j][m]+OpDurations[j][m])*h[j][n][m];
    forall (j in Jobs,m in Mchs)
    c[j][m]==s[j][m]+OpDurations[j][m];
    forall (j,k in Jobs:j!=k,m in Mchs)
    g[k][j][m]+g[j][k][m]==1;
    forall (j,k ,l in Jobs:j!=k||j!=l||k!=l,m in Mchs)
    g[k][j][m]+g[l][k][m]+g[j][l][m]<=2;

    }

    The data document is here:

    nbJobs = 3;
    nbMchs = 3;
    OpDurations = [
    3,7,5
    1,4,7
    8,2,6
    4,9,4] ;
    arrivalTime=1,2,1,0;
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  the whole programme is here

    Posted 11/14/11 07:32 PM

    Originally posted by: chinaboy


    There is some mistake,I don't know the problem
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: the whole programme is here

    Posted 11/14/11 11:11 PM

    Originally posted by: SystemAdmin


    Here are some of the things which I find amiss in your code:

    1) Declaration of h
    
    dvar 
    
    boolean h[j in Jobs][m in M][n in M2];
    //= s[j][m]> s[j][n]?1:0;
    

    A decision variable cannot be used in the conditional initialization of another decision variable. Assuming that h can only take boolean values (0/1), I would instead declare h as boolean. Along with that the 2nd and 3rd indexes of h should be Mchs and not M and M2 since you have constraints in which h[j][m][n] and h[j][n][m] are used. It seems that h represents a variable denoting whether a certain job is assigned to a certain machine(s) or not and hence you multiply it with OpDurations in certain constraints. To accomodate all these requirements, it is better for you to use indicator constraints since they will prevent converting the MIP to a MIQCP. Here's one way to do so (I have added constraint names as well):

    
    dvar 
    
    boolean h[j in Jobs][m in Mchs][n in Mchs]; ... subject to
    { 
    //indicator constraints for h[][][] forall(j in Jobs, m in M, n in M2)
    { (s[j][m]>=s[j][n]+epsilon) => h[j][m][n]==1; (s[j][m]<=s[j][n]+epsilon) => h[j][m][n]==0; (h[j][m][n]==0) => OpDurations[j][n]==0; (h[j][n][m]==0) => OpDurations[j][m]==0; 
    } ... forall (j in Jobs,m in M2,n in M)
    { Constraint3: s[j][m]>=(s[j][n]+OpDurations[j][n]); Constraint4: s[j][n]>=(s[j][m]+OpDurations[j][m]); 
    }
    


    2) Given the model structure, you seem to be using CPLEX and not the CP engine, and thus the execute block is misplaced. You will need to comment that section out:
    
    /*execute { cp.param.FailLimit = 100000000; }*/
    


    3) Even after all these changes, the model is not solvable since because of the quadratic constraint:
    
    forall (j,k in Jobs:j!=k,m in Mchs) Constraint2:s[j][m]>=(s[k][m]+OpDurations[k][m])*g[j][k][m];
    


    The Q matrix in this constraint is not positive semi-definite and hence CPLEX throws a CPLEX Error 5002 error when trying to solve this model, indicating that the problem is non-convex in nature. I donot understand the g variable, but if it is just an indicator type of variable, then you could do something like what we did for the other quadratic constraint.

    Please find the modified mod file attached. Hope this helps and provides you a way forward.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: the whole programme is here

    Posted 11/15/11 07:09 AM

    Originally posted by: chinaboy


    Thank you very much for helping me.
    I want the "g[j][k][m]" variable to be this form:
    "g[j][k][m]"is an linear variable and range is from 0 to 1.Using the mathematic way is "0<=g[j][k][m]<=1".So I don't know If it can come true.
    Thank you again
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: the whole programme is here

    Posted 11/15/11 01:17 PM

    Originally posted by: SystemAdmin


    > I want the "g[j][k][m]" variable to be this form:
    > "g[j][k][m]"is an linear variable and range is from 0 to 1.Using the
    > mathematic way is "0<=g[j][k][m]<=1".So I don't know If it can come
    > true.

    The variable range can be made part of the declaration by replacing:

    dvar float+ g[j in Jobs][k in Jobs][m in Mchs];
    


    by

    dvar float+ g[j in Jobs][k in Jobs][m in Mchs] in 0..1;
    


    This however, will not be enough to make the Q matrix associated with Constraint2 positive-semi definite (PSD). I would recommend you to go through the following documentation on QCPs about convexity and then see if you can come up with alternate formulations for your MIQCP such that the Q matrix is PSD:

    http://publib.boulder.ibm.com/infocenter/cosinfoc/v12r3/index.jsp?topic=%2Filog.odms.cplex.help%2FContent%2FOptimization%2FDocumentation%2FOptimization_Studio%2F_pubskel%2Fps_usrmancplex1785.html

    I hope this helps.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer