INFEASIBLE EQUATIONS

521 views
Skip to first unread message

Vahid reza Mohammadi

unread,
Jun 2, 2014, 7:25:38 AM6/2/14
to gams...@googlegroups.com
hi,everyone
after my model solved with gams error **Equation infeasible due to rhs value** occured. please help me to correct it.
my code is following:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 1  sets
   2  j activity / a1*a7 /
   3  k resource type  / k1*k3 /
   4  t time period / 1*20 /
   5  m mode /m1*m2 / ;
   6  alias(i,j) ;
   7  alias(u,t);
   8  variables
   9  x(j,m,t) activity j in mode m in time t
  10  sr(k) recruitment date of resource type k
  11  fr(k) release date of resource type k
  12  z1 total present value
  13  z2 total cost of resource ;
  14  binary variables x ;
  15  integer variables sr, fr ;
  16  parameters
  17  c(k) unit cost of resource types per unit time
  18  /  k1  14
  19     k2  23
  20     k3  17 /
  21  d(j,m) duration of activity j in mode m
  22  / a2. m1 = 4
  23    a2. m2 = 7
  24    a3. m1 = 3
  25    a3. m2 = 7
  26    a4. m1 = 2
  27    a4. m2 = 4
  28    a5. m1 = 6
  29    a5. m2 = 8
  30    a6. m1 = 3
  31    a6. m2 = 5 /
  32  cf(j,m) cashflow of activity j in mode m
  33  / a2. m1 = 100
  34    a2. m2 = 200
  35    a3. m1 = 300
  36    a3. m2 = 400
  37    a4. m1 = 500
  38    a4. m2 = 600
  39    a5. m1 = 700
  40    a5. m2 = 800
  41    a6. m1 = 900
  42    a6. m2 = 1000 /
  43  r(j,k,m) resource requirement of activity j in mode m for resource type k
  44  / a2. k1. m1 = 9
  45    a2. k1. m2 = 6
  46    a3. k1. m1 = 12
  47    a3. k1. m2 = 6
  48    a3. k3. m1 = 11
  49    a3. k3. m2 = 6
  50    a4. k1. m1 = 3
  51    a4. k1. m2 = 1
  52    a4. k2. m1 = 4
  53    a4. k2. m2 = 1
  54    a4. k3. m1 = 3
  55    a4. k3. m2 = 2
  56    a5. k2. m1 = 3
  57    a5. k2. m2 = 2
  58    a5. k3. m1 = 4
  59    a5. k3. m2 = 3
  60    a6. k1. m1 = 9
  61    a6. k1. m2 = 6
  62    a6. k2. m1 = 4
  63    a6. k2. m2 = 2 /
  64  a(k) constant availability of renewable resource type k
  65  / k1  30
  66    k2  40
  67    k3  50 /
  68  ES(j) earliest start time of activity j
  69  /a2 1
  70  a3 1
  71  a4 5
  72  a5 5
  73  a6 4
  74  a7 20/
  75  LS(j)
  76  /a2 7
  77  a3 7
  78  a4 17
  79  a5 13
  80  a6 16
  81  a7 20/ ;
  82  scalar w deadline of the project /20/ ;
  83  scalar v discount rate /0.05/ ;
  84  equations
  85  value define objective function 1
  86  cost  define objective function 2
  87  precedence(i,j) precedence constraint
  88  execution(j) start time in one execution mode
  89  resources(k,t) renewable resources limitations
  90  recruitment(j,k) recruitment dates for resources
  91  release(j,k) release dates for resources
  92  deadline(j,m) project deadline is not violated ;
  93  value.. z1 =e= sum((j,m,t)$(ord(t)>= ES(j)and ord(t)<= LS(j)),cf(j,m)*exp(
      -v*ord(t))*x(j,m,t)) ;
  94  cost.. z2 =e= sum(k,c(k)*a(k)*(fr(k)-sr(k))) ;
  95  precedence(i,j).. sum((t,m)$(ord(t)>= ES(j)and ord(t)<= LS(j)),ord(t)*x(j,
      m,t))=g= sum((t,m)$(ord(t)>= ES(i)and ord(t)<= LS(i)),(ord(t)+d(i,m))*x(i,
      m,t)) ;
  96  execution(j).. sum((t,m)$(ord(t)>= ES(j)and ord(t)<= LS(j)),x(j,m,t)) =e=
      1 ;
  97  resources(k,t).. sum((j,m,u)$(ord(u)>=(ord(t)-d(j,m)+1)),r(j,k,m)*x(j,m,u)
      )=l= a(K) ;
  98  recruitment(j,k).. sr(k)=l= sum((t,m)$(ord(t)>= ES(j)and ord(t)<= LS(j)),o
      rd(t)*x(j,m,t)) ;
  99  release(j,k).. fr(k)=g= sum((t,m)$(ord(t)>= ES(j)and ord(t)<= LS(j)),(ord(
      t)+d(j,m))*x(j,m,t)) ;
 100  deadline(j,m).. sum(t$(ord(t)>= ES(j)and ord(t)<= LS(j)),ord(t)*x(j,m,t))=
      l= w ;
 101  model MRCPSP /all/ ;
 102  solve MRCPSP using mip maximizing z1 ;
 103  solve MRCPSP using mip minimizing z2 ;
 104  display x.l,sr.l,fr.l,z1.l,z2.l ;

