Wednesday, November 21, 2012

Data errors

Even small tables can contain errors. An example data set in a published paper about scheduling maintenance of power generators looks like:

image

In GAMS I transcribed this as:

table data(i,*)
          
capacity   allowed-from  allowed-to  outage-weeks

*             MW        week           week    number of weeks
 
unit1      555          1             26           7
 
unit2      555         27             52           5
 
unit3      180          1             26           2
 
unit4      180          1             26           1
 
unit5      640         27             52           5
 
unit6      640          1             26           3
 
unit7      640          1             26           3
 
unit8      555         27             52           6
 
unit9      276          1             26          10
 
unit10     140          1             26           4
 
unit11      90          1             26           1
 
unit12      76         27             52           3
 
unit13      76          1             26           2
 
unit14      94          1             26           4
 
unit15      39          1             26           2
 
unit16     188          1             26           2
 
unit17      58         27             52           1
 
unit18      48         27             52           2
 
unit19     137         27             52           1
 
unit20     469         27             52           4
 
unit21      52          1             26           3
;

table manpower(i,t) 'Manpower required for each week'
       
week1 week2 week3 week4 week5 week6 week7 week8 week9 week10
unit1    10    10     5     5     5     5     3
unit2    10    10    10     5     5
unit3    15    15
unit4    20
unit5    10    10    10    10    10
unit6    15    15    15
unit7    15    15    15
unit8    10    10    10     5     5     5
unit9     3     2     2     2     2     2     2     2     2     3
unit10   10    10     5     5
unit11   20
unit12   10     1     5    15
unit13   15    15
unit14   10    10    10    10
unit15   15    15
unit16   15    15
unit17   20
unit18   15    15
unit19   15
unit20   10    10    10    10
unit21   10    10    10

;

Just to be sure I added some checks:

set error(i,t) 'check for mismatch between manpower and outage-weeks';
error(i,t)$(manpower(i,t)=0
and ord(t)<=data(i,'outage-weeks')) = yes
;
error(i,t)$(manpower(i,t)<>0
and ord(t)>data(i,'outage-weeks')) = yes
;
abort$card(error) "manpower mismatch"
,error;

Low and behold, we see:

----     93 manpower mismatch

----     93 SET error  check for mismatch between manpower and outage-weeks

             week4

unit12         YES

**** Exec Error at line 93: Execution halted: abort$1 'manpower mismatch'

Indeed we have for this unit a problem in the manpower allocation.