Returns a LQR environment. Args: n_bodies: An int, number of bodies of the LQR. n_actuators: An int, number of actuated bodies of the LQR. `n_actuators` should be less or equal than `n_bodies`. control_cost_coef: A number, the coefficient of the control cost. time_limit: An
(n_bodies, n_actuators, control_cost_coef, time_limit, random,
environment_kwargs)
| 75 | |
| 76 | |
| 77 | def _make_lqr(n_bodies, n_actuators, control_cost_coef, time_limit, random, |
| 78 | environment_kwargs): |
| 79 | """Returns a LQR environment. |
| 80 | |
| 81 | Args: |
| 82 | n_bodies: An int, number of bodies of the LQR. |
| 83 | n_actuators: An int, number of actuated bodies of the LQR. `n_actuators` |
| 84 | should be less or equal than `n_bodies`. |
| 85 | control_cost_coef: A number, the coefficient of the control cost. |
| 86 | time_limit: An int, maximum time for each episode in seconds. |
| 87 | random: Either an existing `numpy.random.RandomState` instance, an |
| 88 | integer seed for creating a new `RandomState`, or None to select a seed |
| 89 | automatically. |
| 90 | environment_kwargs: A `dict` specifying keyword arguments for the |
| 91 | environment, or None. |
| 92 | |
| 93 | Returns: |
| 94 | A LQR environment with `n_bodies` bodies of which first `n_actuators` are |
| 95 | actuated. |
| 96 | """ |
| 97 | |
| 98 | if not isinstance(random, np.random.RandomState): |
| 99 | random = np.random.RandomState(random) |
| 100 | |
| 101 | model_string, assets = get_model_and_assets(n_bodies, n_actuators, |
| 102 | random=random) |
| 103 | physics = Physics.from_xml_string(model_string, assets=assets) |
| 104 | task = LQRLevel(control_cost_coef, random=random) |
| 105 | environment_kwargs = environment_kwargs or {} |
| 106 | return control.Environment(physics, task, time_limit=time_limit, |
| 107 | **environment_kwargs) |
| 108 | |
| 109 | |
| 110 | def _make_body(body_id, stiffness_range, damping_range, random): |
no test coverage detected
searching dependent graphs…