Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  iloalgorithm cannot extract extractable

    Posted 06/28/16 02:09 PM

    Originally posted by: NRouge


    Hi,

    I'm new to CPLEX. I have a full model like this:

     
    int nonode=...;
    int notrip=...;
    int novec=...;
    int Q=6;//capa vec
    int M=1000;
    int tmax=24;//trip duration limit
    int T=168;
    range V=0..nonode;
    range K=1..notrip;
    range U=1..novec;
     
    tuple arc
    {int i;
    int j; }
                  
    setof(arc) Arcs = {<i,j>|i in V,j in V};
     
    int c[Arcs]=...;//cost
    int t[Arcs]=...;//time
    int d[V]=...;//demand
    int st[V]=...;//service time
    int l[V]=...;//loading time
    int a[V]=...;//earliest time
    int b[V]=...;//latest time
     
    dvar boolean x[Arcs,K];//if arc is in K
    dvar boolean o[K,U];//if trip by vec
    dvar boolean y[K,K,U];//if trip after K
    dvar boolean z[V,K];//if cust visited by K
    dvar int+ S[V,K];//service start time
    //to depot
    dvar int+ alpha[K];//trip load time
    dvar int+ d1[K];// trip service start time
    dvar int+ d2[K];//trip arrival time
     
     
    minimize sum(k in K,<i,j> in Arcs) c[<i,j>]*x[<i,j>,k];
     
    subject to {
    forall( i in 1..nonode,k in K)
    ct1: sum(j in V,<i,j> in Arcs) x[<i,j>,k]==z[i,k];
     
    forall(i in 1..nonode)
    ct2: sum(k in K) z[i,k]>=1;
     
    forall(i in V, k in K)
    ct3: sum(j in V,<i,j> in Arcs) x[<i,j>,k] -sum(j in V,<i,j> in Arcs)x[<j,i>,k] ==0;
     
    forall(k in K)
    ct4: sum(i in V,<0,i> in Arcs) x[<0,i>,k]<=1;
     

    forall(k in K)
    ct5: sum(i in 1..nonode,<i,j> in Arcs)d[i]*x[<i,j>,k]<=Q;
     
    forall(k in K)
    ct6: alpha[k]==sum(i in 1..nonode) l[i]*z[i,k];
     
    forall(<i,j> in Arcs:i!=0 && j!=0 && i!=j,k in K)
    ct7: S[i,k]+st[i]+t[<i,j>]-S[j,k]+M*x[<i,j>,k]<=M;
     
    forall(<i,0> in Arcs, k in K)
    ct8: S[i,k]+st[i]+t[<i,0>]-d2[k]+M*x[<i,0>,k]<=M ;
     
    forall(<0,i> in Arcs,k in K)
    ct9: d1[k]+alpha[k]+t[<0,i>]-S[i,k]+M*x[<0,i>,k]<=M;
     
    forall(i in V,k in K)
    ct10:   S[i,k]<=d1[k]+alpha[k]+tmax;
     
    forall(k in K)
    ct11:   sum(i in 1..nonode,<0,i> in Arcs) x[<0,i>,k]-sum(u in U) o[k,u] ==0;
     
    forall(k in K,l in K:k!=l ,u in U)
    ct12:   o[k,u]+o[l,u]-y[k,l,u]-y[l,k,u]<=1;
     
    forall(k in K,l in K:k!=l ,u in U)
    ct13:   1-y[k,l,u]-y[l,k,u]>=0;
     
    forall(k in K,l in K ,u in U)
    ct14: d2[k]-d1[l]+M*y[k,l,u]<=M;
     
    forall(i in V,k in K)
    ct15:   a[i]*z[i,k]<=S[i,k] &&
      S[i,k]<=b[i]*z[i,k];
     
    forall(k in K)
     ct16:  a[0]<=d1[k]<=b[0];
     
    forall(k in K)
    ct17:   a[0]<=d2[k]<=b[0];
     
    forall(k in K)
    ct18:   0<=d1[k]<=T;
     
    forall(k in K)
      ct19:   0<=d2[k]<=T;
    }

     

    I used ct to check for conflicts and it returns "iloalgorithm cannot extract extractable" and also conflicts in ct1,ct2 and ct5. I checked many times but I cannot find the reason for the conflicts, I can't fix it. Please help. I attached my model and data below.

     

     
     
     

    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 07:01 AM

    Hi,

    if I tell cplex to stop at the first solution

    execute
    {
    cplex.intsollim=1;
    }

    then I get a solution in 25s

    Are you a commercial user or a researcher ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 08:16 AM

    Originally posted by: NRouge


    Hi,

    I'm a student working on my project and thank you for your response, but I'm new to Cplex so I dont't know if it's right to put your command after all the code, because I did that and I run it more than 5 mins now and it's still running without giving any solution. Please help.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 08:19 AM

    Hi,

    which cplex version do you use ?

    The execute block I shared with you should be at the beginning of the .mod file

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 08:40 AM

    Originally posted by: NRouge


    Hi,

    It worked thanks a lot. I have one more question that if I stop at first solution, that solution is feasible solution, not yet optimal right?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 08:45 AM

    Right.

    You may also use a timelimit if you prefer.

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 08:57 AM

    Originally posted by: NRouge


    How can I do that? The timelimit?


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 8.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 09:00 AM

    Hi

    instead of

    execute
    {
    cplex.intsollim=1;
    }

    you could write

    execute
    {
    cplex.tilim=60; //60s
    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 9.  Re: iloalgorithm cannot extract extractable

    Posted 06/30/16 09:06 AM

    Originally posted by: NRouge


    Thank you for your help.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer