MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / _make_lqr

Function _make_lqr

dm_control/suite/lqr.py:77–107  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

75
76
77def _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
110def _make_body(body_id, stiffness_range, damping_range, random):

Callers 2

lqr_2_1Function · 0.85
lqr_6_2Function · 0.85

Calls 3

LQRLevelClass · 0.85
get_model_and_assetsFunction · 0.70
from_xml_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…