Exemplo n.º 1
0
    def __init__(self):
        super(Driver, self).__init__()
        self.recorders = []

        # What this driver supports
        self.supports = OptionsDictionary(read_only=True)
        self.supports.add_option('inequality_constraints', True)
        self.supports.add_option('equality_constraints', True)
        self.supports.add_option('linear_constraints', False)
        self.supports.add_option('multiple_objectives', False)
        self.supports.add_option('two_sided_constraints', False)
        self.supports.add_option('integer_parameters', False)

        # This driver's options
        self.options = OptionsDictionary()

        self._params = OrderedDict()
        self._objs = OrderedDict()
        self._cons = OrderedDict()

        self._voi_sets = []

        # We take root during setup
        self.root = None

        self.iter_count = 0
Exemplo n.º 2
0
    def __init__(self, n=2, h=.01):
        super(RK4, self).__init__()

        self.h = h

        # Inputs
        # All inputs are defined in subclasses.

        # Options
        self.options = opt = OptionsDictionary()
        opt.add_option('state_var',
                       '',
                       desc="Name of the variable to be used for time "
                       "integration")
        opt.add_option('init_state_var',
                       '',
                       desc="Name of the variable to be used for initial "
                       "conditions")
        opt.add_option('external_vars', [],
                       desc="List of names of variables that are external "
                       "to the system but DO vary with time.")
        opt.add_option('fixed_external_vars', [],
                       desc="List of names of variables that are "
                       "external to the system but DO NOT "
                       "vary with time.")
Exemplo n.º 3
0
 def __init__(self):
     self.iter_count = 0
     self.options = OptionsDictionary()
     desc = 'Set to 0 to disable printing, set to 1 to print the ' \
            'residual to stdout each iteration, set to 2 to print ' \
            'subiteration residuals as well.'
     self.options.add_option('iprint', 0, values=[0, 1, 2], desc=desc)
     self.recorders = []
     self.local_meta = None
Exemplo n.º 4
0
    def __init__(self):
        self.options = OptionsDictionary()
        self.options.add_option(
            'includes', ['*'],
            desc='Patterns for variables to include in recording')
        self.options.add_option(
            'excludes', [],
            desc='Patterns for variables to exclude from recording '
            '(processed after includes)')

        self.out = None

        self._filtered = {}
Exemplo n.º 5
0
    def __init__(self):
        super(MySimpleDriver, self).__init__()

        # What we support
        self.supports['inequality_constraints'] = True
        self.supports['equality_constraints'] = False
        self.supports['linear_constraints'] = False
        self.supports['multiple_objectives'] = False

        # My driver options
        self.options = OptionsDictionary()
        self.options.add_option('tol', 1e-4)
        self.options.add_option('maxiter', 10)

        self.alpha = .01
        self.violated = []
Exemplo n.º 6
0
    def __init__(self):
        super(ExternalCode, self).__init__()

        self.STDOUT = STDOUT
        self.DEV_NULL = DEV_NULL

        # Input options for this Component
        self.options = OptionsDictionary()
        self.options.add_option('command', [], desc='command to be executed')
        self.options.add_option(
            'env_vars', {},
            desc='Environment variables required by the command')
        self.options.add_option(
            'poll_delay',
            0.0,
            desc='''Delay between polling for command completion.
            A value of zero will use an internally computed default''')
        self.options.add_option('timeout',
                                0.0,
                                desc='''Maximum time to wait for command
            completion. A value of zero implies an infinite wait''')
        self.options.add_option(
            'check_external_outputs',
            True,
            desc='Check that all input or output external files exist')

        self.options.add_option(
            'external_input_files', [],
            desc=
            '(optional) list of input file names to check the pressence of before solve_nonlinear'
        )
        self.options.add_option(
            'external_output_files', [],
            desc=
            '(optional) list of input file names to check the pressence of after solve_nonlinear'
        )

        # Outputs of the run of the component or items that will not work with the OptionsDictionary
        self.return_code = 0  # Return code from the command
        self.timed_out = False  # True if the command timed-out
        self.stdin = self.DEV_NULL
        self.stdout = None
        self.stderr = "error.out"
Exemplo n.º 7
0
    def __init__(self, n=2):
        super(KS, self).__init__()

        self.n = n

        # Inputs
        self.add_param('g',
                       np.zeros((n, )),
                       desc="Array of function values to be aggregated")

        # Outputs
        self.add_output('KS', 0.0, desc="Value of the aggregate KS function")

        self.options = OptionsDictionary()
        self.options.add_option(rho,
                                0.1,
                                desc="Hyperparameter for the KS function")

        self._ks = KSfunction()