smash.MultipleRunResult#

class smash.MultipleRunResult[source]#

Represents the multiple run result.

See also

Model.multiple_run

Compute multiple forward run of the Model.

Notes

This class is essentially a subclass of dict with attribute accessors. This may have an additional attribute (qsim), which is not listed here, depending on the specific return values requested in the Model.multiple_run() method.

Examples

>>> setup, mesh = smash.load_dataset("cance")
>>> model = smash.Model(setup, mesh)

Get the boundary constraints of the Model parameters/states and generate a sample

>>> problem = model.get_bound_constraints()
>>> sample = smash.generate_samples(problem, n=200, random_state=99)

Compute the multiple run

>>> mtprr = model.multiple_run(sample, ncpu=4, return_qsim=True)

Access cost and qsim values

>>> mtprr.cost
array([1.2327451e+00, 1.2367475e+00, 1.2227478e+00, 4.7788401e+00,
...
       1.2392160e+00, 1.2278881e+00, 7.5998020e-01, 1.1763511e+00],
      dtype=float32)
>>> mtprr.cost.shape
(200,)
>>> mtprr.qsim
array([[[1.01048472e-05, 9.94086258e-06, 4.78204456e-05, ...,
...
        [3.45186263e-01, 6.55560493e-02, 4.66010673e-03, ...,
         8.93603489e-02, 1.37046015e+00, 1.07397830e+00]]], dtype=float32)
>>> mtprr.qsim.shape
(3, 1440, 200)
Attributes:
costnumpy.ndarray

The cost value for each parameters set.

Methods

clear()

copy()

fromkeys(iterable[, value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(key[, default])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(/)

Remove and return a (key, value) pair as a 2-tuple.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()