<s> """<STR_LIT>""" <EOL> from collections import OrderedDict <EOL> import itertools <EOL> from six import iteritems <EOL> from six . moves import zip <EOL> import numpy as np <EOL> from openmdao . drivers . predeterminedruns_driver import PredeterminedRunsDriver <EOL> class FullFactorialDriver ( PredeterminedRunsDriver ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , num_levels = <NUM_LIT:1> , num_par_doe = <NUM_LIT:1> , load_balance = False ) : <EOL> super ( FullFactorialDriver , self ) . __init__ ( num_par_doe = num_par_doe , <EOL> load_balance = load_balance ) <EOL> self . num_levels = num_levels <EOL> def _build_runlist ( self ) : <EOL> value_arrays = OrderedDict ( ) <EOL> for name , meta in iteritems ( self . get_desvar_metadata ( ) ) : <EOL> value_arrays [ name ] = [ ] <EOL> val = self . root . unknowns . _dat [ name ] . val <EOL> nval = meta [ '<STR_LIT:size>' ] <EOL> for k in range ( nval ) : <EOL> low = meta [ '<STR_LIT>' ] <EOL> high = meta [ '<STR_LIT>' ] <EOL> if isinstance ( low , np . ndarray ) : <EOL> low = low [ k ] <EOL> if isinstance ( high , np . ndarray ) : <EOL> high = high [ k ] <EOL> value_arrays [ name ] . append ( np . linspace ( low , high , <EOL> num = self . num_levels ) . tolist ( ) ) <EOL> keys = list ( value_arrays . keys ( ) ) <EOL> for name in keys : <EOL> value_arrays [ name ] = [ np . array ( x ) for x in itertools . product ( * value_arrays [ name ] ) ] <EOL> for combination in itertools . product ( * value_arrays . values ( ) ) : <EOL> yield zip ( keys , combination ) </s>
