Setup variables¶

By default the variables to be optimized is setup with the following parameters:

initial value lower bound upper bound
1e-4 -0.01 0.01

However, subtle configuration could be achieved by using set_variables() method of DakotaOc class, here is how to do it:

Parameter could be created by using DakotaParam class, here is the code:

# set x correctors
hcors = oc_ins.get_all_cors(type='h')[0:40]

# set initial, lower, upper values for each variables
n_h = len(hcors)
xinit_vals = (np.random.random(size=n_h) - 0.5) * 1.0e-4
xlower_vals = np.ones(n_h) * (-0.01)
xupper_vals = np.ones(n_h) * 0.01
xlbls = ['X{0:03d}'.format(i) for i in range(1, n_h+1)]

# create parameters
plist_x = [genopt.DakotaParam(lbl, val_i, val_l, val_u) 
            for (lbl, val_i, val_l, val_u) in 
                zip(xlbls, xinit_vals, xlower_vals, xupper_vals)]

plist_y could be created in the same way, then issue set_variables() with set_variables(plist=plist_x+plist_y).

Note

The emphasized line is to setup the variable labels, it is recommended that all parameters’ label with the format like x001, x002, etc.