Decision Optimization

 View Only
Expand all | Collapse all

Function operator/(int,dvar int) not available in context CPLEX

  • 1.  Function operator/(int,dvar int) not available in context CPLEX

    Posted Wed April 11, 2012 04:18 AM

    Originally posted by: fizazul


    Dear all..
    i dunno what wrong with my coding.and i dunno how to correct the error.is anyone can help me?

    
    
    
    int c = ...; range customer = 1..c; 
    
    float sigma[customer]=...; 
    
    float alpha[customer]=...; 
    
    int hd[customer]=...; 
    
    int hw[customer]=...; 
    
    int S[customer]=...; 
    
    int Ab[customer]=...; 
    
    float beta=...; 
    
    int Av=...; 
    
    int Ar=...; 
    
    int hv=...; 
    
    int hr=...; 
    
    int P=...; 
    
    float T[customer];   
    //decision variables dvar 
    
    int n_r; dvar 
    
    int n_v[customer]; dvar 
    
    int n_b[customer]; dvar 
    
    float q1[customer];   
    //objective function maximize sum(i in customer)(-(Av+n_r*Ar)/(n_v[i]*n_b[i]*T[i])) -sum(i in customer)(hv*((n_b[i]*q1[i])/2)*((2-n_v[i])*q1[i]/(P*T[i])+(-1+n_v[i])-hr*(n_v[i]*n_b[i]*q1[i])/(2*T[i]*n_r*P))) +sum(i in customer)(sigma[i]*(q1[i])/(T[i])-(1/(T[i]))*(((Ab[i])/(n_b[i]))+(S[i])) +hd[i]*((1-beta)/(2-beta))*q1[i]+(hw[i]/2)*(n_b[i]-1)*q1[i]) ; subject to 
    { ct1: forall(i in customer)q1[i]>=1; ct2: forall(i in customer)q1[i]<=500; ct3: forall(i in customer)T[i]==((q1[i])^(1-beta)) /(alpha[i]*(1-beta));   
    }
    


    and here is the data;
    {code}
    c=2;
    sigma=30,20;
    alpha=100,130 ;
    hd=20,18;
    hw=5,8;
    S=25,30;
    Ab=100,500;
    beta=0.1;
    Av=400;
    Ar=200;
    hv=3;
    hr=5;
    P=4500;
    (code)
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Function operator/(int,dvar int) not available in context CPLEX

    Posted Mon April 16, 2012 10:08 AM
    Hi,

    what you do is not possible with CPLEX. (Not linear)
    With CP Optimizer, it would work better:

    
    using CP;   
    
    int c = ...; range customer = 1..c; 
    
    float sigma[customer]=...; 
    
    float alpha[customer]=...; 
    
    int hd[customer]=...; 
    
    int hw[customer]=...; 
    
    int S[customer]=...; 
    
    int Ab[customer]=...; 
    
    float beta=...; 
    
    int Av=...; 
    
    int Ar=...; 
    
    int hv=...; 
    
    int hr=...; 
    
    int P=...; 
    
    float T[customer]; 
    //decision variables dvar 
    
    int n_r; dvar 
    
    int n_v[customer]; dvar 
    
    int n_b[customer];   dvar 
    
    int q2[customer] in -1000000..1000000; dexpr 
    
    float q1[c in customer]=q2[c]/1000;; 
    //objective function maximize sum(i in customer)(-(Av+n_r*Ar)/(n_v[i]*n_b[i]*T[i])) -sum(i in customer)(hv*((n_b[i]*q1[i])/2)*((2-n_v[i])*q1[i]/(P*T[i])+(-1+n_v[i])-hr*(n_v[i]*n_b[i]*q1[i])/(2*T[i]*n_r*P))) +sum(i in customer)(sigma[i]*(q1[i])/(T[i])-(1/(T[i]))*(((Ab[i])/(n_b[i]))+(S[i])) +hd[i]*((1-beta)/(2-beta))*q1[i]+(hw[i]/2)*(n_b[i]-1)*q1[i]) ; subject to 
    { ct1: forall(i in customer)q1[i]>=1; ct2: forall(i in customer)q1[i]<=500; ct3: forall(i in customer)T[i]==((q1[i])^(1-beta)) /(alpha[i]*(1-beta)); 
    }
    


    Regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer