Get a random action within the microgrid's action space. Parameters ---------- strict_bound : bool, default False If True, choose actions that is guaranteed to satisfy self.max_consumption and self.max_production bounds. Otherwise selects act
(self, strict_bound=False, sample_flex_modules=False)
| 356 | return self._modules.get_attrs('production_marginal_cost', 'absorption_marginal_cost', as_pandas=False) |
| 357 | |
| 358 | def sample_action(self, strict_bound=False, sample_flex_modules=False): |
| 359 | """ |
| 360 | Get a random action within the microgrid's action space. |
| 361 | |
| 362 | Parameters |
| 363 | ---------- |
| 364 | strict_bound : bool, default False |
| 365 | If True, choose actions that is guaranteed to satisfy self.max_consumption and |
| 366 | self.max_production bounds. Otherwise selects action from min_act and min_act, which may not satisfy |
| 367 | instantaneous bounds. |
| 368 | sample_flex_modules : bool, default false |
| 369 | Whether to sample the flex modules in the microgrid. |
| 370 | ``run`` does not expect actions for flex modules. |
| 371 | |
| 372 | Returns |
| 373 | ------- |
| 374 | |
| 375 | dict[str, list[float]] |
| 376 | Random action in the action space. |
| 377 | |
| 378 | """ |
| 379 | |
| 380 | module_iterator = self._modules.to_dict() if sample_flex_modules else self._modules.controllable.to_dict() |
| 381 | return {module_name: [module.sample_action(strict_bound=strict_bound) for module in module_list] |
| 382 | for module_name, module_list in module_iterator.items() |
| 383 | if module_list[0].action_space.shape[0]} |
| 384 | |
| 385 | def get_empty_action(self, sample_flex_modules=False): |
| 386 | """ |