rte-france / challenge-roadef-2020

Apache License 2.0
19 stars 7 forks source link

Checker prints wrong time in `check_resources` #1

Closed bgraf closed 4 years ago

bgraf commented 4 years ago

I suspect there is an off-by-one error in check_resources while printing violated constraints:

if worload > upper_bound + tolerance:    
    print('ERROR: Resources constraint 4.2 upper bound: Worload on Resource ' + resource_name + ' at time ' + str(time) + ' exceeds upper bound.'    
            + ' Value ' + str(worload) + ' is greater than bound ' + str(upper_bound) + ' plus tolerance ' + str(tolerance) + '.')    
    # Check min         
if worload < lower_bound - tolerance:    
    print('ERROR: Resources constraint 4.2 lower bound: Worload on Resource ' + resource_name + ' at time ' + str(time) + ' does not match lower bound.'    
            + ' Value ' + str(worload) + ' is lower than bound ' + str(lower_bound) + ' minus tolerance ' + str(tolerance) + '.')    

Suggestion

Change str(time)str(time + 1) because time takes values in [0, T-1] but should be displayed in [1, T] to be consistent with check_exclusions and the input format.

klorel commented 4 years ago

Hi Benjamin, Thanks for the contribution. Fixed, with other things. Manuel