---- value  =E=  define objective function 1

value..  - 95.1229424500714*x(a2,m1,1) - 90.4837418035959*x(a2,m1,2)
    
      - 86.0707976425058*x(a2,m1,3) - 81.8730753077982*x(a2,m1,4)
    
      - 77.8800783071405*x(a2,m1,5) - 74.0818220681718*x(a2,m1,6)
    
      - 70.4688089718713*x(a2,m1,7) - 190.245884900143*x(a2,m2,1)
    
      - 180.967483607192*x(a2,m2,2) - 172.141595285012*x(a2,m2,3)
    
      - 163.746150615596*x(a2,m2,4) - 155.760156614281*x(a2,m2,5)
    
      - 148.163644136344*x(a2,m2,6) - 140.937617943743*x(a2,m2,7)
    
      - 285.368827350214*x(a3,m1,1) - 271.451225410788*x(a3,m1,2)
    
      - 258.212392927517*x(a3,m1,3) - 245.619225923395*x(a3,m1,4)
    
      - 233.640234921421*x(a3,m1,5) - 222.245466204515*x(a3,m1,6)
    
      - 211.406426915614*x(a3,m1,7) - 380.491769800286*x(a3,m2,1)
    
      - 361.934967214384*x(a3,m2,2) - 344.283190570023*x(a3,m2,3)
    
      - 327.492301231193*x(a3,m2,4) - 311.520313228562*x(a3,m2,5)
    
      - 296.327288272687*x(a3,m2,6) - 281.875235887485*x(a3,m2,7)
    
      - 389.400391535702*x(a4,m1,5) - 370.409110340859*x(a4,m1,6)
    
      - 352.344044859357*x(a4,m1,7) - 335.16002301782*x(a4,m1,8)
    
      - 318.814075810887*x(a4,m1,9) - 303.265329856317*x(a4,m1,10)
    
      - 288.474905190243*x(a4,m1,11) - 274.405818047013*x(a4,m1,12)
    
      - 261.022888380508*x(a4,m1,13) - 248.292651895705*x(a4,m1,14)
    
      - 236.183276370507*x(a4,m1,15) - 224.664482058611*x(a4,m1,16)
    
      - 213.707465974363*x(a4,m1,17) - 467.280469842843*x(a4,m2,5)
    
      - 444.490932409031*x(a4,m2,6) - 422.812853831228*x(a4,m2,7)
    
      - 402.192027621384*x(a4,m2,8) - 382.576890973064*x(a4,m2,9)
    
      - 363.91839582758*x(a4,m2,10) - 346.169886228292*x(a4,m2,11)
    
      - 329.286981656416*x(a4,m2,12) - 313.22746605661*x(a4,m2,13)
    
      - 297.951182274846*x(a4,m2,14) - 283.419931644609*x(a4,m2,15)
    
      - 269.597378470333*x(a4,m2,16) - 256.448959169236*x(a4,m2,17)
    
      - 545.160548149983*x(a5,m1,5) - 518.572754477202*x(a5,m1,6)
    
      - 493.281662803099*x(a5,m1,7) - 469.224032224948*x(a5,m1,8)
    
      - 446.339706135241*x(a5,m1,9) - 424.571461798843*x(a5,m1,10)
    
      - 403.864867266341*x(a5,m1,11) - 384.168145265818*x(a5,m1,12)
    
      - 365.432043732711*x(a5,m1,13) - 623.040626457124*x(a5,m2,5)
    
      - 592.654576545374*x(a5,m2,6) - 563.750471774971*x(a5,m2,7)
    
      - 536.256036828511*x(a5,m2,8) - 510.102521297419*x(a5,m2,9)
    
      - 485.224527770107*x(a5,m2,10) - 461.559848304389*x(a5,m2,11)
    
      - 439.049308875221*x(a5,m2,12) - 417.636621408813*x(a5,m2,13)
    
      - 736.857677770184*x(a6,m1,4) - 700.920704764264*x(a6,m1,5)
    
      - 666.736398613546*x(a6,m1,6) - 634.219280746842*x(a6,m1,7)
    
      - 603.288041432075*x(a6,m1,8) - 573.865336459596*x(a6,m1,9)
    
      - 545.87759374137*x(a6,m1,10) - 519.254829342438*x(a6,m1,11)
    
      - 493.930472484624*x(a6,m1,12) - 469.841199084914*x(a6,m1,13)
    
      - 446.926773412269*x(a6,m1,14) - 425.129897466913*x(a6,m1,15)
    
      - 404.396067705499*x(a6,m1,16) - 818.730753077982*x(a6,m2,4)
    
      - 778.800783071405*x(a6,m2,5) - 740.818220681718*x(a6,m2,6)
    
      - 704.688089718713*x(a6,m2,7) - 670.320046035639*x(a6,m2,8)
    
      - 637.628151621773*x(a6,m2,9) - 606.530659712633*x(a6,m2,10)
    
      - 576.949810380487*x(a6,m2,11) - 548.811636094026*x(a6,m2,12)
    
      - 522.045776761016*x(a6,m2,13) - 496.585303791409*x(a6,m2,14)
    
      - 472.366552741015*x(a6,m2,15) - 449.328964117222*x(a6,m2,16) + z1 =E= 0 ;
    
      (LHS = 0)
    

