Skip to content

Required sim_id key in APOSMM #1612

@roussel-ryan

Description

@roussel-ryan

This Xopt code fails to add data to the APOSMM generator because it requires a sim_id key in the input data. This is not required by the gest-api standard

vocs = VOCS(
    variables={
        "x0": [-2.0,2.0],
        "x1": [-1.0,1.0],
        "x0_on_cube": [0.0,1.0],
        "x1_on_cube": [0.0,1.0],
        },
    objectives={"f": "MINIMIZE"},
)

variables_mapping = {
    "x": ["x0", "x1"],
    "x_on_cube": ["x0_on_cube", "x1_on_cube"],
}

max_active_runs = 1
initial_sample_size = 10
gen = APOSMM(vocs=vocs, max_active_runs=max_active_runs, initial_sample_size=initial_sample_size, variables_mapping=variables_mapping)

X = Xopt(vocs=vocs, evaluator=evaluator, generator=gen)
X.random_evaluate(10)

End of error traceback

File ~\Documents\GitHub\Xopt\xopt\base.py:392, in Xopt.add_data(self, new_data)
    390 # Pass data to generator, continue in case of invalid data when strict=False
    391 try:
--> [392]  self.generator.ingest(new_data.to_dict(orient="records"))
    393 except DataError as exc:
    394     if self.strict:

File ~\Documents\GitHub\libensemble\libensemble\generators.py:181, in PersistentGenInterfacer.ingest(self, results, tag)
    179 def ingest(self, results: List[dict], tag: int = EVAL_GEN_TAG) -> None:
    180     """Send the results of evaluations to the generator."""
--> [181]  self.ingest_numpy(list_dicts_to_np(results, mapping=self.variables_mapping), tag)

File ~\Documents\GitHub\libensemble\libensemble\gen_classes\aposmm.py:214, in APOSMM.ingest_numpy(self, results, tag)
    212 if self._n_buffd_results == 0:
    213     self._ingest_buf = np.zeros(self.gen_specs["user"]["initial_sample_size"], dtype=results.dtype)
--> [214]   self._ingest_buf["sim_id"] = -1
    216 if not self._enough_initial_sample():
    217     self._slot_in_data(np.copy(results))

ValueError: no field of name sim_id

self._ingest_buf["sim_id"] = -1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions