MLopez-Ibanez / irace

Iterated Racing for Automatic Algorithm Configuration
https://mlopez-ibanez.github.io/irace/
GNU General Public License v2.0
58 stars 14 forks source link

Bug with Rounding Error Escaping Error Detection #47

Closed DE0CH closed 1 year ago

DE0CH commented 1 year ago

Hi Manuel,

I was working on the meta irace tuning project and I encountered this bug. Since I was not sure if my code in iracepy was buggy, I reproduced the bug with the development version of irace (devtools::install_github('MLopez-Ibanez/irace')) and used the good old command line.

The bug diappeared when I set digits to a large value, and in with irace in CRAN, it detected that the lower bound forperturbation_constant is 0 when the scale is set to log, threw an error and stopped. So I suspect it rounded it to 0 but escaped a check to check if it's 0 and failed elsewhere.

Below is the details of the things needed to reproduce the bug and a full traceback.

Folder structure:

$ tree .
.
|-- Instances
|   `-- one.txt
|-- parameters.txt
|-- scenario.txt
`-- target-runner

1 directory, 4 files

parameters.txt:

barrier_algorithm            "" c (3,1,0,2)      
barrier_crossover            "" c (-1,1,0,2)     
barrier_limits_corrections   "" c (1,16,64,-1,0,4)
barrier_limits_growth        "" r,log (1000000,100000000000000)
barrier_ordering             "" c (3,1,0,2)      
barrier_startalg             "" c (3,1,4,2)      
emphasis_memory              "" c (no)           
emphasis_mip                 "" c (1,2,3,0,4)    
emphasis_numerical           "" c (no,yes)       
feasopt_mode                 "" c (5,1,2,3,0,4)  
lpmethod                     "" c (5,1,2,3,0,6,4)
mip_cuts_cliques             "" c (1,2,3,-1,0)   
mip_cuts_covers              "" c (1,2,3,-1,0)   
mip_cuts_disjunctive         "" c (1,2,3,-1,0)   
mip_cuts_flowcovers          "" c (-1,1,0,2)     
mip_cuts_gomory              "" c (-1,1,0,2)     
mip_cuts_gubcovers           "" c (-1,1,0,2)     
mip_cuts_implied             "" c (-1,1,0,2)     
mip_cuts_mcfcut              "" c (-1,1,0,2)     
mip_cuts_mircut              "" c (-1,1,0,2)     
mip_cuts_pathcut             "" c (-1,1,0,2)     
mip_cuts_zerohalfcut         "" c (-1,1,0,2)     
mip_limits_aggforcut         "" i (0,10)         
mip_limits_cutpasses         "" c (1,16,64,-1,0,4)
mip_limits_cutsfactor        "" r,log (1,16)         
mip_limits_gomorycand        "" i,log (50,800)       
mip_limits_gomorypass        "" c (1,16,64,0,4)  
mip_limits_strongcand        "" i,log (2,40)          | (mip_strategy_variableselect == "3")
mip_limits_strongit          "" c (1,16,64,0,4)   | (mip_strategy_variableselect == "3")
mip_limits_submipnodelim     "" i,log (125,2000)     
mip_ordertype                "" c (3,1,0,2)      
mip_strategy_backtrack       "" c (0.99999,0.9999,0.9,0.99,0.999,0.999999)
mip_strategy_bbinterval      "" i,log (1,1000)       
mip_strategy_branch          "" c (-1,1,0)       
mip_strategy_dive            "" c (3,1,0,2)      
mip_strategy_file            "" c (1,0)          
mip_strategy_fpheur          "" c (-1,1,0,2)     
mip_strategy_heuristicfreq   "" c (80,5,10,20,-1,40,0)
mip_strategy_lbheur          "" c (no,yes)       
mip_strategy_nodeselect      "" c (3,1,0,2)      
mip_strategy_order           "" c (no,yes)        | (mip_ordertype %in% c("1", "2", "3"))
mip_strategy_presolvenode    "" c (-1,1,0,2)     
mip_strategy_probe           "" c (1,2,3,-1,0)   
mip_strategy_rinsheur        "" c (80,5,10,20,-1,40,0)
mip_strategy_search          "" c (1,0,2)        
mip_strategy_startalgorithm  "" c (5,1,2,3,0,6,4)
mip_strategy_subalgorithm    "" c (5,1,2,3,0,4)  
mip_strategy_variableselect  "" c (1,2,3,-1,4,0) 
network_netfind              "" c (3,1,2)        
network_pricing              "" c (1,0,2)        
perturbation_constant        "" r,log (0.00000001,0.0001) | (simplex_perturbation_switch == "yes")
preprocessing_aggregator     "" c (1,16,64,-1,0,4)
preprocessing_boundstrength  "" c (-1,1,0)       
preprocessing_coeffreduce    "" c (1,0,2)        
preprocessing_dependency     "" c (1,2,3,-1,0)   
preprocessing_dual           "" c (-1,1,0)       
preprocessing_fill           "" i,log (2,40)         
preprocessing_linear         "" c (1,0)          
preprocessing_numpass        "" c (1,16,64,-1,0,4)
preprocessing_reduce         "" c (3,1,0,2)      
preprocessing_relax          "" c (-1,1,0)       
preprocessing_repeatpresolve "" c (1,2,3,-1,0)   
preprocessing_symmetry       "" c (5,1,2,3,-1,4,0)
read_scale                   "" c (-1,1,0)       
sifting_algorithm            "" c (1,2,3,0,4)    
simplex_crash                "" c (-1,1,0)       
simplex_dgradient            "" c (5,1,2,3,0,4)  
simplex_limits_perturbation  "" c (1,16,64,0,4)  
simplex_limits_singularity   "" i,log (2,40)         
simplex_perturbation_switch  "" c (no,yes)       
simplex_pgradient            "" c (1,2,3,-1,4,0) 
simplex_pricing              "" c (1,16,64,0,4)  
simplex_refactor             "" c (16,64,256,0,4)
simplex_tolerances_markowitz "" r,log (0.0001,0.5)   

