Class AlgorithmConfiguration

java.lang.Object
es.urjc.etsii.grafo.autoconfig.irace.AlgorithmConfiguration

public class AlgorithmConfiguration extends Object
Algorithm configuration via pairs of key values
  • Constructor Details

    • AlgorithmConfiguration

      public AlgorithmConfiguration(Map<String,String> params)
      Initialize an algorithm configuration from a map
      Parameters:
      params - algorithm parameters as pairs of key-value
    • AlgorithmConfiguration

      public AlgorithmConfiguration(String[] args)
      Build an algorithm configuration from a string value, such those returned from Irace. Example: "constructive=random balanced=true initialmaxdiffratio=0.8193 cooldownexpratio=0.9438 cyclelength=9"
      Parameters:
      args - String representation of the algorithm parameters, see example in method description
  • Method Details

    • getValue

      public Optional<String> getValue(String property)
      Get the value of a config property
      Parameters:
      property - config key
      Returns:
      Optional with value if key was in config map, empty Optional if key was not in config map.
    • getValue

      public String getValue(String key, String defaultValue)
      Get the value of a config property
      Parameters:
      key - config key
      defaultValue - value to return if key is not in config map
      Returns:
      Config value if key present, default value otherwise
    • getValueAsInt

      public Optional<Integer> getValueAsInt(String key)
      Get the value of a config property and parse as integer value
      Parameters:
      key - config key
      Returns:
      Optional with value if key was in config map, empty Optional if key was not in config map.
    • getValueAsInt

      public int getValueAsInt(String key, int defaultValue)
      Get the value of a config property and parse as integer value
      Parameters:
      key - config key
      defaultValue - value to return if key is not in config map
      Returns:
      Config value if key present, default value otherwise
    • getValueAsDouble

      public Optional<Double> getValueAsDouble(String key)
      Get the value of a config property and parse as double value
      Parameters:
      key - config key
      Returns:
      Optional with value if key was in config map, empty Optional if key was not in config map.
    • getValueAsDouble

      public double getValueAsDouble(String key, double defaultValue)
      Get the value of a config property and parse as a double value
      Parameters:
      key - config key
      defaultValue - value to return if key is not in config map
      Returns:
      Config value as double if key present, default value otherwise
    • getConfig

      public Map<String,String> getConfig()
      Get all config properties related to the irace algorithm
      Returns:
      all key/values as a map.