ConfigValue

(class from pyomo.common.config)

class pyomo.common.config.ConfigValue(default=None, domain=None, description=None, doc=None, visibility=0)[source]

Bases: ConfigBase

Store and manipulate a single configuration value.

Parameters:
  • default (optional) – The default value that this ConfigValue will take if no value is provided.

  • domain (Callable, optional) – The domain can be any callable that accepts a candidate value and returns the value converted to the desired type, optionally performing any data validation. The result will be stored into the ConfigValue. Examples include type constructors like int or float. More complex domain examples include callable objects; for example, the In class that ensures that the value falls into an acceptable set or even a complete ConfigDict instance.

  • description (str, optional) – The short description of this value

  • doc (str, optional) – The long documentation string for this value

  • visibility (int, optional) – The visibility of this ConfigValue when generating templates and documentation. Visibility supports specification of “advanced” or “developer” options. ConfigValues with visibility=0 (the default) will always be printed / included. ConfigValues with higher visibility values will only be included when the generation method specifies a visibility greater than or equal to the visibility of this object.

__init__(default=None, domain=None, description=None, doc=None, visibility=0)

Methods

__init__([default, domain, description, ...])

declare_as_argument(*args, **kwds)

Map this Config item to an argparse argument.

display([content_filter, indent_spacing, ...])

domain_name()

generate_documentation([block_start, ...])

generate_yaml_template([indent_spacing, ...])

import_argparse(parsed_args)

initialize_argparse(parser)

name([fully_qualified])

reset()

set_default_value(default)

set_domain(domain)

set_value(value)

unused_user_values()

user_values()

value([accessValue])

Member Documentation

declare_as_argument(*args, **kwds)

Map this Config item to an argparse argument.

Valid arguments include all valid arguments to argparse’s ArgumentParser.add_argument() with the exception of ‘default’. In addition, you may provide a group keyword argument to either pass in a pre-defined option group or subparser, or else pass in the string name of a group, subparser, or (subparser, group).