fastoad.io.configuration.configuration module
Module for building OpenMDAO problem from configuration file
- class fastoad.io.configuration.configuration.FASTOADProblemConfigurator(conf_file_path=None)[source]
Bases:
object
class for configuring an OpenMDAO problem from a configuration file
See description of configuration file.
- Parameters
conf_file_path – if provided, configuration will be read directly from it
- property input_file_path
path of file with input variables of the problem
- property output_file_path
path of file where output variables will be written
- get_problem(read_inputs: bool = False, auto_scaling: bool = False) fastoad.openmdao.problem.FASTOADProblem [source]
Builds the OpenMDAO problem from current configuration.
- Parameters
read_inputs – if True, the created problem will already be fed with variables from the input file
auto_scaling – if True, automatic scaling is performed for design variables and constraints
- Returns
the problem instance
- load(conf_file)[source]
Reads the problem definition
- Parameters
conf_file – Path to the file to open or a file descriptor
- save(filename: Optional[str] = None)[source]
Saves the current configuration If no filename is provided, the initially read file is used.
- Parameters
filename – file where to save configuration
- write_needed_inputs(source_file_path: Optional[str] = None, source_formatter: Optional[fastoad.io.formatter.IVariableIOFormatter] = None)[source]
Writes the input file of the problem with unconnected inputs of the configured problem.
Written value of each variable will be taken:
from input_data if it contains the variable
from defined default values in component definitions
- Parameters
source_file_path – if provided, variable values will be read from it
source_formatter – the class that defines format of input file. if not provided, expected format will be the default one.
- get_optimization_definition() Dict [source]
- Returns information related to the optimization problem:
Design Variables
Constraints
Objectives
- Returns
dict containing optimization settings for current problem
- set_optimization_definition(optimization_definition: Dict)[source]
Updates configuration with the list of design variables, constraints, objectives contained in the optimization_definition dictionary.
Keys of the dictionary are: “design_var”, “constraint”, “objective”.
Configuration file will not be modified until
save()
is used.- Parameters
optimization_definition – dict containing the optimization problem definition