scenario.txt:

maxExperiments = 2000

target-runner:

#!/bin/bash
echo 1

Traceback:

#------------------------------------------------------------------------------
# irace: An implementation in R of (Elitist) Iterated Racing
# Version: 3.5.1.b0cf9ab
# Copyright (C) 2010-2020
# Manuel Lopez-Ibanez     <manuel.lopez-ibanez@manchester.ac.uk>
# Jeremie Dubois-Lacoste  
# Leslie Perez Caceres    <leslie.perez.caceres@ulb.ac.be>
#
# This is free software, and you are welcome to redistribute it under certain
# conditions.  See the GNU General Public License for details. There is NO
# WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# irace builds upon previous code from the race package:
#     race: Racing methods for the selection of the best
#     Copyright (C) 2003 Mauro Birattari
#------------------------------------------------------------------------------
# installed at: /usr/local/lib/R/site-library/irace
# called with: 
== irace == WARNING: A default scenario file '/workspaces/irace-tuning/example.txt/scenario.txt' has been found and will be read.
# 2022-11-23 00:32:24 UTC: Initialization
# Elitist race
# Elitist new instances: 1
# Elitist limit: 2
# nbIterations: 8
# minNbSurvival: 8
# nbParameters: 73
# seed: 721956974
# confidence level: 0.95
# budget: 2000
# mu: 5
# deterministic: FALSE

# 2022-11-23 00:32:24 UTC: Iteration 1 of 8
# experimentsUsedSoFar: 0
# remainingBudget: 2000
# currentBudget: 250
# nbConfigurations: 41
Error: == irace == value >= lowerBound && value <= upperBound is not TRUE
9: capture.output(traceback(6))
8: irace.internal.error(msg)
7: irace.assert(value >= lowerBound && value <= upperBound)
6: numeric_value_round(type, value, lowerBound, upperBound = domain[2], 
       digits)
5: sample_unif(currentType, domain, transf = parameters$transform[[currentParameter]], 
       digits)
4: sampleUniform(parameters, nbNewConfigurations, digits = scenario$digits, 
       forbidden = forbiddenExps, repair = scenario$repairConfiguration)
3: irace_run(scenario = scenario, parameters = parameters)
2: irace_common(scenario = scenario, simple = FALSE)
1: irace.cmdline()
== irace == 
An unexpected condition occurred. Please report this bug to the authors of the irace package <https://github.com/MLopez-Ibanez/irace/issues>
MLopez-Ibanez commented 1 year ago

The problem is this option, I guess:

perturbation_constant        "" r,log (0.00000001,0.0001)

It probably gets rounded to 0 due to digits.

This is a very weird parameter, it would be better to use an int and generate 10^-p.

Let me take a look this weekend.

MLopez-Ibanez commented 1 year ago

If you want to get around the bug for now, just use digits=15 in scenario.txt. It probably doesn't make much of a difference for this scenario.