predeterminedruns_driver.py¶
Baseclass for design-of-experiments Drivers that have pre-determined parameter sets.
-
class
openmdao.drivers.predeterminedruns_driver.
PredeterminedRunsDriver
(num_par_doe=1, load_balance=False)[source]¶ Bases:
openmdao.core.driver.Driver
Baseclass for design-of-experiments Drivers that have pre-determined parameter sets.
Args: num_par_doe : int, optional
The number of DOE cases to run concurrently. Defaults to 1.
load_balance : bool, Optional
If True and running under MPI, use rank 0 as master and load balance cases among all of the other ranks. Default is False. If multiprocessing is being used instead of MPI, then cases are always load balanced.
-
add_constraint
(name, lower=None, upper=None, equals=None, linear=False, jacs=None, indices=None, adder=0.0, scaler=1.0)[source]¶ Adds a constraint to this driver. For inequality constraints, lower or upper must be specified. For equality constraints, equals must be specified.
Args: name : string
Promoted pathname of the output that will serve as the quantity to constrain.
lower : float or ndarray, optional
Constrain the quantity to be greater than or equal to this value.
upper : float or ndarray, optional
Constrain the quantity to be less than or equal to this value.
equals : float or ndarray, optional
Constrain the quantity to be equal to this value.
linear : bool, optional
Set to True if this constraint is linear with respect to all design variables so that it can be calculated once and cached.
jacs : dict of functions, optional
Dictionary of user-defined functions that return the flattened Jacobian of this constraint with repsect to the design vars of this driver, as indicated by the dictionary keys. Default is None to let OpenMDAO calculate all derivatives. Note, this is currently unsupported
indices : iter of int, optional
If a constraint is an array, these indicate which entries are of interest for derivatives.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
-
add_desvar
(name, lower=None, upper=None, low=None, high=None, indices=None, adder=0.0, scaler=1.0)[source]¶ Adds a design variable to this driver.
Args: name : string
Name of the design variable in the root system.
lower : float or ndarray, optional
Lower boundary for the param
upper : upper or ndarray, optional
Upper boundary for the param
indices : iter of int, optional
If a param is an array, these indicate which entries are of interest for derivatives.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
-
add_objective
(name, indices=None, adder=0.0, scaler=1.0)[source]¶ Adds an objective to this driver.
Args: name : string
Promoted pathname of the output that will serve as the objective.
indices : iter of int, optional
If an objective is an array, these indicate which entries are of interest for derivatives.
adder : float or ndarray, optional
Value to add to the model value to get the scaled value. Adder is first in precedence.
scaler : float or ndarray, optional
value to multiply the model value to get the scaled value. Scaler is second in precedence.
-
add_response
(name)[source]¶ Add a variable(s) whose value will be collected after the execution of each case.
Args: name : str or iter of str
The name of the response variable, or an iterator of names.
-
get_all_responses
()[source]¶ Similar to get_responses(), but this version ensures that each process gets all of the responses.
-
get_req_procs
()[source]¶ Returns: tuple
A tuple of the form (min_procs, max_procs), indicating the min and max processors usable by this Driver.
-
get_responses
()[source]¶ Returns an iterator over tuples of the form (responses, success, msg), where responses is a list tuples containing variable names and values, success is true if there were no errors when running the case, and msg is an error message if there were errors or an empty string if not.
-
-
openmdao.drivers.predeterminedruns_driver.
worker
(problem, response_vars, case_queue, response_queue, worker_id)[source]¶ This is used to run parallel DOEs using multprocessing. It takes a case off of the case_queue, runs it, then puts responses on the response_queue.