---- cost  =E=  define objective function 2

cost..  420*sr(k1) + 920*sr(k2) + 850*sr(k3) - 420*fr(k1) - 920*fr(k2)
    
      - 850*fr(k3) + z2 =E= 0 ; (LHS = 0)
    

---- precedence  =G=  precedence constraint

precedence(a1,a2)..  x(a2,m1,1) + 2*x(a2,m1,2) + 3*x(a2,m1,3) + 4*x(a2,m1,4)
    
      + 5*x(a2,m1,5) + 6*x(a2,m1,6) + 7*x(a2,m1,7) + x(a2,m2,1) + 2*x(a2,m2,2)
    
      + 3*x(a2,m2,3) + 4*x(a2,m2,4) + 5*x(a2,m2,5) + 6*x(a2,m2,6) + 7*x(a2,m2,7)
      =G= 0 ; (LHS = 0)
    
precedence(a1,a3)..  x(a3,m1,1) + 2*x(a3,m1,2) + 3*x(a3,m1,3) + 4*x(a3,m1,4)
    
      + 5*x(a3,m1,5) + 6*x(a3,m1,6) + 7*x(a3,m1,7) + x(a3,m2,1) + 2*x(a3,m2,2)
    
      + 3*x(a3,m2,3) + 4*x(a3,m2,4) + 5*x(a3,m2,5) + 6*x(a3,m2,6) + 7*x(a3,m2,7)
      =G= 0 ; (LHS = 0)
    
precedence(a1,a4)..  5*x(a4,m1,5) + 6*x(a4,m1,6) + 7*x(a4,m1,7) + 8*x(a4,m1,8)
    
      + 9*x(a4,m1,9) + 10*x(a4,m1,10) + 11*x(a4,m1,11) + 12*x(a4,m1,12)
    
      + 13*x(a4,m1,13) + 14*x(a4,m1,14) + 15*x(a4,m1,15) + 16*x(a4,m1,16)
    
      + 17*x(a4,m1,17) + 5*x(a4,m2,5) + 6*x(a4,m2,6) + 7*x(a4,m2,7)
    
      + 8*x(a4,m2,8) + 9*x(a4,m2,9) + 10*x(a4,m2,10) + 11*x(a4,m2,11)
    
      + 12*x(a4,m2,12) + 13*x(a4,m2,13) + 14*x(a4,m2,14) + 15*x(a4,m2,15)
    
      + 16*x(a4,m2,16) + 17*x(a4,m2,17) =G= 0 ; (LHS = 0)
    
REMAINING 44 ENTRIES SKIPPED

**** Exec Error at line 96: Equation infeasible due to rhs value

**** INFEASIBLE EQUATIONS ...

---- execution  =E=  start time in one execution mode

execution(a1)..  0 =E= 1 ; (LHS = 0, INFES = 1 ****)
    
REMAINING 6 ENTRIES SKIPPED


-

Claudio Delpino

unread,
Jun 9, 2014, 1:17:48 AM6/9/14
to gams...@googlegroups.com

Hi: I'm guessing the problem is in parameters LS and ES which are not defined for activity a1, causing summation over t and m not to happen for this activity due to the conditional you write in equation "execution(j)".

Best regards
Claudio

--
You received this message because you are subscribed to the Google Groups "gamsworld" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+...@googlegroups.com.
To post to this group, send email to gams...@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld.
For more options, visit https://groups.google.com/d/optout.

Vahid reza Mohammadi

unread,
Jun 9, 2014, 12:47:40 PM6/9/14
to gams...@googlegroups.com
hi  Dear Claudio
thanks for your attention, in my model activity a1 and a7 are dummy and my ES and LS calculation base on forward and backward pass calculations. In doing this, the duration of activity i is considered based on execution mode with lowest duration. The backward pass calculation is started from a fixed project deadline T. In this paper, earliest finish time of dummy end activity, EFTn , computed based on execution modes with highest duration is considered as project deadline.
Reply all
Reply to author
Forward
0 new messages