Search is not available for this dataset
repo
stringlengths 2
152
⌀ | file
stringlengths 15
239
| code
stringlengths 0
58.4M
| file_length
int64 0
58.4M
| avg_line_length
float64 0
1.81M
| max_line_length
int64 0
12.7M
| extension_type
stringclasses 364
values |
---|---|---|---|---|---|---|
null | CARL-main/carl/envs/box2d/utils.py | from typing import List
import Box2D
def safe_destroy(world: Box2D.b2World, bodies: List[Box2D.b2Body]) -> None:
for body in bodies:
try:
world.DestroyBody(body)
except AssertionError as error:
if str(error) != "m_bodyCount > 0":
raise error
| 305 | 22.538462 | 75 | py |
null | CARL-main/carl/envs/box2d/parking_garage/__init__.py | __author__ = "André Biedenkapp"
| 32 | 15.5 | 31 | py |
null | CARL-main/carl/envs/box2d/parking_garage/bus.py | from typing import List
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import polygonShape # noqa: F401
from Box2D.b2 import prismaticJointDef # noqa: F401
from Box2D.b2 import revoluteJointDef # noqa: F401
from Box2D.b2 import ropeJointDef # noqa: F401
from Box2D.b2 import shape # noqa: F401; noqa: F401
from gym.envs.box2d.car_dynamics import Car
from carl.envs.box2d.parking_garage.utils import Particle
__author__ = "André Biedenkapp"
"""
Original Simulator parameters from gym.envs.box2d.car_dynamics.Car
If we replace one value with some other we comment the value here and replace it below with our own values
"""
SIZE = 0.02
WHEEL_R = 27
WHEEL_COLOR = (0.0, 0.0, 0.0)
WHEEL_WHITE = (0.3, 0.3, 0.3)
MUD_COLOR = (0.4, 0.4, 0.0)
"""
Changed and added Simulator parameters
"""
ENGINE_POWER = 50_000_000 * SIZE * SIZE
WHEEL_MOMENT_OF_INERTIA = 6_000 * SIZE * SIZE
FRICTION_LIMIT = (
1_250_000 * SIZE * SIZE
) # friction ~= mass ~= size^2 (calculated implicitly using density)
MOTOR_WHEEL_COLOR = (0.6, 0.6, 0.8)
WHEEL_W = 20
# Car Polys
WHEELPOS = [(-85, +650), (+85, +650), (-85, -30), (+85, -30)]
HULL_POLY1 = [(-70, +700), (+70, +700), (+80, +550), (-80, +550)]
HULL_POLY2 = [(-90, +550), (+90, +550), (+90, -60), (-90, -60)]
# Polys for small trailer
STRAILER_POLY = [
(-15, -70),
(+15, -70),
(-60, -100),
(+60, -100),
(-60, -240),
(+60, -240)
# (-15, -130), (+15, -130),
# (-60, -160), (+60, -160),
# (-60, -300), (+60, -300)
]
STRAILERWHEELPOS = [(-65, -170), (+65, -170)]
# Polys for large trailer
ATRAILER_POLY = [(-90, -80), (+90, -80), (-90, -110), (+90, -110)]
ATRAILER_POLY2 = [
(-40, -80),
(+40, -80),
(-40, -140),
(+40, -140),
]
ATRAILER_POLY3 = [(-90, -140), (+90, -140), (-90, -640), (+90, -640)]
ATRAILERWHEELPOS = [(-95, -95), (+95, -95), (-95, -605), (+95, -605)]
class Bus(Car):
"""
Different body to the original OpenAI car. We also added a brake bias with 40% front and 60% rear break bias
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
def __init__(
self, world: Box2D.b2World, init_angle: float, init_x: float, init_y: float
) -> None:
self._init_extra_params()
self.world = world
##### SETUP MAIN BODY #### # noqa: E266
self.hull = self.world.CreateDynamicBody(
position=(init_x, init_y),
angle=init_angle,
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY1]
),
density=0.66,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY2]
),
density=0.2,
),
],
)
self.hull.color = (1.0, 0.85, 0.0)
self.wheels = []
self.fuel_spent = 0.0
WHEEL_POLY = [
(-WHEEL_W, +WHEEL_R),
(+WHEEL_W, +WHEEL_R),
(+WHEEL_W, -WHEEL_R),
(-WHEEL_W, -WHEEL_R),
]
for wx, wy in WHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
if wy > 0 and self.fwd:
w.color = MOTOR_WHEEL_COLOR
elif wy < 0 and self.rwd:
w.color = MOTOR_WHEEL_COLOR
else:
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.7,
upperAngle=+0.7,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
##### SETUP SMALL TRAILER #### # noqa: E266
if self.trailer_type == 1:
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in STRAILER_POLY]
),
density=2.0,
),
)
self.trailer.color = (0.0, 0.0, 0.8)
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=self.trailer,
localAnchorA=(0, -60 * SIZE),
localAnchorB=(0, -70 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 100 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.9,
upperAngle=+0.9,
)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in STRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer]
##### SETUP LARGE TRAILER #### # noqa: E266
elif self.trailer_type == 2:
self.trailer_axel = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY]
),
density=0.5,
categoryBits=0x0020,
maskBits=0x001,
),
)
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY2]
),
density=5.0,
categoryBits=0x0020,
maskBits=0x001,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY3]
),
density=1.5,
categoryBits=0x0020,
maskBits=0x001,
),
],
)
rjd = distanceJointDef(
bodyA=self.hull,
bodyB=self.trailer_axel,
localAnchorA=(0, -60 * SIZE),
localAnchorB=(-7.5 * SIZE, -80 * SIZE),
dampingRatio=0,
frequencyHz=500,
length=1.25,
)
self.trailer_axel.joint = self.world.CreateJoint(rjd)
rjd = distanceJointDef(
bodyA=self.hull,
bodyB=self.trailer_axel,
localAnchorA=(0, -60 * SIZE),
localAnchorB=(+7.5 * SIZE, -80 * SIZE),
dampingRatio=0,
frequencyHz=500,
length=1.25,
)
self.trailer_axel.joint = self.world.CreateJoint(rjd)
self.trailer_axel.color = (0.0, 0.8, 0.8)
rjd = revoluteJointDef(
bodyA=self.trailer_axel,
bodyB=self.trailer,
localAnchorA=(0.0, -95 * SIZE),
localAnchorB=(0, -95 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=360 * 3000 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.5,
upperAngle=+0.5,
)
self.trailer.color = (0.0, 0.0, 0.8)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in ATRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer if wy < -170 else self.trailer_axel,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer, self.trailer_axel]
else:
self.drawlist = self.wheels + [self.hull]
self.particles: List[Particle] = []
def gas(self, gas: float) -> None:
"""control: rear wheel drive
Args:
gas (float): How much gas gets applied. Gets clipped between 0 and 1.
"""
gas = np.clip(gas, 0, 1)
if self.fwd:
for w in self.wheels[:2]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
if self.rwd:
for w in self.wheels[2:4]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
def brake(self, b: float) -> None:
"""control: brake
Args:
b (0..1): Degree to which the brakes are applied. More than 0.9 blocks the wheels to zero rotation"""
for w in self.wheels[:2]:
w.brake = b * 0.4
for w in self.wheels[2:4]:
w.brake = b * 0.6
if self.trailer_type == 1:
for w in self.wheels[4:6]:
w.brake = b * 0.7
if self.trailer_type == 2:
for w in self.wheels[4:]:
w.brake = b * 0.8
def steer(self, s: float) -> None:
"""control: steer
Args:
s (-1..1): target position, it takes time to rotate steering wheel from side-to-side"""
self.wheels[0].steer = s
self.wheels[1].steer = s
def step(self, dt: float) -> None:
"""
Copy of the original step function of 'gym.envs.box2d.car_dynamics.Car' needed to accept different
Engin powers or other fixed parameters
dt : float
Timestep for simulation
"""
for w in self.wheels:
# Steer each wheel
dir = np.sign(w.steer - w.joint.angle)
val = abs(w.steer - w.joint.angle)
w.joint.motorSpeed = dir * min(50.0 * val, 3.0)
# Position => friction_limit
grass = True
friction_limit = FRICTION_LIMIT * 0.6 # Grass friction if no tile
for tile in w.tiles:
friction_limit = max(
friction_limit, FRICTION_LIMIT * tile.road_friction
)
grass = False
# Force
forw = w.GetWorldVector((0, 1))
side = w.GetWorldVector((1, 0))
v = w.linearVelocity
vf = forw[0] * v[0] + forw[1] * v[1] # forward speed
vs = side[0] * v[0] + side[1] * v[1] # side speed
# WHEEL_MOMENT_OF_INERTIA*np.square(w.omega)/2 = E -- energy
# WHEEL_MOMENT_OF_INERTIA*w.omega * domega/dt = dE/dt = W -- power
# domega = dt*W/WHEEL_MOMENT_OF_INERTIA/w.omega
# add small coef not to divide by zero
w.omega += (
dt
* ENGINE_POWER
* w.gas
/ WHEEL_MOMENT_OF_INERTIA
/ (abs(w.omega) + 5.0)
)
self.fuel_spent += dt * ENGINE_POWER * w.gas
if w.brake >= 0.9:
w.omega = 0
elif w.brake > 0:
BRAKE_FORCE = 15 # radians per second
dir = -np.sign(w.omega)
val = BRAKE_FORCE * w.brake
if abs(val) > abs(w.omega):
val = abs(w.omega) # low speed => same as = 0
w.omega += dir * val
w.phase += w.omega * dt
vr = w.omega * w.wheel_rad # rotating wheel speed
f_force = -vf + vr # force direction is direction of speed difference
p_force = -vs
# Physically correct is to always apply friction_limit until speed is equal.
# But dt is finite, that will lead to oscillations if difference is already near zero.
# Random coefficient to cut oscillations in few steps (have no effect on friction_limit)
f_force *= 205000 * SIZE * SIZE
p_force *= 205000 * SIZE * SIZE
force = np.sqrt(np.square(f_force) + np.square(p_force))
# Skid trace
if abs(force) > 2.0 * friction_limit:
if (
w.skid_particle
and w.skid_particle.grass == grass
and len(w.skid_particle.poly) < 30
):
w.skid_particle.poly.append((w.position[0], w.position[1]))
elif w.skid_start is None:
w.skid_start = w.position
else:
w.skid_particle = self._create_particle(
w.skid_start, w.position, grass
)
w.skid_start = None
else:
w.skid_start = None
w.skid_particle = None
if abs(force) > friction_limit:
f_force /= force
p_force /= force
force = friction_limit # Correct physics here
f_force *= force
p_force *= force
w.omega -= dt * f_force * w.wheel_rad / WHEEL_MOMENT_OF_INERTIA
w.ApplyForceToCenter(
(
p_force * side[0] + f_force * forw[0],
p_force * side[1] + f_force * forw[1],
),
True,
)
class FWDBus(Bus):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDBus(Bus):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class BusSmallTrailer(Bus):
"""
Bus with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class FWDBusSmallTrailer(Bus):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDBusSmallTrailer(Bus):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class BusLargeTrailer(Bus):
"""
Bus with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class FWDBusLargeTrailer(Bus):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDBusLargeTrailer(Bus):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
| 21,459 | 34.296053 | 113 | py |
null | CARL-main/carl/envs/box2d/parking_garage/race_car.py | from typing import List
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import polygonShape # noqa: F401
from Box2D.b2 import prismaticJointDef # noqa: F401
from Box2D.b2 import revoluteJointDef # noqa: F401
from Box2D.b2 import ropeJointDef # noqa: F401
from Box2D.b2 import shape # noqa: F401; noqa: F401
from gym.envs.box2d.car_dynamics import Car
from carl.envs.box2d.parking_garage.utils import Particle
__author__ = "André Biedenkapp"
"""
Original Simulator parameters from gym.envs.box2d.car_dynamics.Car
If we replace one value with some other we comment the value here and replace it below with our own values
"""
SIZE = 0.02
ENGINE_POWER = 100_000_000 * SIZE * SIZE
WHEEL_MOMENT_OF_INERTIA = 4_000 * SIZE * SIZE
FRICTION_LIMIT = (
1_000_000 * SIZE * SIZE
) # friction ~= mass ~= size^2 (calculated implicitly using density)
WHEEL_R = 27
WHEEL_W = 14
WHEELPOS = [(-55, +80), (+55, +80), (-55, -82), (+55, -82)]
HULL_POLY1 = [(-60, +130), (+60, +130), (+60, +110), (-60, +110)]
HULL_POLY2 = [(-15, +120), (+15, +120), (+20, +20), (-20, 20)]
HULL_POLY3 = [
(+25, +20),
(+50, -10),
(+50, -40),
(+20, -90),
(-20, -90),
(-50, -40),
(-50, -10),
(-25, +20),
]
HULL_POLY4 = [(-50, -120), (+50, -120), (+50, -90), (-50, -90)]
WHEEL_COLOR = (0.0, 0.0, 0.0)
WHEEL_WHITE = (0.3, 0.3, 0.3)
MUD_COLOR = (0.4, 0.4, 0.0)
"""
Changed and added Simulator parameters
"""
MOTOR_WHEEL_COLOR = (0.6, 0.6, 0.8)
# Polys for small trailer
STRAILER_POLY = [
(-15, -130),
(+15, -130),
(-60, -160),
(+60, -160),
(-60, -300),
(+60, -300),
]
STRAILERWHEELPOS = [(-65, -230), (+65, -230)]
# Polys for large trailer
ATRAILER_POLY = [(-60, -140), (+60, -140), (-60, -170), (+60, -170)]
ATRAILER_POLY2 = [
(-10, -140),
(+10, -140),
(-10, -200),
(+10, -200),
]
ATRAILER_POLY3 = [(-60, -200), (+60, -200), (-60, -500), (+60, -500)]
ATRAILERWHEELPOS = [(-65, -155), (+65, -155), (-65, -485), (+65, -485)]
class RaceCar(Car):
"""
The default race car does only differ from the original race car in openAI gym by changing the color of the driven
wheels. We also added a brake bias with 40% front and 60% rear break bias
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
def __init__(
self, world: Box2D.b2World, init_angle: float, init_x: float, init_y: float
) -> None:
self._init_extra_params()
self.world = world
##### SETUP MAIN BODY #### # noqa: E266
self.hull = self.world.CreateDynamicBody(
position=(init_x, init_y),
angle=init_angle,
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY1]
),
density=1.0,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY2]
),
density=1.0,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY3]
),
density=1.0,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY4]
),
density=1.0,
),
],
)
self.hull.color = (0.8, 0.0, 0.0)
self.wheels = []
self.fuel_spent = 0.0
WHEEL_POLY = [
(-WHEEL_W, +WHEEL_R),
(+WHEEL_W, +WHEEL_R),
(+WHEEL_W, -WHEEL_R),
(-WHEEL_W, -WHEEL_R),
]
for wx, wy in WHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
if wy > 0 and self.fwd:
w.color = MOTOR_WHEEL_COLOR
elif wy < 0 and self.rwd:
w.color = MOTOR_WHEEL_COLOR
else:
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
##### SETUP SMALL TRAILER #### # noqa: E266
if self.trailer_type == 1:
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in STRAILER_POLY]
),
density=0.75,
),
)
self.trailer.color = (0.0, 0.0, 0.8)
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=self.trailer,
localAnchorA=(0, -120 * SIZE),
localAnchorB=(0, -135 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.9,
upperAngle=+0.9,
)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in STRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer]
##### SETUP LARGE TRAILER #### # noqa: E266
elif self.trailer_type == 2:
self.trailer_axel = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY]
),
density=0.5,
categoryBits=0x0020,
maskBits=0x001,
),
)
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY2]
),
density=5.0,
categoryBits=0x0020,
maskBits=0x001,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY3]
),
density=0.5,
categoryBits=0x0020,
maskBits=0x001,
),
],
)
rjd = distanceJointDef(
bodyA=self.hull,
bodyB=self.trailer_axel,
localAnchorA=(0, -120 * SIZE),
localAnchorB=(-7.5 * SIZE, -140 * SIZE),
dampingRatio=0,
frequencyHz=500,
length=1.25,
)
self.trailer_axel.joint = self.world.CreateJoint(rjd)
rjd = distanceJointDef(
bodyA=self.hull,
bodyB=self.trailer_axel,
localAnchorA=(0, -120 * SIZE),
localAnchorB=(+7.5 * SIZE, -140 * SIZE),
dampingRatio=0,
frequencyHz=500,
length=1.25,
)
self.trailer_axel.joint = self.world.CreateJoint(rjd)
self.trailer_axel.color = (0.0, 0.8, 0.8)
rjd = revoluteJointDef(
bodyA=self.trailer_axel,
bodyB=self.trailer,
localAnchorA=(0.0, -155 * SIZE),
localAnchorB=(0, -155 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=360 * 3000 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.5,
upperAngle=+0.5,
)
self.trailer.color = (0.0, 0.0, 0.8)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in ATRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer if wy < -170 else self.trailer_axel,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer, self.trailer_axel]
else:
self.drawlist = self.wheels + [self.hull]
self.particles: List[Particle] = []
def gas(self, gas: float) -> None:
"""control: rear wheel drive
Args:
gas (float): How much gas gets applied. Gets clipped between 0 and 1.
"""
gas = np.clip(gas, 0, 1)
if self.fwd:
for w in self.wheels[:2]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
if self.rwd:
for w in self.wheels[2:4]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
def brake(self, b: float) -> None:
"""control: brake
Args:
b (0..1): Degree to which the brakes are applied. More than 0.9 blocks the wheels to zero rotation"""
for w in self.wheels[:2]:
w.brake = b * 0.4
for w in self.wheels[2:4]:
w.brake = b * 0.6
if self.trailer_type == 1:
for w in self.wheels[4:6]:
w.brake = b * 0.7
if self.trailer_type == 2:
for w in self.wheels[4:]:
w.brake = b * 0.8
def steer(self, s: float) -> None:
"""control: steer
Args:
s (-1..1): target position, it takes time to rotate steering wheel from side-to-side"""
self.wheels[0].steer = s
self.wheels[1].steer = s
def step(self, dt: float) -> None:
"""
Copy of the original step function of 'gym.envs.box2d.car_dynamics.Car' needed to accept different
engine powers or other fixed parameters
dt : float
Timestep for simulation
"""
for w in self.wheels:
# Steer each wheel
dir = np.sign(w.steer - w.joint.angle)
val = abs(w.steer - w.joint.angle)
w.joint.motorSpeed = dir * min(50.0 * val, 3.0)
# Position => friction_limit
grass = True
friction_limit = FRICTION_LIMIT * 0.6 # Grass friction if no tile
for tile in w.tiles:
friction_limit = max(
friction_limit, FRICTION_LIMIT * tile.road_friction
)
grass = False
# Force
forw = w.GetWorldVector((0, 1))
side = w.GetWorldVector((1, 0))
v = w.linearVelocity
vf = forw[0] * v[0] + forw[1] * v[1] # forward speed
vs = side[0] * v[0] + side[1] * v[1] # side speed
# WHEEL_MOMENT_OF_INERTIA*np.square(w.omega)/2 = E -- energy
# WHEEL_MOMENT_OF_INERTIA*w.omega * domega/dt = dE/dt = W -- power
# domega = dt*W/WHEEL_MOMENT_OF_INERTIA/w.omega
# add small coef not to divide by zero
w.omega += (
dt
* ENGINE_POWER
* w.gas
/ WHEEL_MOMENT_OF_INERTIA
/ (abs(w.omega) + 5.0)
)
self.fuel_spent += dt * ENGINE_POWER * w.gas
if w.brake >= 0.9:
w.omega = 0
elif w.brake > 0:
BRAKE_FORCE = 15 # radians per second
dir = -np.sign(w.omega)
val = BRAKE_FORCE * w.brake
if abs(val) > abs(w.omega):
val = abs(w.omega) # low speed => same as = 0
w.omega += dir * val
w.phase += w.omega * dt
vr = w.omega * w.wheel_rad # rotating wheel speed
f_force = -vf + vr # force direction is direction of speed difference
p_force = -vs
# Physically correct is to always apply friction_limit until speed is equal.
# But dt is finite, that will lead to oscillations if difference is already near zero.
# Random coefficient to cut oscillations in few steps (have no effect on friction_limit)
f_force *= 205000 * SIZE * SIZE
p_force *= 205000 * SIZE * SIZE
force = np.sqrt(np.square(f_force) + np.square(p_force))
# Skid trace
if abs(force) > 2.0 * friction_limit:
if (
w.skid_particle
and w.skid_particle.grass == grass
and len(w.skid_particle.poly) < 30
):
w.skid_particle.poly.append((w.position[0], w.position[1]))
elif w.skid_start is None:
w.skid_start = w.position
else:
w.skid_particle = self._create_particle(
w.skid_start, w.position, grass
)
w.skid_start = None
else:
w.skid_start = None
w.skid_particle = None
if abs(force) > friction_limit:
f_force /= force
p_force /= force
force = friction_limit # Correct physics here
f_force *= force
p_force *= force
w.omega -= dt * f_force * w.wheel_rad / WHEEL_MOMENT_OF_INERTIA
w.ApplyForceToCenter(
(
p_force * side[0] + f_force * forw[0],
p_force * side[1] + f_force * forw[1],
),
True,
)
class FWDRaceCar(RaceCar):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDRaceCar(RaceCar):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class RaceCarSmallTrailer(RaceCar):
"""
RaceCar with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class FWDRaceCarSmallTrailer(RaceCar):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDRaceCarSmallTrailer(RaceCar):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class RaceCarLargeTrailer(RaceCar):
"""
RaceCar with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class FWDRaceCarLargeTrailer(RaceCar):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDRaceCarLargeTrailer(RaceCar):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
| 22,179 | 34.374801 | 118 | py |
null | CARL-main/carl/envs/box2d/parking_garage/street_car.py | from __future__ import annotations
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import polygonShape # noqa: F401
from Box2D.b2 import prismaticJointDef # noqa: F401
from Box2D.b2 import revoluteJointDef # noqa: F401
from Box2D.b2 import ropeJointDef # noqa: F401
from Box2D.b2 import shape # noqa: F401; noqa: F401
from gym.envs.box2d.car_dynamics import Car
__author__ = "André Biedenkapp"
"""
Original Simulator parameters from gym.envs.box2d.car_dynamics.Car
If we replace one value with some other we comment the value here and replace it below with our own values
"""
SIZE = 0.02
WHEEL_R = 27
WHEEL_COLOR = (0.0, 0.0, 0.0)
WHEEL_WHITE = (0.3, 0.3, 0.3)
MUD_COLOR = (0.4, 0.4, 0.0)
"""
Changed and added Simulator parameters
"""
ENGINE_POWER = 10_000_000 * SIZE * SIZE
WHEEL_MOMENT_OF_INERTIA = 1_000 * SIZE * SIZE
FRICTION_LIMIT = (
750_000 * SIZE * SIZE
) # friction ~= mass ~= size^2 (calculated implicitly using density)
MOTOR_WHEEL_COLOR = (0.6, 0.6, 0.8)
WHEEL_W = 10
# Car Polys
WHEELPOS = [(-60, +140), (+60, +140), (-60, -30), (+60, -30)]
HULL_POLY1 = [(-40, +180), (+40, +180), (+55, +160), (-55, +160)]
HULL_POLY2 = [(-55, +160), (+55, +160), (+55, -60), (-55, -60)]
HULL_POLY3 = [
(+55, -40),
(-55, -40),
(-65, -75),
(+65, -75),
]
# Polys for small trailer
STRAILER_POLY = [
(-15, -85),
(+15, -85),
(-60, -115),
(+60, -115),
(-60, -255),
(+60, -255)
# (-15, -130), (+15, -130),
# (-60, -160), (+60, -160),
# (-60, -300), (+60, -300)
]
STRAILERWHEELPOS = [(-65, -185), (+65, -185)]
# Polys for large trailer
ATRAILER_POLY = [(-60, -95), (+60, -95), (-60, -125), (+60, -125)]
ATRAILER_POLY2 = [
(-10, -95),
(+10, -95),
(-10, -155),
(+10, -155),
]
ATRAILER_POLY3 = [(-60, -155), (+60, -155), (-60, -455), (+60, -455)]
ATRAILERWHEELPOS = [(-65, -110), (+65, -110), (-65, -420), (+65, -420)]
class StreetCar(Car):
"""
Different body to the original OpenAI car. We also added a brake bias with 40% front and 60% rear break bias
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
def __init__(
self, world: Box2D.b2World, init_angle: float, init_x: int, init_y: int
):
self._init_extra_params()
self.world = world
##### SETUP MAIN BODY #### # noqa: E266
self.hull = self.world.CreateDynamicBody(
position=(init_x, init_y),
angle=init_angle,
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY1]
),
density=1.0,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY2]
),
density=1.0,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in HULL_POLY3]
),
density=1.0,
),
],
)
self.hull.color = (1.0, 0.31, 0.0)
self.wheels = []
self.fuel_spent = 0.0
WHEEL_POLY = [
(-WHEEL_W, +WHEEL_R),
(+WHEEL_W, +WHEEL_R),
(+WHEEL_W, -WHEEL_R),
(-WHEEL_W, -WHEEL_R),
]
for wx, wy in WHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
if wy > 0 and self.fwd:
w.color = MOTOR_WHEEL_COLOR
elif wy < 0 and self.rwd:
w.color = MOTOR_WHEEL_COLOR
else:
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
##### SETUP SMALL TRAILER #### # noqa: E266
if self.trailer_type == 1:
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in STRAILER_POLY]
),
density=0.75,
),
)
self.trailer.color = (0.0, 0.0, 0.8)
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=self.trailer,
localAnchorA=(0, -75 * SIZE),
localAnchorB=(0, -85 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.9,
upperAngle=+0.9,
)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in STRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer]
##### SETUP LARGE TRAILER #### # noqa: E266
elif self.trailer_type == 2:
self.trailer_axel = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY]
),
density=0.5,
categoryBits=0x0020,
maskBits=0x001,
),
)
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY2]
),
density=5.0,
categoryBits=0x0020,
maskBits=0x001,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in ATRAILER_POLY3]
),
density=0.5,
categoryBits=0x0020,
maskBits=0x001,
),
],
)
rjd = distanceJointDef(
bodyA=self.hull,
bodyB=self.trailer_axel,
localAnchorA=(0, -75 * SIZE),
localAnchorB=(-7.5 * SIZE, -95 * SIZE),
dampingRatio=0,
frequencyHz=500,
length=1.25,
)
self.trailer_axel.joint = self.world.CreateJoint(rjd)
rjd = distanceJointDef(
bodyA=self.hull,
bodyB=self.trailer_axel,
localAnchorA=(0, -75 * SIZE),
localAnchorB=(+7.5 * SIZE, -95 * SIZE),
dampingRatio=0,
frequencyHz=500,
length=1.25,
)
self.trailer_axel.joint = self.world.CreateJoint(rjd)
self.trailer_axel.color = (0.0, 0.8, 0.8)
rjd = revoluteJointDef(
bodyA=self.trailer_axel,
bodyB=self.trailer,
localAnchorA=(0.0, -110 * SIZE),
localAnchorB=(0, -110 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=360 * 3000 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.5,
upperAngle=+0.5,
)
self.trailer.color = (0.0, 0.0, 0.8)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in ATRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer if wy < -170 else self.trailer_axel,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer, self.trailer_axel]
else:
self.drawlist = self.wheels + [self.hull]
self.particles: list = []
def gas(self, gas: float) -> None:
"""control: rear wheel drive
Args:
gas (float): How much gas gets applied. Gets clipped between 0 and 1.
"""
gas = np.clip(gas, 0, 1)
if self.fwd:
for w in self.wheels[:2]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
if self.rwd:
for w in self.wheels[2:4]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
def brake(self, b: float) -> None:
"""control: brake
Args:
b (0..1): Degree to which the brakes are applied. More than 0.9 blocks the wheels to zero rotation"""
for w in self.wheels[:2]:
w.brake = b * 0.4
for w in self.wheels[2:4]:
w.brake = b * 0.6
if self.trailer_type == 1:
for w in self.wheels[4:6]:
w.brake = b * 0.7
if self.trailer_type == 2:
for w in self.wheels[4:]:
w.brake = b * 0.8
def steer(self, s: float) -> None:
"""control: steer
Args:
s (-1..1): target position, it takes time to rotate steering wheel from side-to-side"""
self.wheels[0].steer = s
self.wheels[1].steer = s
def step(self, dt: float) -> None:
"""
Copy of the original step function of 'gym.envs.box2d.car_dynamics.Car' needed to accept different
Engin powers or other fixed parameters
:param dt:
:return:
"""
for w in self.wheels:
# Steer each wheel
dir = np.sign(w.steer - w.joint.angle)
val = abs(w.steer - w.joint.angle)
w.joint.motorSpeed = dir * min(50.0 * val, 3.0)
# Position => friction_limit
grass = True
friction_limit = FRICTION_LIMIT * 0.6 # Grass friction if no tile
for tile in w.tiles:
friction_limit = max(
friction_limit, FRICTION_LIMIT * tile.road_friction
)
grass = False
# Force
forw = w.GetWorldVector((0, 1))
side = w.GetWorldVector((1, 0))
v = w.linearVelocity
vf = forw[0] * v[0] + forw[1] * v[1] # forward speed
vs = side[0] * v[0] + side[1] * v[1] # side speed
# WHEEL_MOMENT_OF_INERTIA*np.square(w.omega)/2 = E -- energy
# WHEEL_MOMENT_OF_INERTIA*w.omega * domega/dt = dE/dt = W -- power
# domega = dt*W/WHEEL_MOMENT_OF_INERTIA/w.omega
# add small coef not to divide by zero
w.omega += (
dt
* ENGINE_POWER
* w.gas
/ WHEEL_MOMENT_OF_INERTIA
/ (abs(w.omega) + 5.0)
)
self.fuel_spent += dt * ENGINE_POWER * w.gas
if w.brake >= 0.9:
w.omega = 0
elif w.brake > 0:
BRAKE_FORCE = 15 # radians per second
dir = -np.sign(w.omega)
val = BRAKE_FORCE * w.brake
if abs(val) > abs(w.omega):
val = abs(w.omega) # low speed => same as = 0
w.omega += dir * val
w.phase += w.omega * dt
vr = w.omega * w.wheel_rad # rotating wheel speed
f_force = -vf + vr # force direction is direction of speed difference
p_force = -vs
# Physically correct is to always apply friction_limit until speed is equal.
# But dt is finite, that will lead to oscillations if difference is already near zero.
# Random coefficient to cut oscillations in few steps (have no effect on friction_limit)
f_force *= 205000 * SIZE * SIZE
p_force *= 205000 * SIZE * SIZE
force = np.sqrt(np.square(f_force) + np.square(p_force))
# Skid trace
if abs(force) > 2.0 * friction_limit:
if (
w.skid_particle
and w.skid_particle.grass == grass
and len(w.skid_particle.poly) < 30
):
w.skid_particle.poly.append((w.position[0], w.position[1]))
elif w.skid_start is None:
w.skid_start = w.position
else:
w.skid_particle = self._create_particle(
w.skid_start, w.position, grass
)
w.skid_start = None
else:
w.skid_start = None
w.skid_particle = None
if abs(force) > friction_limit:
f_force /= force
p_force /= force
force = friction_limit # Correct physics here
f_force *= force
p_force *= force
w.omega -= dt * f_force * w.wheel_rad / WHEEL_MOMENT_OF_INERTIA
w.ApplyForceToCenter(
(
p_force * side[0] + f_force * forw[0],
p_force * side[1] + f_force * forw[1],
),
True,
)
class FWDStreetCar(StreetCar):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDStreetCar(StreetCar):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class StreetCarSmallTrailer(StreetCar):
"""
StreetCar with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class FWDStreetCarSmallTrailer(StreetCar):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDStreetCarSmallTrailer(StreetCar):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class StreetCarLargeTrailer(StreetCar):
"""
StreetCar with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class FWDStreetCarLargeTrailer(StreetCar):
"""
Front wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = False # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
class AWDStreetCarLargeTrailer(StreetCar):
"""
4x4 wheel driven race car
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = True # Flag to determine which wheels are driven
self.trailer_type = (
2 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large
)
| 21,788 | 34.314425 | 113 | py |
null | CARL-main/carl/envs/box2d/parking_garage/trike.py | from typing import List
import Box2D
import numpy as np
from Box2D.b2 import circleShape # noqa: F401
from Box2D.b2 import contactListener # noqa: F401
from Box2D.b2 import distanceJointDef # noqa: F401
from Box2D.b2 import edgeShape # noqa: F401
from Box2D.b2 import fixtureDef # noqa: F401
from Box2D.b2 import polygonShape # noqa: F401
from Box2D.b2 import prismaticJointDef # noqa: F401
from Box2D.b2 import revoluteJointDef # noqa: F401
from Box2D.b2 import ropeJointDef # noqa: F401
from Box2D.b2 import shape # noqa: F401; noqa: F401
from gym.envs.box2d.car_dynamics import Car
from carl.envs.box2d.parking_garage.utils import Particle
__author__ = "André Biedenkapp"
"""
Original Simulator parameters from gym.envs.box2d.car_dynamics.Car
If we replace one value with some other we comment the value here and replace it below with our own values
"""
SIZE = 0.02
WHEEL_COLOR = (0.0, 0.0, 0.0)
WHEEL_WHITE = (0.3, 0.3, 0.3)
MUD_COLOR = (0.4, 0.4, 0.0)
"""
Changed and added Simulator parameters
"""
MOTOR_WHEEL_COLOR = (0.6, 0.6, 0.8)
ENGINE_POWER = 25_000_000 * SIZE * SIZE
WHEEL_MOMENT_OF_INERTIA = 2_000 * SIZE * SIZE
FRICTION_LIMIT = (
1_000_000 * SIZE * SIZE
) # friction ~= mass ~= size^2 (calculated implicitly using density)
WHEEL_R = 30
WHEEL_W = 10
BWHEELPOS = [(-0, +80), (-70, -82), (+70, -82)]
BHULL_POLY2 = [(-15, +70), (+15, +70), (+20, +50), (-20, 50)]
BHULL_POLY3 = [(-65, -120), (+65, -120), (+45, +50), (-45, +50)]
# Polys for small trailer
STRAILER_POLY = [
(-15, -130),
(+15, -130),
(-60, -160),
(+60, -160),
(-60, -300),
(+60, -300),
]
STRAILERWHEELPOS = [(-65, -230), (+65, -230)]
class TukTuk(Car):
"""
TukTuk
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven (Not supported)
self.trailer_type = 0 # Determines which trailer to attach 0 -> none, 1 -> small, 2 -> large (not supported)
def __init__(
self, world: Box2D.b2World, init_angle: float, init_x: float, init_y: float
) -> None:
self._init_extra_params()
self.world = world
##### SETUP MAIN BODY #### # noqa: E266
self.hull = self.world.CreateDynamicBody(
position=(init_x, init_y),
angle=init_angle,
fixtures=[
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in BHULL_POLY2]
),
density=1,
),
fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in BHULL_POLY3]
),
density=1,
),
],
)
self.hull.color = (0.2, 0.5, 1.0)
self.wheels = []
self.fuel_spent = 0.0
WHEEL_POLY = [
(-WHEEL_W, +WHEEL_R),
(+WHEEL_W, +WHEEL_R),
(+WHEEL_W, -WHEEL_R),
(-WHEEL_W, -WHEEL_R),
]
for wx, wy in BWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
if wy > 0 and self.fwd:
w.color = MOTOR_WHEEL_COLOR
elif wy < 0 and self.rwd:
w.color = MOTOR_WHEEL_COLOR
else:
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.9,
upperAngle=+0.9,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
##### SETUP SMALL TRAILER #### # noqa: E266
if self.trailer_type == 1:
self.trailer = self.world.CreateDynamicBody(
angle=init_angle,
position=(init_x, init_y),
fixtures=fixtureDef(
shape=polygonShape(
vertices=[(x * SIZE, y * SIZE) for x, y in STRAILER_POLY]
),
density=0.75,
),
)
self.trailer.color = (0.0, 0.0, 0.8)
rjd = revoluteJointDef(
bodyA=self.hull,
bodyB=self.trailer,
localAnchorA=(0, -120 * SIZE),
localAnchorB=(0, -135 * SIZE),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.9,
upperAngle=+0.9,
)
self.trailer.joint = self.world.CreateJoint(rjd)
for wx, wy in STRAILERWHEELPOS:
front_k = 1.0 if wy > 0 else 1.0
w = self.world.CreateDynamicBody(
position=(init_x + wx * SIZE, init_y + wy * SIZE),
angle=init_angle,
fixtures=fixtureDef(
shape=polygonShape(
vertices=[
(x * front_k * SIZE, y * front_k * SIZE)
for x, y in WHEEL_POLY
]
),
density=0.1,
categoryBits=0x0020,
maskBits=0x001,
restitution=0.0,
),
)
w.wheel_rad = front_k * WHEEL_R * SIZE
w.color = WHEEL_COLOR
w.gas = 0.0
w.brake = 0.0
w.steer = 0.0
w.phase = 0.0 # wheel angle
w.omega = 0.0 # angular velocity
w.skid_start = None
w.skid_particle = None
rjd = revoluteJointDef(
bodyA=self.trailer,
bodyB=w,
localAnchorA=(wx * SIZE, wy * SIZE),
localAnchorB=(0, 0),
enableMotor=True,
enableLimit=True,
maxMotorTorque=180 * 900 * SIZE * SIZE,
motorSpeed=0,
lowerAngle=-0.4,
upperAngle=+0.4,
)
w.joint = self.world.CreateJoint(rjd)
w.tiles = set()
w.userData = w
self.wheels.append(w)
self.drawlist = self.wheels + [self.hull, self.trailer]
##### SETUP LARGE TRAILER #### # noqa: E266
elif self.trailer_type == 2:
raise NotImplementedError
else:
self.drawlist = self.wheels + [self.hull]
self.particles: List[Particle] = []
def steer(self, s: float) -> None:
"""control: steer
Args:
s (-1..1): target position, it takes time to rotate steering wheel from side-to-side"""
self.wheels[0].steer = s
def gas(self, gas: float) -> None:
"""control: rear wheel drive
Args:
gas (float): How much gas gets applied. Gets clipped between 0 and 1.
"""
gas = np.clip(gas, 0, 1)
if self.fwd:
raise NotImplementedError # Setting up FWD somehow causes an exception
if self.rwd:
for w in self.wheels[1:3]:
diff = gas - w.gas
if diff > 0.1:
diff = 0.1 # gradually increase, but stop immediately
w.gas += diff
def brake(self, b: float) -> None:
"""control: brake
Args:
b (0..1): Degree to which the brakes are applied. More than 0.9 blocks the wheels to zero rotation"""
for w in self.wheels[0]:
w.brake = b * 10
for w in self.wheels[1:3]:
w.brake = b * 0.6
if self.trailer_type == 1:
for w in self.wheels[3:5]:
w.brake = b * 0.8
if self.trailer_type == 2:
for w in self.wheels[5:]:
w.brake = b * 0.8
def step(self, dt: float) -> None:
"""
Copy of the original step function of 'gym.envs.box2d.car_dynamics.Car' needed to accept different
Engin powers or other fixed parameters
dt : float
Timestep for simulation
"""
for w in self.wheels:
# Steer each wheel
dir = np.sign(w.steer - w.joint.angle)
val = abs(w.steer - w.joint.angle)
w.joint.motorSpeed = dir * min(50.0 * val, 3.0)
# Position => friction_limit
grass = True
friction_limit = FRICTION_LIMIT * 0.6 # Grass friction if no tile
for tile in w.tiles:
friction_limit = max(
friction_limit, FRICTION_LIMIT * tile.road_friction
)
grass = False
# Force
forw = w.GetWorldVector((0, 1))
side = w.GetWorldVector((1, 0))
v = w.linearVelocity
vf = forw[0] * v[0] + forw[1] * v[1] # forward speed
vs = side[0] * v[0] + side[1] * v[1] # side speed
# WHEEL_MOMENT_OF_INERTIA*np.square(w.omega)/2 = E -- energy
# WHEEL_MOMENT_OF_INERTIA*w.omega * domega/dt = dE/dt = W -- power
# domega = dt*W/WHEEL_MOMENT_OF_INERTIA/w.omega
# add small coef not to divide by zero
w.omega += (
dt
* ENGINE_POWER
* w.gas
/ WHEEL_MOMENT_OF_INERTIA
/ (abs(w.omega) + 5.0)
)
self.fuel_spent += dt * ENGINE_POWER * w.gas
if w.brake >= 0.9:
w.omega = 0
elif w.brake > 0:
BRAKE_FORCE = 15 # radians per second
dir = -np.sign(w.omega)
val = BRAKE_FORCE * w.brake
if abs(val) > abs(w.omega):
val = abs(w.omega) # low speed => same as = 0
w.omega += dir * val
w.phase += w.omega * dt
vr = w.omega * w.wheel_rad # rotating wheel speed
f_force = -vf + vr # force direction is direction of speed difference
p_force = -vs
# Physically correct is to always apply friction_limit until speed is equal.
# But dt is finite, that will lead to oscillations if difference is already near zero.
# Random coefficient to cut oscillations in few steps (have no effect on friction_limit)
f_force *= 205000 * SIZE * SIZE
p_force *= 205000 * SIZE * SIZE
force = np.sqrt(np.square(f_force) + np.square(p_force))
# Skid trace
if abs(force) > 2.0 * friction_limit:
if (
w.skid_particle
and w.skid_particle.grass == grass
and len(w.skid_particle.poly) < 30
):
w.skid_particle.poly.append((w.position[0], w.position[1]))
elif w.skid_start is None:
w.skid_start = w.position
else:
w.skid_particle = self._create_particle(
w.skid_start, w.position, grass
)
w.skid_start = None
else:
w.skid_start = None
w.skid_particle = None
if abs(force) > friction_limit:
f_force /= force
p_force /= force
force = friction_limit # Correct physics here
f_force *= force
p_force *= force
w.omega -= dt * f_force * w.wheel_rad / WHEEL_MOMENT_OF_INERTIA
w.ApplyForceToCenter(
(
p_force * side[0] + f_force * forw[0],
p_force * side[1] + f_force * forw[1],
),
True,
)
class TukTukSmallTrailer(TukTuk):
"""
TukTuk with small trailer attached
"""
def _init_extra_params(self) -> None:
self.rwd = True # Flag to determine which wheels are driven
self.fwd = False # Flag to determine which wheels are driven
self.trailer_type = (
1 # Determines which trailer to attach 0 -> none, 1 -> small
)
| 13,543 | 34.270833 | 117 | py |
null | CARL-main/carl/envs/box2d/parking_garage/utils.py | class Particle:
pass
| 25 | 7.666667 | 15 | py |
null | CARL-main/carl/envs/brax/__init__.py | # flake8: noqa: F401
# Contexts and bounds by name
from carl.envs.brax.carl_ant import CONTEXT_BOUNDS as CARLAnt_bounds
from carl.envs.brax.carl_ant import DEFAULT_CONTEXT as CARLAnt_defaults
from carl.envs.brax.carl_ant import CARLAnt
from carl.envs.brax.carl_fetch import CONTEXT_BOUNDS as CARLFetch_bounds
from carl.envs.brax.carl_fetch import DEFAULT_CONTEXT as CARLFetch_defaults
from carl.envs.brax.carl_fetch import CARLFetch
from carl.envs.brax.carl_grasp import CONTEXT_BOUNDS as CARLGrasp_bounds
from carl.envs.brax.carl_grasp import DEFAULT_CONTEXT as CARLGrasp_defaults
from carl.envs.brax.carl_grasp import CARLGrasp
from carl.envs.brax.carl_halfcheetah import CONTEXT_BOUNDS as CARLHalfcheetah_bounds
from carl.envs.brax.carl_halfcheetah import DEFAULT_CONTEXT as CARLHalfcheetah_defaults
from carl.envs.brax.carl_halfcheetah import CARLHalfcheetah
from carl.envs.brax.carl_humanoid import CONTEXT_BOUNDS as CARLHumanoid_bounds
from carl.envs.brax.carl_humanoid import DEFAULT_CONTEXT as CARLHumanoid_defaults
from carl.envs.brax.carl_humanoid import CARLHumanoid
from carl.envs.brax.carl_ur5e import CONTEXT_BOUNDS as CARLUr5e_bounds
from carl.envs.brax.carl_ur5e import DEFAULT_CONTEXT as CARLUr5e_defaults
from carl.envs.brax.carl_ur5e import CARLUr5e
| 1,269 | 59.47619 | 87 | py |
null | CARL-main/carl/envs/brax/carl_ant.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.ant import _SYSTEM_CONFIG, Ant
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format import MessageToDict
from numpyencoder import NumpyEncoder
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"joint_stiffness": 5000,
"gravity": -9.8,
"friction": 0.6,
"angular_damping": -0.05,
"actuator_strength": 300,
"joint_angular_damping": 35,
"torso_mass": 10,
}
CONTEXT_BOUNDS = {
"joint_stiffness": (1, np.inf, float),
"gravity": (-np.inf, -0.1, float),
"friction": (-np.inf, np.inf, float),
"angular_damping": (-np.inf, np.inf, float),
"actuator_strength": (1, np.inf, float),
"joint_angular_damping": (0, np.inf, float),
"torso_mass": (0.1, np.inf, float),
}
class CARLAnt(CARLEnv):
def __init__(
self,
env: Ant = Ant(),
n_envs: int = 1,
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if n_envs == 1:
env = GymWrapper(env)
else:
env = VectorGymWrapper(VectorWrapper(env, n_envs))
self.base_config = MessageToDict(
text_format.Parse(_SYSTEM_CONFIG, brax.Config())
)
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
n_envs=n_envs,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: Ant
config = copy.deepcopy(self.base_config)
config["gravity"] = {"z": self.context["gravity"]}
config["friction"] = self.context["friction"]
config["angularDamping"] = self.context["angular_damping"]
for j in range(len(config["joints"])):
config["joints"][j]["angularDamping"] = self.context[
"joint_angular_damping"
]
config["joints"][j]["stiffness"] = self.context["joint_stiffness"]
for a in range(len(config["actuators"])):
config["actuators"][a]["strength"] = self.context["actuator_strength"]
config["bodies"][0]["mass"] = self.context["torso_mass"]
# This converts the dict to a JSON String, then parses it into an empty brax config
self.env.sys = brax.System(
json_format.Parse(json.dumps(config, cls=NumpyEncoder), brax.Config())
)
def __getattr__(self, name: str) -> Any:
if name in ["sys", "__getstate__"]:
return getattr(self.env._environment, name)
else:
return getattr(self, name)
| 4,160 | 35.5 | 91 | py |
null | CARL-main/carl/envs/brax/carl_fetch.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.fetch import _SYSTEM_CONFIG, Fetch
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format import MessageToDict
from numpyencoder import NumpyEncoder
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"joint_stiffness": 5000,
"gravity": -9.8,
"friction": 0.6,
"angular_damping": -0.05, # Angular velocity damping applied to each body
"actuator_strength": 300,
"joint_angular_damping": 35, # Damps parent and child angular velocities to be equal
"torso_mass": 1,
"target_radius": 2,
"target_distance": 15,
}
CONTEXT_BOUNDS = {
"joint_stiffness": (1, np.inf, float),
"gravity": (-np.inf, -0.1, float),
"friction": (-np.inf, np.inf, float),
"angular_damping": (-np.inf, np.inf, float),
"actuator_strength": (1, np.inf, float),
"joint_angular_damping": (0, np.inf, float),
"torso_mass": (0.1, np.inf, float),
"target_radius": (0.1, np.inf, float),
"target_distance": (0.1, np.inf, float),
}
class CARLFetch(CARLEnv):
def __init__(
self,
env: Fetch = Fetch(),
n_envs: int = 1,
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if n_envs == 1:
env = GymWrapper(env)
else:
env = VectorGymWrapper(VectorWrapper(env, n_envs))
self.base_config = MessageToDict(
text_format.Parse(_SYSTEM_CONFIG, brax.Config())
)
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
n_envs=n_envs,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: Fetch
config = copy.deepcopy(self.base_config)
config["gravity"] = {"z": self.context["gravity"]}
config["friction"] = self.context["friction"]
config["angularDamping"] = self.context["angular_damping"]
for j in range(len(config["joints"])):
config["joints"][j]["angularDamping"] = self.context[
"joint_angular_damping"
]
config["joints"][j]["stiffness"] = self.context["joint_stiffness"]
for a in range(len(config["actuators"])):
config["actuators"][a]["strength"] = self.context["actuator_strength"]
config["bodies"][0]["mass"] = self.context["torso_mass"]
# This converts the dict to a JSON String, then parses it into an empty brax config
self.env.sys = brax.System(
json_format.Parse(json.dumps(config, cls=NumpyEncoder), brax.Config())
)
self.env.target_idx = self.env.sys.body.index["Target"]
self.env.torso_idx = self.env.sys.body.index["Torso"]
self.env.target_radius = self.context["target_radius"]
self.env.target_distance = self.context["target_distance"]
def __getattr__(self, name: str) -> Any:
if name in [
"sys",
"target_distance",
"target_radius",
"target_idx",
"torso_idx",
]:
return getattr(self.env._environment, name)
else:
return getattr(self, name)
| 4,790 | 36.429688 | 91 | py |
null | CARL-main/carl/envs/brax/carl_grasp.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.grasp import _SYSTEM_CONFIG, Grasp
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format import MessageToDict
from numpyencoder import NumpyEncoder
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"joint_stiffness": 5000,
"gravity": -9.8,
"friction": 0.6,
"angular_damping": -0.05,
"actuator_strength": 300,
"joint_angular_damping": 50,
"target_radius": 1.1,
"target_distance": 10.0,
"target_height": 8.0,
}
CONTEXT_BOUNDS = {
"joint_stiffness": (1, np.inf, float),
"gravity": (-np.inf, -0.1, float),
"friction": (-np.inf, np.inf, float),
"angular_damping": (-np.inf, np.inf, float),
"actuator_strength": (1, np.inf, float),
"joint_angular_damping": (0, np.inf, float),
"target_radius": (0.1, np.inf, float),
"target_distance": (0.1, np.inf, float),
"target_height": (0.1, np.inf, float),
}
class CARLGrasp(CARLEnv):
def __init__(
self,
env: Grasp = Grasp(),
n_envs: int = 1,
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if n_envs == 1:
env = GymWrapper(env)
else:
env = VectorGymWrapper(VectorWrapper(env, n_envs))
self.base_config = MessageToDict(
text_format.Parse(_SYSTEM_CONFIG, brax.Config())
)
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
n_envs=n_envs,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: Grasp
config = copy.deepcopy(self.base_config)
config["gravity"] = {"z": self.context["gravity"]}
config["friction"] = self.context["friction"]
config["angularDamping"] = self.context["angular_damping"]
for j in range(len(config["joints"])):
config["joints"][j]["angularDamping"] = self.context[
"joint_angular_damping"
]
config["joints"][j]["stiffness"] = self.context["joint_stiffness"]
for a in range(len(config["actuators"])):
config["actuators"][a]["strength"] = self.context["actuator_strength"]
# This converts the dict to a JSON String, then parses it into an empty brax config
self.env.sys = brax.System(
json_format.Parse(json.dumps(config, cls=NumpyEncoder), brax.Config())
)
self.env.object_idx = self.env.sys.body.index["Object"]
self.env.target_idx = self.env.sys.body.index["Target"]
self.env.hand_idx = self.env.sys.body.index["HandThumbProximal"]
self.env.palm_idx = self.env.sys.body.index["HandPalm"]
self.env.target_radius = self.context["target_radius"]
self.env.target_distance = self.context["target_distance"]
self.env.target_height = self.context["target_height"]
def __getattr__(self, name: str) -> Any:
if name in [
"sys",
"object_idx",
"target_idx",
"hand_idx",
"palm_idx",
"target_radius",
"target_distance",
"target_height",
]:
return getattr(self.env._environment, name)
else:
return getattr(self, name)
| 4,911 | 35.932331 | 91 | py |
null | CARL-main/carl/envs/brax/carl_halfcheetah.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.half_cheetah import _SYSTEM_CONFIG, Halfcheetah
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format import MessageToDict
from numpyencoder import NumpyEncoder
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"joint_stiffness": 15000.0,
"gravity": -9.8,
"friction": 0.6,
"angular_damping": -0.05,
"joint_angular_damping": 20,
"torso_mass": 9.457333,
}
CONTEXT_BOUNDS = {
"joint_stiffness": (1, np.inf, float),
"gravity": (-np.inf, -0.1, float),
"friction": (-np.inf, np.inf, float),
"angular_damping": (-np.inf, np.inf, float),
"joint_angular_damping": (0, np.inf, float),
"torso_mass": (0.1, np.inf, float),
}
class CARLHalfcheetah(CARLEnv):
def __init__(
self,
env: Halfcheetah = Halfcheetah(),
n_envs: int = 1,
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if n_envs == 1:
env = GymWrapper(env)
else:
env = VectorGymWrapper(VectorWrapper(env, n_envs))
self.base_config = MessageToDict(
text_format.Parse(_SYSTEM_CONFIG, brax.Config())
)
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
n_envs=n_envs,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: Halfcheetah
config = copy.deepcopy(self.base_config)
config["gravity"] = {"z": self.context["gravity"]}
config["friction"] = self.context["friction"]
config["angularDamping"] = self.context["angular_damping"]
for j in range(len(config["joints"])):
config["joints"][j]["angularDamping"] = self.context[
"joint_angular_damping"
]
config["joints"][j]["stiffness"] = self.context["joint_stiffness"]
config["bodies"][0]["mass"] = self.context["torso_mass"]
# This converts the dict to a JSON String, then parses it into an empty brax config
self.env.sys = brax.System(
json_format.Parse(json.dumps(config, cls=NumpyEncoder), brax.Config())
)
def __getattr__(self, name: str) -> Any:
if name in ["sys"]:
return getattr(self.env._environment, name)
else:
return getattr(self, name)
| 3,994 | 35.318182 | 91 | py |
null | CARL-main/carl/envs/brax/carl_humanoid.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax import jumpy as jp
from brax.envs.humanoid import _SYSTEM_CONFIG, Humanoid
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from brax.physics import bodies
from google.protobuf import json_format, text_format
from google.protobuf.json_format import MessageToDict
from numpyencoder import NumpyEncoder
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"gravity": -9.8,
"friction": 0.6,
"angular_damping": -0.05,
"joint_angular_damping": 20,
"torso_mass": 8.907463,
}
CONTEXT_BOUNDS = {
"gravity": (-np.inf, -0.1, float),
"friction": (-np.inf, np.inf, float),
"angular_damping": (-np.inf, np.inf, float),
"joint_angular_damping": (0, np.inf, float),
"torso_mass": (0.1, np.inf, float),
}
class CARLHumanoid(CARLEnv):
def __init__(
self,
env: Humanoid = Humanoid(),
n_envs: int = 1,
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if n_envs == 1:
env = GymWrapper(env)
else:
env = VectorGymWrapper(VectorWrapper(env, n_envs))
self.base_config = MessageToDict(
text_format.Parse(_SYSTEM_CONFIG, brax.Config())
)
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
n_envs=n_envs,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: Humanoid
config = copy.deepcopy(self.base_config)
config["gravity"] = {"z": self.context["gravity"]}
config["friction"] = self.context["friction"]
config["angularDamping"] = self.context["angular_damping"]
for j in range(len(config["joints"])):
config["joints"][j]["angularDamping"] = self.context[
"joint_angular_damping"
]
config["bodies"][0]["mass"] = self.context["torso_mass"]
# This converts the dict to a JSON String, then parses it into an empty brax config
protobuf_config = json_format.Parse(
json.dumps(config, cls=NumpyEncoder), brax.Config()
)
self.env.sys = brax.System(protobuf_config)
body = bodies.Body(config=self.env.sys.config)
body = jp.take(body, body.idx[:-1]) # skip the floor body
self.env.mass = body.mass.reshape(-1, 1)
self.env.inertia = body.inertia
def __getattr__(self, name: str) -> Any:
if name in ["sys", "body", "mass", "inertia"]:
return getattr(self.env._environment, name)
else:
return getattr(self, name)
| 4,162 | 35.517544 | 91 | py |
null | CARL-main/carl/envs/brax/carl_ur5e.py | from typing import Any, Dict, List, Optional, Union
import copy
import json
import brax
import numpy as np
from brax.envs.ur5e import _SYSTEM_CONFIG, Ur5e
from brax.envs.wrappers import GymWrapper, VectorGymWrapper, VectorWrapper
from google.protobuf import json_format, text_format
from google.protobuf.json_format import MessageToDict
from numpyencoder import NumpyEncoder
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"joint_stiffness": 40000,
"gravity": -9.81,
"friction": 0.6,
"angular_damping": -0.05,
"actuator_strength": 100,
"joint_angular_damping": 50,
"target_radius": 0.02,
"target_distance": 0.5,
"torso_mass": 1.0,
}
CONTEXT_BOUNDS = {
"joint_stiffness": (1, np.inf, float),
"gravity": (-np.inf, -0.1, float),
"friction": (-np.inf, np.inf, float),
"angular_damping": (-np.inf, np.inf, float),
"actuator_strength": (1, np.inf, float),
"joint_angular_damping": (0, 360, float),
"target_radius": (0.01, np.inf, float),
"target_distance": (0.01, np.inf, float),
"torso_mass": (0, np.inf, float),
}
class CARLUr5e(CARLEnv):
def __init__(
self,
env: Ur5e = Ur5e(),
n_envs: int = 1,
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if n_envs == 1:
env = GymWrapper(env)
else:
env = VectorGymWrapper(VectorWrapper(env, n_envs))
self.base_config = MessageToDict(
text_format.Parse(_SYSTEM_CONFIG, brax.Config())
)
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
n_envs=n_envs,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: Ur5e
config = copy.deepcopy(self.base_config)
config["gravity"] = {"z": self.context["gravity"]}
config["friction"] = self.context["friction"]
config["angularDamping"] = self.context["angular_damping"]
for j in range(len(config["joints"])):
config["joints"][j]["angularDamping"] = self.context[
"joint_angular_damping"
]
config["joints"][j]["stiffness"] = self.context["joint_stiffness"]
for a in range(len(config["actuators"])):
config["actuators"][a]["strength"] = self.context["actuator_strength"]
config["bodies"][0]["mass"] = self.context["torso_mass"]
# This converts the dict to a JSON String, then parses it into an empty brax config
self.env.sys = brax.System(
json_format.Parse(json.dumps(config, cls=NumpyEncoder), brax.Config())
)
self.env.target_idx = self.env.sys.body.index["Target"]
self.env.torso_idx = self.env.sys.body.index["wrist_3_link"]
self.env.target_radius = self.context["target_radius"]
self.env.target_distance = self.context["target_distance"]
def __getattr__(self, name: str) -> Any:
if name in [
"sys",
"target_idx",
"torso_idx",
"target_radius",
"target_distance",
]:
return getattr(self.env._environment, name)
else:
return getattr(self, name)
| 4,690 | 35.648438 | 91 | py |
null | CARL-main/carl/envs/classic_control/__init__.py | # flake8: noqa: F401
# Contexts and bounds by name
from carl.envs.classic_control.carl_acrobot import (
CONTEXT_BOUNDS as CARLAcrobotEnv_bounds,
)
from carl.envs.classic_control.carl_acrobot import (
DEFAULT_CONTEXT as CARLAcrobotEnv_defaults,
)
from carl.envs.classic_control.carl_acrobot import CARLAcrobotEnv
from carl.envs.classic_control.carl_cartpole import (
CONTEXT_BOUNDS as CARLCartPoleEnv_bounds,
)
from carl.envs.classic_control.carl_cartpole import (
DEFAULT_CONTEXT as CARLCartPoleEnv_defaults,
)
from carl.envs.classic_control.carl_cartpole import CARLCartPoleEnv
from carl.envs.classic_control.carl_mountaincar import (
CONTEXT_BOUNDS as CARLMountainCarEnv_bounds,
)
from carl.envs.classic_control.carl_mountaincar import (
DEFAULT_CONTEXT as CARLMountainCarEnv_defaults,
)
from carl.envs.classic_control.carl_mountaincar import CARLMountainCarEnv
from carl.envs.classic_control.carl_mountaincarcontinuous import (
CONTEXT_BOUNDS as CARLMountainCarContinuousEnv_bounds,
)
from carl.envs.classic_control.carl_mountaincarcontinuous import (
DEFAULT_CONTEXT as CARLMountainCarContinuousEnv_defaults,
)
from carl.envs.classic_control.carl_mountaincarcontinuous import (
CARLMountainCarContinuousEnv,
)
from carl.envs.classic_control.carl_pendulum import (
CONTEXT_BOUNDS as CARLPendulumEnv_bounds,
)
from carl.envs.classic_control.carl_pendulum import (
DEFAULT_CONTEXT as CARLPendulumEnv_defaults,
)
from carl.envs.classic_control.carl_pendulum import CARLPendulumEnv
| 1,525 | 37.15 | 73 | py |
null | CARL-main/carl/envs/classic_control/carl_acrobot.py | from typing import Dict, List, Optional, Union
import numpy as np
from gym.envs.classic_control import AcrobotEnv
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"link_length_1": 1, # should be seen as 100% default and scaled
"link_length_2": 1, # should be seen as 100% default and scaled
"link_mass_1": 1, # should be seen as 100% default and scaled
"link_mass_2": 1, # should be seen as 100% default and scaled
"link_com_1": 0.5, # Percentage of the length of link one
"link_com_2": 0.5, # Percentage of the length of link one
"link_moi": 1, # should be seen as 100% default and scaled
"max_velocity_1": 4 * np.pi,
"max_velocity_2": 9 * np.pi,
"torque_noise_max": 0.0, # optional noise on torque, sampled uniformly from [-torque_noise_max, torque_noise_max]
"initial_angle_lower": -0.1, # lower bound of initial angle distribution (uniform)
"initial_angle_upper": 0.1, # upper bound of initial angle distribution (uniform)
"initial_velocity_lower": -0.1, # lower bound of initial velocity distribution (uniform)
"initial_velocity_upper": 0.1, # upper bound of initial velocity distribution (uniform)
}
CONTEXT_BOUNDS = {
"link_length_1": (
0.1,
10,
float,
), # Links can be shrunken and grown by a factor of 10
"link_length_2": (0.1, 10, float),
"link_mass_1": (
0.1,
10,
float,
), # Link mass can be shrunken and grown by a factor of 10
"link_mass_2": (0.1, 10, float),
"link_com_1": (0, 1, float), # Center of mass can move from one end to the other
"link_com_2": (0, 1, float),
"link_moi": (
0.1,
10,
float,
), # Moments on inertia can be shrunken and grown by a factor of 10
"max_velocity_1": (
0.4 * np.pi,
40 * np.pi,
float,
), # Velocity can vary by a factor of 10 in either direction
"max_velocity_2": (0.9 * np.pi, 90 * np.pi, float),
"torque_noise_max": (
-1.0,
1.0,
float,
), # torque is either {-1., 0., 1}. Applying noise of 1. would be quite extreme
"initial_angle_lower": (-np.inf, np.inf, float),
"initial_angle_upper": (-np.inf, np.inf, float),
"initial_velocity_lower": (-np.inf, np.inf, float),
"initial_velocity_upper": (-np.inf, np.inf, float),
}
class CustomAcrobotEnv(AcrobotEnv):
INITIAL_ANGLE_LOWER: float = -0.1
INITIAL_ANGLE_UPPER: float = 0.1
INITIAL_VELOCITY_LOWER: float = -0.1
INITIAL_VELOCITY_UPPER: float = 0.1
def reset(
self,
*,
seed: Optional[int] = None,
return_info: bool = False,
options: Optional[dict] = None,
) -> Union[np.ndarray, tuple[np.ndarray, dict]]:
super().reset(seed=seed)
low = (
self.INITIAL_ANGLE_LOWER,
self.INITIAL_ANGLE_LOWER,
self.INITIAL_VELOCITY_LOWER,
self.INITIAL_VELOCITY_LOWER,
)
high = (
self.INITIAL_ANGLE_UPPER,
self.INITIAL_ANGLE_UPPER,
self.INITIAL_VELOCITY_UPPER,
self.INITIAL_VELOCITY_UPPER,
)
self.state = self.np_random.uniform(low=low, high=high).astype(np.float32)
if not return_info:
return self._get_ob()
else:
return self._get_ob(), {}
class CARLAcrobotEnv(CARLEnv):
def __init__(
self,
env: CustomAcrobotEnv = CustomAcrobotEnv(),
contexts: Contexts = {},
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = 500, # from https://github.com/openai/gym/blob/master/gym/envs/__init__.py
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: CustomAcrobotEnv
self.env.LINK_LENGTH_1 = self.context["link_length_1"]
self.env.LINK_LENGTH_2 = self.context["link_length_2"]
self.env.LINK_MASS_1 = self.context["link_mass_1"]
self.env.LINK_MASS_2 = self.context["link_mass_2"]
self.env.LINK_COM_POS_1 = self.context["link_com_1"]
self.env.LINK_COM_POS_2 = self.context["link_com_2"]
self.env.LINK_MOI = self.context["link_moi"]
self.env.MAX_VEL_1 = self.context["max_velocity_1"]
self.env.MAX_VEL_2 = self.context["max_velocity_2"]
self.env.torque_noise_max = self.context["torque_noise_max"]
self.env.INITIAL_ANGLE_LOWER = self.context["initial_angle_lower"]
self.env.INITIAL_ANGLE_UPPER = self.context["initial_angle_upper"]
self.env.INITIAL_VELOCITY_LOWER = self.context["initial_velocity_lower"]
self.env.INITIAL_VELOCITY_UPPER = self.context["initial_velocity_upper"]
high = np.array(
[1.0, 1.0, 1.0, 1.0, self.env.MAX_VEL_1, self.env.MAX_VEL_2],
dtype=np.float32,
)
low = -high
self.build_observation_space(low, high, CONTEXT_BOUNDS)
| 6,517 | 38.743902 | 118 | py |
null | CARL-main/carl/envs/classic_control/carl_cartpole.py | from typing import Dict, List, Optional, Union
import numpy as np
from gym.envs.classic_control import CartPoleEnv
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"gravity": 9.8,
"masscart": 1.0, # Should be seen as 100% and scaled accordingly
"masspole": 0.1, # Should be seen as 100% and scaled accordingly
"pole_length": 0.5, # Should be seen as 100% and scaled accordingly
"force_magnifier": 10.0,
"update_interval": 0.02, # Seconds between updates
"initial_state_lower": -0.1, # lower bound of initial state distribution (uniform) (angles and angular velocities)
"initial_state_upper": 0.1, # upper bound of initial state distribution (uniform) (angles and angular velocities)
}
CONTEXT_BOUNDS = {
"gravity": (0.1, np.inf, float), # Positive gravity
"masscart": (0.1, 10, float), # Cart mass can be varied by a factor of 10
"masspole": (0.01, 1, float), # Pole mass can be varied by a factor of 10
"pole_length": (0.05, 5, float), # Pole length can be varied by a factor of 10
"force_magnifier": (1, 100, int), # Force magnifier can be varied by a factor of 10
"update_interval": (
0.002,
0.2,
float,
), # Update interval can be varied by a factor of 10
"initial_state_lower": (-np.inf, np.inf, float),
"initial_state_upper": (-np.inf, np.inf, float),
}
class CustomCartPoleEnv(CartPoleEnv):
def __init__(self) -> None:
super().__init__()
self.initial_state_lower = -0.05
self.initial_state_upper = 0.05
def reset(
self,
*,
seed: Optional[int] = None,
return_info: bool = False,
options: Optional[dict] = None,
) -> Union[np.ndarray, tuple[np.ndarray, dict]]:
super().reset(seed=seed)
self.state = self.np_random.uniform(
low=self.initial_state_lower, high=self.initial_state_upper, size=(4,)
)
self.steps_beyond_done = None
if not return_info:
return np.array(self.state, dtype=np.float32)
else:
return np.array(self.state, dtype=np.float32), {}
class CARLCartPoleEnv(CARLEnv):
def __init__(
self,
env: CustomCartPoleEnv = CustomCartPoleEnv(),
contexts: Contexts = {},
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = 500, # from https://github.com/openai/gym/blob/master/gym/envs/__init__.py
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: CustomCartPoleEnv
self.env.gravity = self.context["gravity"]
self.env.masscart = self.context["masscart"]
self.env.masspole = self.context["masspole"]
self.env.length = self.context["pole_length"]
self.env.force_mag = self.context["force_magnifier"]
self.env.tau = self.context["update_interval"]
self.env.initial_state_lower = self.context["initial_state_lower"]
self.env.initial_state_upper = self.context["initial_state_upper"]
high = np.array(
[
self.env.x_threshold * 2,
np.finfo(np.float32).max,
self.env.theta_threshold_radians * 2,
np.finfo(np.float32).max,
],
dtype=np.float32,
)
low = -high
self.build_observation_space(low, high, CONTEXT_BOUNDS)
| 4,993 | 38.634921 | 119 | py |
null | CARL-main/carl/envs/classic_control/carl_mountaincar.py | from typing import Dict, List, Optional, Tuple, Union
import gym.envs.classic_control as gccenvs
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"min_position": -1.2, # unit?
"max_position": 0.6, # unit?
"max_speed": 0.07, # unit?
"goal_position": 0.5, # unit?
"goal_velocity": 0, # unit?
"force": 0.001, # unit?
"gravity": 0.0025, # unit?
"min_position_start": -0.6,
"max_position_start": -0.4,
"min_velocity_start": 0.0,
"max_velocity_start": 0.0,
}
CONTEXT_BOUNDS = {
"min_position": (-np.inf, np.inf, float),
"max_position": (-np.inf, np.inf, float),
"max_speed": (0, np.inf, float),
"goal_position": (-np.inf, np.inf, float),
"goal_velocity": (-np.inf, np.inf, float),
"force": (-np.inf, np.inf, float),
"gravity": (0, np.inf, float),
"min_position_start": (-np.inf, np.inf, float),
"max_position_start": (-np.inf, np.inf, float),
"min_velocity_start": (-np.inf, np.inf, float),
"max_velocity_start": (-np.inf, np.inf, float),
}
class CustomMountainCarEnv(gccenvs.mountain_car.MountainCarEnv):
def __init__(self, goal_velocity: float = 0.0):
super(CustomMountainCarEnv, self).__init__(goal_velocity=goal_velocity)
self.min_position_start = -0.6
self.max_position_start = -0.4
self.min_velocity_start = 0.0
self.max_velocity_start = 0.0
self.state: np.ndarray # type: ignore [assignment]
def sample_initial_state(self) -> np.ndarray:
return np.array(
[
self.np_random.uniform(
low=self.min_position_start, high=self.max_position_start
),
self.np_random.uniform(
low=self.min_velocity_start, high=self.max_velocity_start
),
]
)
def reset(
self,
*,
seed: Optional[int] = None,
return_info: bool = False,
options: Optional[dict] = None,
) -> Union[np.ndarray, tuple[np.ndarray, dict]]:
super().reset(seed=seed)
self.state = self.sample_initial_state()
if not return_info:
return np.array(self.state, dtype=np.float32)
else:
return np.array(self.state, dtype=np.float32), {}
def step(self, action: int) -> Tuple[np.ndarray, float, bool, Dict]:
state, reward, done, info = super().step(action)
return (
state.squeeze(),
reward,
done,
info,
) # TODO something weird is happening such that the state gets shape (2,1) instead of (2,)
class CARLMountainCarEnv(CARLEnv):
def __init__(
self,
env: CustomMountainCarEnv = CustomMountainCarEnv(),
contexts: Contexts = {},
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = 200, # from https://github.com/openai/gym/blob/master/gym/envs/__init__.py
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
"""
Parameters
----------
env: gym.Env, optional
Defaults to classic control environment mountain car from gym (MountainCarEnv).
contexts: List[Dict], optional
Different contexts / different environment parameter settings.
instance_mode: str, optional
"""
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: CustomMountainCarEnv
self.env.min_position = self.context["min_position"]
self.env.max_position = self.context["max_position"]
self.env.max_speed = self.context["max_speed"]
self.env.goal_position = self.context["goal_position"]
self.env.goal_velocity = self.context["goal_velocity"]
self.env.min_position_start = self.context["min_position_start"]
self.env.max_position_start = self.context["max_position_start"]
self.env.min_velocity_start = self.context["min_velocity_start"]
self.env.max_velocity_start = self.context["max_velocity_start"]
self.env.force = self.context["force"]
self.env.gravity = self.context["gravity"]
self.low = np.array(
[self.env.min_position, -self.env.max_speed], dtype=np.float32
).squeeze()
self.high = np.array(
[self.env.max_position, self.env.max_speed], dtype=np.float32
).squeeze()
self.build_observation_space(self.low, self.high, CONTEXT_BOUNDS)
| 6,035 | 36.962264 | 109 | py |
null | CARL-main/carl/envs/classic_control/carl_mountaincarcontinuous.py | from typing import Dict, List, Optional, Union
import gym.envs.classic_control as gccenvs
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"min_position": -1.2,
"max_position": 0.6,
"max_speed": 0.07,
"goal_position": 0.45,
"goal_velocity": 0.0,
"power": 0.0015,
# "gravity": 0.0025, # currently hardcoded in step
"min_position_start": -0.6,
"max_position_start": -0.4,
"min_velocity_start": 0.0,
"max_velocity_start": 0.0,
}
CONTEXT_BOUNDS = {
"min_position": (-np.inf, np.inf, float),
"max_position": (-np.inf, np.inf, float),
"max_speed": (0, np.inf, float),
"goal_position": (-np.inf, np.inf, float),
"goal_velocity": (-np.inf, np.inf, float),
"power": (-np.inf, np.inf, float),
# "force": (-np.inf, np.inf),
# "gravity": (0, np.inf),
"min_position_start": (-np.inf, np.inf, float), # TODO need to check these
"max_position_start": (-np.inf, np.inf, float),
"min_velocity_start": (-np.inf, np.inf, float),
"max_velocity_start": (-np.inf, np.inf, float),
}
class CustomMountainCarContinuousEnv(
gccenvs.continuous_mountain_car.Continuous_MountainCarEnv
):
def __init__(self, goal_velocity: float = 0.0):
super(CustomMountainCarContinuousEnv, self).__init__(
goal_velocity=goal_velocity
)
self.min_position_start = -0.6
self.max_position_start = -0.4
self.min_velocity_start = 0.0
self.max_velocity_start = 0.0
def reset_state(self) -> np.ndarray:
return np.array(
[
self.np_random.uniform(
low=self.min_position_start, high=self.max_position_start
), # sample start position
self.np_random.uniform(
low=self.min_velocity_start, high=self.max_velocity_start
), # sample start velocity
]
)
class CARLMountainCarContinuousEnv(CARLEnv):
def __init__(
self,
env: CustomMountainCarContinuousEnv = CustomMountainCarContinuousEnv(),
contexts: Contexts = {},
hide_context: bool = True,
add_gaussian_noise_to_context: bool = True,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = 999, # from https://github.com/openai/gym/blob/master/gym/envs/__init__.py
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
"""
Parameters
----------
env: gym.Env, optional
Defaults to classic control environment mountain car from gym (MountainCarEnv).
contexts: List[Dict], optional
Different contexts / different environment parameter settings.
instance_mode: str, optional
"""
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: CustomMountainCarContinuousEnv
self.env.min_position = self.context["min_position"]
self.env.max_position = self.context["max_position"]
self.env.max_speed = self.context["max_speed"]
self.env.goal_position = self.context["goal_position"]
self.env.goal_velocity = self.context["goal_velocity"]
self.env.min_position_start = self.context["min_position_start"]
self.env.max_position_start = self.context["max_position_start"]
self.env.min_velocity_start = self.context["min_velocity_start"]
self.env.max_velocity_start = self.context["max_velocity_start"]
self.env.power = self.context["power"]
# self.env.force = self.context["force"]
# self.env.gravity = self.context["gravity"]
self.low = np.array(
[self.env.min_position, -self.env.max_speed], dtype=np.float32
).squeeze()
self.high = np.array(
[self.env.max_position, self.env.max_speed], dtype=np.float32
).squeeze()
self.build_observation_space(self.low, self.high, CONTEXT_BOUNDS)
| 5,417 | 37.7 | 109 | py |
null | CARL-main/carl/envs/classic_control/carl_pendulum.py | from typing import Dict, List, Optional, Union
import gym.envs.classic_control as gccenvs
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"max_speed": 8.0,
"dt": 0.05,
"g": 10.0,
"m": 1.0,
"l": 1.0,
"initial_angle_max": np.pi, # Upper bound for uniform distribution to sample from
"initial_velocity_max": 1, # Upper bound for uniform distribution to sample from
# The lower bound will be the negative value.
}
CONTEXT_BOUNDS = {
"max_speed": (-np.inf, np.inf, float),
"dt": (0, np.inf, float),
"g": (0, np.inf, float),
"m": (1e-6, np.inf, float),
"l": (1e-6, np.inf, float),
"initial_angle_max": (0, np.inf, float),
"initial_velocity_max": (0, np.inf, float),
}
class CustomPendulum(gccenvs.pendulum.PendulumEnv):
def __init__(self, g: float = 10.0):
super(CustomPendulum, self).__init__(g=g)
self.initial_angle_max = DEFAULT_CONTEXT["initial_angle_max"]
self.initial_velocity_max = DEFAULT_CONTEXT["initial_velocity_max"]
def reset(
self,
*,
seed: Optional[int] = None,
return_info: bool = False,
options: Optional[dict] = None,
) -> Union[np.ndarray, tuple[np.ndarray, dict]]:
super().reset(seed=seed)
high = np.array([self.initial_angle_max, self.initial_velocity_max])
self.state = self.np_random.uniform(low=-high, high=high)
self.last_u = None
if not return_info:
return self._get_obs()
else:
return self._get_obs(), {}
class CARLPendulumEnv(CARLEnv):
def __init__(
self,
env: CustomPendulum = CustomPendulum(),
contexts: Contexts = {},
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = 200, # from https://github.com/openai/gym/blob/master/gym/envs/__init__.py
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
"""
Max torque is not a context feature because it changes the action space.
Parameters
----------
env
contexts
instance_mode
hide_context
add_gaussian_noise_to_context
gaussian_noise_std_percentage
"""
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(
DEFAULT_CONTEXT.keys()
) # allow to augment all values
def _update_context(self) -> None:
self.env: CustomPendulum
self.env.max_speed = self.context["max_speed"]
self.env.dt = self.context["dt"]
self.env.l = self.context["l"] # noqa: E741 ambiguous variable name
self.env.m = self.context["m"]
self.env.g = self.context["g"]
self.env.initial_angle_max = self.context["initial_angle_max"]
self.env.initial_velocity_max = self.context["initial_velocity_max"]
high = np.array([1.0, 1.0, self.max_speed], dtype=np.float32)
self.build_observation_space(-high, high, CONTEXT_BOUNDS)
| 4,415 | 35.196721 | 109 | py |
null | CARL-main/carl/envs/dmc/__init__.py | # flake8: noqa: F401
# Contexts and bounds by name
from carl.envs.dmc.carl_dm_finger import CONTEXT_BOUNDS as CARLDmcFingerEnv_bounds
from carl.envs.dmc.carl_dm_finger import CONTEXT_MASK as CARLDmcFingerEnv_mask
from carl.envs.dmc.carl_dm_finger import DEFAULT_CONTEXT as CARLDmcFingerEnv_defaults
from carl.envs.dmc.carl_dm_finger import CARLDmcFingerEnv
from carl.envs.dmc.carl_dm_fish import CONTEXT_BOUNDS as CARLDmcFishEnv_bounds
from carl.envs.dmc.carl_dm_fish import CONTEXT_MASK as CARLDmcFishEnv_mask
from carl.envs.dmc.carl_dm_fish import DEFAULT_CONTEXT as CARLDmcFishEnv_defaults
from carl.envs.dmc.carl_dm_fish import CARLDmcFishEnv
from carl.envs.dmc.carl_dm_quadruped import CONTEXT_BOUNDS as CARLDmcQuadrupedEnv_bounds
from carl.envs.dmc.carl_dm_quadruped import CONTEXT_MASK as CARLDmcQuadrupedEnv_mask
from carl.envs.dmc.carl_dm_quadruped import (
DEFAULT_CONTEXT as CARLDmcQuadrupedEnv_defaults,
)
from carl.envs.dmc.carl_dm_quadruped import CARLDmcQuadrupedEnv
from carl.envs.dmc.carl_dm_walker import CONTEXT_MASK as CARLDmcWalkerEnv_mask
from carl.envs.dmc.carl_dm_walker import DEFAULT_CONTEXT as CARLDmcWalkerEnv_defaults
from carl.envs.dmc.carl_dm_walker import CARLDmcWalkerEnv
| 1,209 | 59.5 | 88 | py |
null | CARL-main/carl/envs/dmc/carl_dm_finger.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.fish import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"gravity": -9.81, # Gravity is disabled via flag
"friction_tangential": 1, # Scaling factor for tangential friction of all geoms (objects)
"friction_torsional": 1, # Scaling factor for torsional friction of all geoms (objects)
"friction_rolling": 1, # Scaling factor for rolling friction of all geoms (objects)
"timestep": 0.004, # Seconds between updates
"joint_damping": 1.0, # Scaling factor for all joints
"joint_stiffness": 0.0,
"actuator_strength": 1, # Scaling factor for all actuators in the model
"density": 5000.0,
"viscosity": 0.0,
"geom_density": 1.0, # No effect, because no gravity
"wind_x": 0.0,
"wind_y": 0.0,
"wind_z": 0.0,
"limb_length_0": 0.17,
"limb_length_1": 0.16,
"spinner_radius": 0.04,
"spinner_length": 0.18,
}
CONTEXT_BOUNDS = {
"gravity": (-np.inf, -0.1, float),
"friction_tangential": (0, np.inf, float),
"friction_torsional": (0, np.inf, float),
"friction_rolling": (0, np.inf, float),
"timestep": (
0.001,
0.1,
float,
),
"joint_damping": (0, np.inf, float),
"joint_stiffness": (0, np.inf, float),
"actuator_strength": (0, np.inf, float),
"density": (0, np.inf, float),
"viscosity": (0, np.inf, float),
"geom_density": (0, np.inf, float),
"wind_x": (-np.inf, np.inf, float),
"wind_y": (-np.inf, np.inf, float),
"wind_z": (-np.inf, np.inf, float),
"limb_length_0": (0.01, 0.2, float),
"limb_length_1": (0.01, 0.2, float),
"spinner_radius": (0.01, 0.05, float),
"spinner_length": (0.01, 0.4, float),
}
CONTEXT_MASK = [
"gravity",
"geom_density",
"wind_x",
"wind_y",
"wind_z",
]
class CARLDmcFingerEnv(CARLDmcEnv):
def __init__(
self,
domain: str = "finger",
task: str = "spin_context",
contexts: Contexts = {},
context_mask: Optional[List[str]] = [],
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = STEP_LIMIT,
state_context_features: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
super().__init__(
domain=domain,
task=task,
contexts=contexts,
context_mask=context_mask,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
)
| 3,654 | 34.144231 | 94 | py |
null | CARL-main/carl/envs/dmc/carl_dm_fish.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.fish import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"gravity": -9.81, # Gravity is disabled via flag
"friction_tangential": 1, # Scaling factor for tangential friction of all geoms (objects)
"friction_torsional": 1, # Scaling factor for torsional friction of all geoms (objects)
"friction_rolling": 1, # Scaling factor for rolling friction of all geoms (objects)
"timestep": 0.004, # Seconds between updates
"joint_damping": 1.0, # Scaling factor for all joints
"joint_stiffness": 0.0,
"actuator_strength": 1, # Scaling factor for all actuators in the model
"density": 5000.0,
"viscosity": 0.0,
"geom_density": 1.0, # No effect, because no gravity
"wind_x": 0.0,
"wind_y": 0.0,
"wind_z": 0.0,
}
CONTEXT_BOUNDS = {
"gravity": (-np.inf, -0.1, float),
"friction_tangential": (0, np.inf, float),
"friction_torsional": (0, np.inf, float),
"friction_rolling": (0, np.inf, float),
"timestep": (
0.001,
0.1,
float,
),
"joint_damping": (0, np.inf, float),
"joint_stiffness": (0, np.inf, float),
"actuator_strength": (0, np.inf, float),
"density": (0, np.inf, float),
"viscosity": (0, np.inf, float),
"geom_density": (0, np.inf, float),
"wind_x": (-np.inf, np.inf, float),
"wind_y": (-np.inf, np.inf, float),
"wind_z": (-np.inf, np.inf, float),
}
CONTEXT_MASK = [
"gravity",
"geom_density",
"wind_x",
"wind_y",
"wind_z",
]
class CARLDmcFishEnv(CARLDmcEnv):
def __init__(
self,
domain: str = "fish",
task: str = "swim_context",
contexts: Contexts = {},
context_mask: Optional[List[str]] = [],
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = STEP_LIMIT,
state_context_features: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
super().__init__(
domain=domain,
task=task,
contexts=contexts,
context_mask=context_mask,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
)
| 3,373 | 34.145833 | 94 | py |
null | CARL-main/carl/envs/dmc/carl_dm_quadruped.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.quadruped import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"gravity": -9.81,
"friction_tangential": 1.0, # Scaling factor for tangential friction of all geoms (objects)
"friction_torsional": 1.0, # Scaling factor for torsional friction of all geoms (objects)
"friction_rolling": 1.0, # Scaling factor for rolling friction of all geoms (objects)
"timestep": 0.005, # Seconds between updates
"joint_damping": 1.0, # Scaling factor for all joints
"joint_stiffness": 0.0,
"actuator_strength": 1, # Scaling factor for all actuators in the model
"density": 0.0,
"viscosity": 0.0,
"geom_density": 1.0, # Scaling factor for all geom (objects) densities
"wind_x": 0.0,
"wind_y": 0.0,
"wind_z": 0.0,
}
CONTEXT_BOUNDS = {
"gravity": (-np.inf, -0.1, float),
"friction_tangential": (0, np.inf, float),
"friction_torsional": (0, np.inf, float),
"friction_rolling": (0, np.inf, float),
"timestep": (
0.001,
0.1,
float,
),
"joint_damping": (0, np.inf, float),
"joint_stiffness": (0, np.inf, float),
"actuator_strength": (0, np.inf, float),
"density": (0, np.inf, float),
"viscosity": (0, np.inf, float),
"geom_density": (0, np.inf, float),
"wind_x": (-np.inf, np.inf, float),
"wind_y": (-np.inf, np.inf, float),
"wind_z": (-np.inf, np.inf, float),
}
CONTEXT_MASK = [
"wind_x",
"wind_y",
"wind_z",
]
class CARLDmcQuadrupedEnv(CARLDmcEnv):
def __init__(
self,
domain: str = "quadruped",
task: str = "walk_context",
contexts: Contexts = {},
context_mask: Optional[List[str]] = [],
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = STEP_LIMIT,
state_context_features: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
super().__init__(
domain=domain,
task=task,
contexts=contexts,
context_mask=context_mask,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
)
| 3,342 | 34.56383 | 96 | py |
null | CARL-main/carl/envs/dmc/carl_dm_walker.py | from typing import Dict, List, Optional, Union
import numpy as np
from carl.context.selection import AbstractSelector
from carl.envs.dmc.carl_dmcontrol import CARLDmcEnv
from carl.envs.dmc.dmc_tasks.walker import STEP_LIMIT # type: ignore
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
DEFAULT_CONTEXT = {
"gravity": -9.81,
"friction_tangential": 1.0, # Scaling factor for tangential friction of all geoms (objects)
"friction_torsional": 1.0, # Scaling factor for torsional friction of all geoms (objects)
"friction_rolling": 1.0, # Scaling factor for rolling friction of all geoms (objects)
"timestep": 0.0025, # Seconds between updates
"joint_damping": 1.0, # Scaling factor for all joints
"joint_stiffness": 0.0,
"actuator_strength": 1.0, # Scaling factor for all actuators in the model
"density": 0.0,
"viscosity": 0.0,
"geom_density": 1.0, # Scaling factor for all geom (objects) densities
"wind_x": 0.0,
"wind_y": 0.0,
"wind_z": 0.0,
}
CONTEXT_BOUNDS = {
"gravity": (-np.inf, -0.1, float),
"friction_tangential": (0, np.inf, float),
"friction_torsional": (0, np.inf, float),
"friction_rolling": (0, np.inf, float),
"timestep": (
0.001,
0.1,
float,
),
"joint_damping": (0, np.inf, float),
"joint_stiffness": (0, np.inf, float),
"actuator_strength": (0, np.inf, float),
"density": (0, np.inf, float),
"viscosity": (0, np.inf, float),
"geom_density": (0, np.inf, float),
"wind_x": (-np.inf, np.inf, float),
"wind_y": (-np.inf, np.inf, float),
"wind_z": (-np.inf, np.inf, float),
}
CONTEXT_MASK = [
"wind_x",
"wind_y",
"wind_z",
]
class CARLDmcWalkerEnv(CARLDmcEnv):
def __init__(
self,
domain: str = "walker",
task: str = "walk_context",
contexts: Contexts = {},
context_mask: Optional[List[str]] = [],
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = STEP_LIMIT,
state_context_features: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
super().__init__(
domain=domain,
task=task,
contexts=contexts,
context_mask=context_mask,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
)
| 3,336 | 34.5 | 96 | py |
null | CARL-main/carl/envs/dmc/carl_dmcontrol.py | from typing import Dict, List, Optional, Union
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.envs.dmc.loader import load_dmc_env
from carl.envs.dmc.wrappers import MujocoToGymWrapper
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
class CARLDmcEnv(CARLEnv):
"""
General class for the dm-control environments.
Meta-class to change the context for the environments.
Parameters
----------
domain : str
Dm-control domain that should be loaded.
task : str
Task within the specified domain.
For descriptions of the other parameters see the parent class CARLEnv.
Raises
------
NotImplementedError
Dict observation spaces are not implemented for dm-control yet.
"""
def __init__(
self,
domain: str,
task: str,
contexts: Contexts,
context_mask: Optional[List[str]],
hide_context: bool,
add_gaussian_noise_to_context: bool,
gaussian_noise_std_percentage: float,
logger: Optional[TrialLogger],
scale_context_features: str,
default_context: Optional[Context],
max_episode_length: int,
state_context_features: Optional[List[str]],
dict_observation_space: bool,
context_selector: Optional[Union[AbstractSelector, type[AbstractSelector]]],
context_selector_kwargs: Optional[Dict],
):
# TODO can we have more than 1 env?
if not contexts:
contexts = {0: default_context} # type: ignore
self.domain = domain
self.task = task
env = load_dmc_env(
domain_name=self.domain,
task_name=self.task,
context={},
context_mask=[],
environment_kwargs={"flat_observation": True},
)
env = MujocoToGymWrapper(env)
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
# TODO check gaussian noise on context features
self.whitelist_gaussian_noise = list(
default_context.keys() # type: ignore
) # allow to augment all values
def _update_context(self) -> None:
env = load_dmc_env(
domain_name=self.domain,
task_name=self.task,
context=self.context,
context_mask=self.context_mask,
environment_kwargs={"flat_observation": True},
)
self.env = MujocoToGymWrapper(env)
| 3,171 | 32.744681 | 84 | py |
null | CARL-main/carl/envs/dmc/loader.py | from typing import Any, Dict, List, Optional
import inspect
import dm_env # type: ignore
from dm_control import suite # type: ignore
from carl.envs.dmc.dmc_tasks import ( # type: ignore [import] # noqa: F401
finger,
fish,
quadruped,
walker,
)
from carl.utils.types import Context
_DOMAINS = {
name: module
for name, module in locals().items()
if inspect.ismodule(module) and hasattr(module, "SUITE")
}
def load_dmc_env(
domain_name: str,
task_name: str,
context: Context = {},
context_mask: Optional[List[str]] = [],
task_kwargs: Optional[Any] = None,
environment_kwargs: Dict[str, bool] = None,
visualize_reward: bool = False,
) -> dm_env:
if domain_name in _DOMAINS:
domain = _DOMAINS[domain_name]
elif domain_name in suite._DOMAINS:
domain = suite._DOMAINS[domain_name]
else:
raise ValueError("Domain {!r} does not exist.".format(domain_name))
if task_name in domain.SUITE:
task_kwargs = task_kwargs or {}
if environment_kwargs is not None:
task_kwargs = dict(task_kwargs, environment_kwargs=environment_kwargs)
env = domain.SUITE[task_name](
context=context, context_mask=context_mask, **task_kwargs
)
env.task.visualize_reward = visualize_reward
return env
elif (domain_name, task_name) in suite.ALL_TASKS:
return suite.load(
domain_name=domain_name,
task_name=task_name,
task_kwargs=task_kwargs,
environment_kwargs=environment_kwargs,
visualize_reward=visualize_reward,
)
else:
raise ValueError(
"Task {!r} does not exist in domain {!r}.".format(task_name, domain_name)
)
| 1,770 | 28.032787 | 85 | py |
null | CARL-main/carl/envs/dmc/wrappers.py | from typing import Any, Optional, Tuple, TypeVar, Union
import dm_env # type: ignore
import gym
import numpy as np
from dm_env import StepType
from gym import spaces
ObsType = TypeVar("ObsType")
ActType = TypeVar("ActType")
def get_shape(shape: tuple) -> tuple:
"""
Get shape of array or scalar.
If scalar (shape = ()), return (1,).
Parameters
----------
shape: tuple
Shape of array, can be empty tuple
Returns
-------
Shape: Same as before if not empty, else (1,)
"""
return shape if shape else (1,)
class MujocoToGymWrapper(gym.Env):
def __init__(self, env: dm_env) -> None:
# TODO set seeds
self.env = env
action_spec = self.env.action_spec()
self.action_space = spaces.Box(
action_spec.minimum, action_spec.maximum, dtype=action_spec.dtype
)
obs_spec = self.env.observation_spec()
# obs_spaces = {
# k: spaces.Box(low=-np.inf, high=np.inf, shape=v.shape, dtype=v.dtype)
# for k, v in obs_spec.items()
# }
# self.observation_space = spaces.Dict(spaces=obs_spaces)
# TODO add support for Dict Spaces in CARLEnv (later)
shapes = [int(np.sum([get_shape(v.shape) for v in obs_spec.values()]))]
lows = np.array([-np.inf] * shapes[0])
highs = np.array([np.inf] * shapes[0])
dtype = np.unique([[v.dtype for v in obs_spec.values()]])[0]
self.observation_space = spaces.Box(
low=lows, high=highs, shape=shapes, dtype=dtype
)
def step(self, action: ActType) -> Tuple[ObsType, float, bool, dict]:
"""Run one timestep of the environment's dynamics. When end of
episode is reached, you are responsible for calling `reset()`
to reset this environment's state.
Accepts an action and returns a tuple (observation, reward, done, info).
Args:
action (object): an action provided by the agent
Returns:
observation (object): agent's observation of the current environment
reward (float) : amount of reward returned after previous action
done (bool): whether the episode has ended, in which case further step() calls will return undefined results
info (dict): contains auxiliary diagnostic information
(helpful for debugging, logging, and sometimes learning)
"""
timestep = self.env.step(action=action)
step_type: StepType = timestep.step_type
reward = timestep.reward
discount = timestep.discount
observation = timestep.observation["observations"]
info = {"step_type": step_type, "discount": discount}
done = step_type == StepType.LAST
return observation, reward, done, info
def reset(
self,
*,
seed: Optional[int] = None,
return_info: bool = False,
options: Optional[dict] = None,
) -> Union[ObsType, tuple[ObsType, dict]]:
super(MujocoToGymWrapper, self).reset(
seed=seed, return_info=return_info, options=options
)
timestep = self.env.reset()
if isinstance(self.observation_space, spaces.Box):
observation = timestep.observation["observations"]
else:
raise NotImplementedError
return observation
def render(
self, mode: str = "human", camera_id: int = 0, **kwargs: Any
) -> np.ndarray:
"""Renders the environment.
The set of supported modes varies per environment. (And some
third-party environments may not support rendering at all.)
By convention, if mode is:
- human: render to the current display or terminal and
return nothing. Usually for human consumption.
- rgb_array: Return an numpy.ndarray with shape (x, y, 3),
representing RGB values for an x-by-y pixel image, suitable
for turning into a video.
- ansi: Return a string (str) or StringIO.StringIO containing a
terminal-style text representation. The text can include newlines
and ANSI escape sequences (e.g. for colors).
Note:
Make sure that your class's metadata 'render_modes' key includes
the list of supported modes. It's recommended to call super()
in implementations to use the functionality of this method.
Args:
mode (str): the mode to render with
camera_id
kwargs: Keyword arguments for dm_control.mujoco.engine.Physics.render
Example:
class MyEnv(Env):
metadata = {'render_modes': ['human', 'rgb_array']}
def render(self, mode='human'):
if mode == 'rgb_array':
return np.array(...) # return RGB frame suitable for video
elif mode == 'human':
... # pop up a window and render
else:
super(MyEnv, self).render(mode=mode) # just raise an exception
"""
# TODO render mujoco human version
if mode == "human":
raise NotImplementedError
elif mode == "rgb_array":
return self.env.physics.render(camera_id=camera_id, **kwargs)
else:
raise NotImplementedError
| 5,348 | 35.141892 | 120 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/finger.py | # flake8: noqa: E501
# Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Finger Domain."""
from __future__ import annotations
from typing import Any
from multiprocessing.sharedctypes import Value
import numpy as np
from dm_control.rl import control # type: ignore
from dm_control.suite.finger import ( # type: ignore
_CONTROL_TIMESTEP,
_DEFAULT_TIME_LIMIT,
_EASY_TARGET_SIZE,
_HARD_TARGET_SIZE,
SUITE,
Physics,
Spin,
Turn,
get_model_and_assets,
)
from carl.envs.dmc.dmc_tasks.utils import adapt_context # type: ignore
from carl.utils.types import Context
def check_constraints(
spinner_length: float,
limb_length_0: float,
limb_length_1: float,
x_spinner: float = 0.2,
x_finger: float = -0.2,
) -> None:
spinner_half_length = spinner_length / 2
# Check if spinner collides with finger hinge
distance_spinner_to_fingerhinge = (x_spinner - x_finger) - spinner_half_length
if distance_spinner_to_fingerhinge < 0:
raise ValueError(
f"Distance finger to spinner ({distance_spinner_to_fingerhinge}) not big enough, "
f"spinner can't spin. Decrease spinner_length ({spinner_length})."
)
# Check if finger can reach spinner (distance should be negative)
distance_fingertip_to_spinner = (x_spinner - spinner_half_length) - (
x_finger + limb_length_0 + limb_length_1
)
if distance_fingertip_to_spinner > 0:
raise ValueError(
f"Finger cannot reach spinner ({distance_fingertip_to_spinner}). Increase either "
f"limb_length_0, limb_length_1 or spinner_length."
)
def get_finger_xml_string(
limb_length_0: float = 0.17,
limb_length_1: float = 0.16,
spinner_radius: float = 0.04,
spinner_length: float = 0.18,
**kwargs: Any,
) -> bytes:
# Finger position
x_finger = -0.2
y_finger = 0.4
# Spinner position
x_spinner = 0.2
y_spinner = 0.4
# Target position
y_target = 0.4
# Spinner geometry
spinner_half_length = spinner_length / 2
spinner_tip_radius = 0.02
distance_spinner_tip_to_captop = 0.06
y_spinner_tip = (
spinner_half_length + distance_spinner_tip_to_captop - spinner_tip_radius
) # originally 0.13
check_constraints(
limb_length_0=limb_length_0,
limb_length_1=limb_length_1,
x_spinner=x_spinner,
x_finger=x_finger,
spinner_length=spinner_length,
)
proximal_to = -limb_length_0
xml_string = f"""
<mujoco model="finger">
<include file="./common/visual.xml"/>
<include file="./common/skybox.xml"/>
<include file="./common/materials.xml"/>
<option timestep="0.01" cone="elliptic" iterations="200">
<flag gravity="disable"/>
</option>
<default>
<geom solimp="0 0.9 0.01" solref=".02 1"/>
<joint type="hinge" axis="0 -1 0"/>
<motor ctrllimited="true" ctrlrange="-1 1"/>
<default class="finger">
<joint damping="2.5" limited="true"/>
<site type="ellipsoid" size=".025 .03 .025" material="site" group="3"/>
</default>
</default>
<worldbody>
<light name="light" directional="true" diffuse=".6 .6 .6" pos="0 0 2" specular=".3 .3 .3"/>
<geom name="ground" type="plane" pos="0 0 0" size=".6 .2 10" material="grid"/>
<camera name="cam0" pos="0 -1 .8" xyaxes="1 0 0 0 1 2"/>
<camera name="cam1" pos="0 -1 .4" xyaxes="1 0 0 0 0 1" />
<body name="proximal" pos="{x_finger} 0 {y_finger}" childclass="finger">
<geom name="proximal_decoration" type="cylinder" fromto="0 -.033 0 0 .033 0" size=".034" material="decoration"/>
<joint name="proximal" range="-110 110" ref="-90"/>
<geom name="proximal" type="capsule" material="self" size=".03" fromto="0 0 0 0 0 {proximal_to}"/>
<body name="distal" pos="0 0 {proximal_to - 0.01}" childclass="finger">
<joint name="distal" range="-110 110"/>
<geom name="distal" type="capsule" size=".028" material="self" fromto="0 0 0 0 0 {-limb_length_1}" contype="0" conaffinity="0"/>
<geom name="fingertip" type="capsule" size=".03" material="effector" fromto="0 0 {-limb_length_1 - 0.03} 0 0 {-limb_length_1 - 0.001}"/>
<site name="touchtop" pos=".01 0 -.17"/>
<site name="touchbottom" pos="-.01 0 -.17"/>
</body>
</body>
<body name="spinner" pos="{x_spinner} 0 {y_spinner}">
<joint name="hinge" frictionloss=".1" damping=".5"/>
<geom name="cap1" type="capsule" size="{spinner_radius}" fromto="{spinner_radius/2} 0 {-spinner_half_length} {spinner_radius} 0 {spinner_half_length}" material="self"/>
<geom name="cap2" type="capsule" size="{spinner_radius}" fromto="{-spinner_radius/2} 0 {-spinner_half_length} 0 0 {spinner_half_length}" material="self"/>
<site name="tip" type="sphere" size="{spinner_tip_radius}" pos="0 0 {y_spinner_tip}" material="target"/>
<geom name="spinner_decoration" type="cylinder" fromto="0 -.045 0 0 .045 0" size="{spinner_radius/2}" material="decoration"/>
</body>
<site name="target" type="sphere" size=".03" pos="0 0 {y_target}" material="target"/>
</worldbody>
<actuator>
<motor name="proximal" joint="proximal" gear="30"/>
<motor name="distal" joint="distal" gear="15"/>
</actuator>
<!-- All finger observations are functions of sensors. This is useful for finite-differencing. -->
<sensor>
<jointpos name="proximal" joint="proximal"/>
<jointpos name="distal" joint="distal"/>
<jointvel name="proximal_velocity" joint="proximal"/>
<jointvel name="distal_velocity" joint="distal"/>
<jointvel name="hinge_velocity" joint="hinge"/>
<framepos name="tip" objtype="site" objname="tip"/>
<framepos name="target" objtype="site" objname="target"/>
<framepos name="spinner" objtype="xbody" objname="spinner"/>
<touch name="touchtop" site="touchtop"/>
<touch name="touchbottom" site="touchbottom"/>
<framepos name="touchtop_pos" objtype="site" objname="touchtop"/>
<framepos name="touchbottom_pos" objtype="site" objname="touchbottom"/>
</sensor>
</mujoco>
"""
xml_string_bytes = xml_string.encode()
return xml_string_bytes
@SUITE.add("benchmarking") # type: ignore[misc]
def spin_context(
context: Context = {},
context_mask: list = [],
time_limit: float = _DEFAULT_TIME_LIMIT,
random: np.random.RandomState | int | None = None,
environment_kwargs: dict | None = None,
) -> control.Environment:
"""Returns the Spin task."""
xml_string, assets = get_model_and_assets()
xml_string = get_finger_xml_string(**context)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = Spin(random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add("benchmarking") # type: ignore[misc]
def turn_easy_context(
context: Context = {},
context_mask: list = [],
time_limit: float = _DEFAULT_TIME_LIMIT,
random: np.random.RandomState | int | None = None,
environment_kwargs: dict | None = None,
) -> control.Environment:
"""Returns the easy Turn task."""
xml_string, assets = get_model_and_assets()
xml_string = get_finger_xml_string(**context)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = Turn(target_radius=_EASY_TARGET_SIZE, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add("benchmarking") # type: ignore[misc]
def turn_hard_context(
context: Context = {},
context_mask: list = [],
time_limit: float = _DEFAULT_TIME_LIMIT,
random: np.random.RandomState | int | None = None,
environment_kwargs: dict | None = None,
) -> control.Environment:
"""Returns the hard Turn task."""
xml_string, assets = get_model_and_assets()
xml_string = get_finger_xml_string(**context)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = Turn(target_radius=_HARD_TARGET_SIZE, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
| 9,772 | 36.588462 | 178 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/fish.py | # Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Fish Domain."""
from typing import Dict, List, Optional, Tuple, Union
import collections
import dm_env # type: ignore
import numpy as np
from dm_control import mujoco # type: ignore
from dm_control.rl import control # type: ignore
from dm_control.suite import base, common # type: ignore
from dm_control.utils import containers, rewards # type: ignore
from carl.envs.dmc.dmc_tasks.utils import adapt_context # type: ignore
from carl.utils.types import Context
_DEFAULT_TIME_LIMIT = 40
_CONTROL_TIMESTEP = 0.04
STEP_LIMIT = 1000
_JOINTS = [
"tail1",
"tail_twist",
"tail2",
"finright_roll",
"finright_pitch",
"finleft_roll",
"finleft_pitch",
]
SUITE = containers.TaggedTasks()
def get_model_and_assets() -> Tuple[bytes, Dict]:
"""Returns a tuple containing the model XML string and a dict of assets."""
return common.read_model("fish.xml"), common.ASSETS
@SUITE.add("benchmarking") # type: ignore
def upright_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Fish Upright task."""
xml_string, assets = get_model_and_assets()
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = Upright(random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
control_timestep=_CONTROL_TIMESTEP,
time_limit=time_limit,
**environment_kwargs,
)
@SUITE.add("benchmarking") # type: ignore
def swim_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Fish Swim task."""
xml_string, assets = get_model_and_assets()
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = Swim(random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
control_timestep=_CONTROL_TIMESTEP,
time_limit=time_limit,
**environment_kwargs,
)
class Physics(mujoco.Physics):
"""Physics simulation with additional features for the Fish domain."""
def upright(self) -> np.float64:
"""Returns projection from z-axes of torso to the z-axes of worldbody."""
return self.named.data.xmat["torso", "zz"]
def torso_velocity(self) -> np.ndarray:
"""Returns velocities and angular velocities of the torso."""
return self.data.sensordata
def joint_velocities(self) -> np.ndarray:
"""Returns the joint velocities."""
return self.named.data.qvel[_JOINTS]
def joint_angles(self) -> np.ndarray:
"""Returns the joint positions."""
return self.named.data.qpos[_JOINTS]
def mouth_to_target(self) -> np.ndarray:
"""Returns a vector, from mouth to target in local coordinate of mouth."""
data = self.named.data
mouth_to_target_global = data.geom_xpos["target"] - data.geom_xpos["mouth"]
return mouth_to_target_global.dot(data.geom_xmat["mouth"].reshape(3, 3))
class Upright(base.Task):
"""A Fish `Task` for getting the torso upright with smooth reward."""
def __init__(self, random: Union[np.random.RandomState, int, None] = None) -> None:
"""Initializes an instance of `Upright`.
Args:
random: Either an existing `numpy.random.RandomState` instance, an
integer seed for creating a new `RandomState`, or None to select a seed
automatically.
"""
super().__init__(random=random)
def initialize_episode(self, physics: Physics) -> None:
"""Randomizes the tail and fin angles and the orientation of the Fish."""
quat = self.random.randn(4)
physics.named.data.qpos["root"][3:7] = quat / np.linalg.norm(quat)
for joint in _JOINTS:
physics.named.data.qpos[joint] = self.random.uniform(-0.2, 0.2)
# Hide the target. It's irrelevant for this task.
physics.named.model.geom_rgba["target", 3] = 0
super().initialize_episode(physics)
def get_observation(self, physics: Physics) -> collections.OrderedDict:
"""Returns an observation of joint angles, velocities and uprightness."""
obs = collections.OrderedDict()
obs["joint_angles"] = physics.joint_angles()
obs["upright"] = physics.upright() # type: ignore
obs["velocity"] = physics.velocity()
return obs
def get_reward(self, physics: Physics) -> float:
"""Returns a smooth reward."""
return rewards.tolerance(physics.upright(), bounds=(1, 1), margin=1)
class Swim(base.Task):
"""A Fish `Task` for swimming with smooth reward."""
def __init__(self, random: Union[np.random.RandomState, int, None] = None) -> None:
"""Initializes an instance of `Swim`.
Args:
random: Optional, either a `numpy.random.RandomState` instance, an
integer seed for creating a new `RandomState`, or None to select a seed
automatically (default).
"""
super().__init__(random=random)
def initialize_episode(self, physics: Physics) -> None:
"""Sets the state of the environment at the start of each episode."""
quat = self.random.randn(4)
physics.named.data.qpos["root"][3:7] = quat / np.linalg.norm(quat)
for joint in _JOINTS:
physics.named.data.qpos[joint] = self.random.uniform(-0.2, 0.2)
# Randomize target position.
physics.named.model.geom_pos["target", "x"] = self.random.uniform(-0.4, 0.4)
physics.named.model.geom_pos["target", "y"] = self.random.uniform(-0.4, 0.4)
physics.named.model.geom_pos["target", "z"] = self.random.uniform(0.1, 0.3)
super().initialize_episode(physics)
def get_observation(self, physics: Physics) -> collections.OrderedDict:
"""Returns an observation of joints, target direction and velocities."""
obs = collections.OrderedDict()
obs["joint_angles"] = physics.joint_angles()
obs["upright"] = physics.upright() # type: ignore
obs["target"] = physics.mouth_to_target()
obs["velocity"] = physics.velocity()
return obs
def get_reward(self, physics: Physics) -> np.float64:
"""Returns a smooth reward."""
radii = physics.named.model.geom_size[["mouth", "target"], 0].sum()
in_target = rewards.tolerance(
np.linalg.norm(physics.mouth_to_target()),
bounds=(0, radii),
margin=2 * radii,
)
is_upright = 0.5 * (physics.upright() + 1)
return (7 * in_target + is_upright) / 8
| 7,848 | 36.555024 | 87 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/quadruped.py | # Copyright 2019 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Quadruped Domain."""
from typing import Any, Dict, List, Optional, Union
import collections
from collections import OrderedDict
import dm_env # type: ignore
import numpy as np
from dm_control import mujoco # type: ignore
from dm_control.mujoco.wrapper import mjbindings # type: ignore
from dm_control.mujoco.wrapper.core import MjData # type: ignore
from dm_control.rl import control # type: ignore
from dm_control.suite import base, common # type: ignore
from dm_control.utils import containers, rewards, xml_tools # type: ignore
from lxml import etree # type: ignore
from scipy import ndimage
from carl.envs.dmc.dmc_tasks.utils import adapt_context # type: ignore
from carl.utils.types import Context
enums = mjbindings.enums
mjlib = mjbindings.mjlib
_DEFAULT_TIME_LIMIT = 20
_CONTROL_TIMESTEP = 0.02
STEP_LIMIT = 1000
# Horizontal speeds above which the move reward is 1.
_RUN_SPEED = 5
_WALK_SPEED = 0.5
# Constants related to terrain generation.
_HEIGHTFIELD_ID = 0
_TERRAIN_SMOOTHNESS = 0.15 # 0.0: maximally bumpy; 1.0: completely smooth.
_TERRAIN_BUMP_SCALE = 2 # Spatial scale of terrain bumps (in meters).
# Named model elements.
_TOES = ["toe_front_left", "toe_back_left", "toe_back_right", "toe_front_right"]
_WALLS = ["wall_px", "wall_py", "wall_nx", "wall_ny"]
SUITE = containers.TaggedTasks()
def make_model(
floor_size: Optional[Any] = None,
terrain: bool = False,
rangefinders: bool = False,
walls_and_ball: bool = False,
) -> bytes:
"""Returns the model XML string."""
xml_string = common.read_model("quadruped.xml")
parser = etree.XMLParser(remove_blank_text=True)
mjcf = etree.XML(xml_string, parser)
# Set floor size.
if floor_size is not None:
floor_geom = mjcf.find(".//geom[@name='floor']")
floor_geom.attrib["size"] = f"{floor_size} {floor_size} .5"
# Remove walls, ball and target.
if not walls_and_ball:
for wall in _WALLS:
wall_geom = xml_tools.find_element(mjcf, "geom", wall)
wall_geom.getparent().remove(wall_geom)
# Remove ball.
ball_body = xml_tools.find_element(mjcf, "body", "ball")
ball_body.getparent().remove(ball_body)
# Remove target.
target_site = xml_tools.find_element(mjcf, "site", "target")
target_site.getparent().remove(target_site)
# Remove terrain.
if not terrain:
terrain_geom = xml_tools.find_element(mjcf, "geom", "terrain")
terrain_geom.getparent().remove(terrain_geom)
# Remove rangefinders if they're not used, as range computations can be
# expensive, especially in a scene with heightfields.
if not rangefinders:
rangefinder_sensors = mjcf.findall(".//rangefinder")
for rf in rangefinder_sensors:
rf.getparent().remove(rf)
return etree.tostring(mjcf, pretty_print=True)
@SUITE.add() # type: ignore
def walk_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Walk task with the adapted context."""
xml_string = make_model(floor_size=_DEFAULT_TIME_LIMIT * _WALK_SPEED)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, common.ASSETS)
task = Move(desired_speed=_WALK_SPEED, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add() # type: ignore
def run_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Run task with the adapted context."""
xml_string = make_model(floor_size=_DEFAULT_TIME_LIMIT * _RUN_SPEED)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, common.ASSETS)
task = Move(desired_speed=_RUN_SPEED, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add() # type: ignore
def escape_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Escape task with the adapted context."""
xml_string = make_model(floor_size=40, terrain=True, rangefinders=True)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, common.ASSETS)
task = Escape(random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add() # type: ignore
def fetch_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Fetch task with the adapted context."""
xml_string = make_model(walls_and_ball=True)
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, common.ASSETS)
task = Fetch(random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
class Physics(mujoco.Physics):
"""Physics simulation with additional features for the Quadruped domain."""
def _reload_from_data(self, data: MjData) -> None:
super()._reload_from_data(data)
# Clear cached sensor names when the physics is reloaded.
self._sensor_types_to_names: Dict = {}
self._hinge_names: List = []
def _get_sensor_names(self, *sensor_types: List[int]) -> List[str]:
try:
sensor_names = self._sensor_types_to_names[sensor_types]
except KeyError:
[sensor_ids] = np.where(np.in1d(self.model.sensor_type, sensor_types))
sensor_names = [self.model.id2name(s_id, "sensor") for s_id in sensor_ids]
self._sensor_types_to_names[sensor_types] = sensor_names
return sensor_names
def torso_upright(self) -> np.ndarray:
"""Returns the dot-product of the torso z-axis and the global z-axis."""
return np.asarray(self.named.data.xmat["torso", "zz"])
def torso_velocity(self) -> np.ndarray:
"""Returns the velocity of the torso, in the local frame."""
return self.named.data.sensordata["velocimeter"].copy()
def egocentric_state(self) -> np.ndarray:
"""Returns the state without global orientation or position."""
if not self._hinge_names:
[hinge_ids] = np.nonzero(self.model.jnt_type == enums.mjtJoint.mjJNT_HINGE)
self._hinge_names = [
self.model.id2name(j_id, "joint") for j_id in hinge_ids
]
return np.hstack(
(
self.named.data.qpos[self._hinge_names],
self.named.data.qvel[self._hinge_names],
self.data.act,
)
)
def toe_positions(self) -> np.ndarray:
"""Returns toe positions in egocentric frame."""
torso_frame = self.named.data.xmat["torso"].reshape(3, 3)
torso_pos = self.named.data.xpos["torso"]
torso_to_toe = self.named.data.xpos[_TOES] - torso_pos
return torso_to_toe.dot(torso_frame)
def force_torque(self) -> np.ndarray:
"""Returns scaled force/torque sensor readings at the toes."""
force_torque_sensors = self._get_sensor_names(
enums.mjtSensor.mjSENS_FORCE, enums.mjtSensor.mjSENS_TORQUE
)
return np.arcsinh(self.named.data.sensordata[force_torque_sensors])
def imu(self) -> np.ndarray:
"""Returns IMU-like sensor readings."""
imu_sensors = self._get_sensor_names(
enums.mjtSensor.mjSENS_GYRO, enums.mjtSensor.mjSENS_ACCELEROMETER
)
return self.named.data.sensordata[imu_sensors]
def rangefinder(self) -> np.ndarray:
"""Returns scaled rangefinder sensor readings."""
rf_sensors = self._get_sensor_names(enums.mjtSensor.mjSENS_RANGEFINDER)
rf_readings = self.named.data.sensordata[rf_sensors]
no_intersection = -1.0
return np.where(rf_readings == no_intersection, 1.0, np.tanh(rf_readings))
def origin_distance(self) -> np.ndarray:
"""Returns the distance from the origin to the workspace."""
return np.asarray(np.linalg.norm(self.named.data.site_xpos["workspace"]))
def origin(self) -> np.ndarray:
"""Returns origin position in the torso frame."""
torso_frame = self.named.data.xmat["torso"].reshape(3, 3)
torso_pos = self.named.data.xpos["torso"]
return -torso_pos.dot(torso_frame)
def ball_state(self) -> np.ndarray:
"""Returns ball position and velocity relative to the torso frame."""
data = self.named.data
torso_frame = data.xmat["torso"].reshape(3, 3)
ball_rel_pos = data.xpos["ball"] - data.xpos["torso"]
ball_rel_vel = data.qvel["ball_root"][:3] - data.qvel["root"][:3]
ball_rot_vel = data.qvel["ball_root"][3:]
ball_state = np.vstack((ball_rel_pos, ball_rel_vel, ball_rot_vel))
return ball_state.dot(torso_frame).ravel()
def target_position(self) -> np.ndarray:
"""Returns target position in torso frame."""
torso_frame = self.named.data.xmat["torso"].reshape(3, 3)
torso_pos = self.named.data.xpos["torso"]
torso_to_target = self.named.data.site_xpos["target"] - torso_pos
return torso_to_target.dot(torso_frame)
def ball_to_target_distance(self) -> np.float64:
"""Returns horizontal distance from the ball to the target."""
ball_to_target = (
self.named.data.site_xpos["target"] - self.named.data.xpos["ball"]
)
return np.linalg.norm(ball_to_target[:2])
def self_to_ball_distance(self) -> np.float64:
"""Returns horizontal distance from the quadruped workspace to the ball."""
self_to_ball = (
self.named.data.site_xpos["workspace"] - self.named.data.xpos["ball"]
)
return np.linalg.norm(self_to_ball[:2])
def _find_non_contacting_height(
physics: Physics,
orientation: np.ndarray,
x_pos: float = 0.0,
y_pos: float = 0.0,
) -> None:
"""Find a height with no contacts given a body orientation.
Args:
physics: An instance of `Physics`.
orientation: A quaternion.
x_pos: A float. Position along global x-axis.
y_pos: A float. Position along global y-axis.
Raises:
RuntimeError: If a non-contacting configuration has not been found after
10,000 attempts.
"""
z_pos = 0.0 # Start embedded in the floor.
num_contacts = 1
num_attempts = 0
# Move up in 1cm increments until no contacts.
while num_contacts > 0:
try:
with physics.reset_context():
physics.named.data.qpos["root"][:3] = x_pos, y_pos, z_pos
physics.named.data.qpos["root"][3:] = orientation
except control.PhysicsError:
# We may encounter a PhysicsError here due to filling the contact
# buffer, in which case we simply increment the height and continue.
pass
num_contacts = physics.data.ncon
z_pos += 0.01
num_attempts += 1
if num_attempts > 10000:
raise RuntimeError("Failed to find a non-contacting configuration.")
def _common_observations(physics: Physics) -> collections.OrderedDict:
"""Returns the observations common to all tasks."""
obs = collections.OrderedDict()
obs["egocentric_state"] = physics.egocentric_state()
obs["torso_velocity"] = physics.torso_velocity()
obs["torso_upright"] = physics.torso_upright()
obs["imu"] = physics.imu()
obs["force_torque"] = physics.force_torque()
return obs
def _upright_reward(physics: Physics, deviation_angle: float = 0) -> np.float64:
"""Returns a reward proportional to how upright the torso is.
Args:
physics: an instance of `Physics`.
deviation_angle: A float, in degrees. The reward is 0 when the torso is
exactly upside-down and 1 when the torso's z-axis is less than
`deviation_angle` away from the global z-axis.
"""
deviation = np.cos(np.deg2rad(deviation_angle))
return rewards.tolerance(
physics.torso_upright(),
bounds=(deviation, float("inf")),
sigmoid="linear",
margin=1 + deviation,
value_at_margin=0,
)
class Move(base.Task):
"""A quadruped task solved by moving forward at a designated speed."""
def __init__(
self,
desired_speed: float,
random: Union[np.random.RandomState, int, None] = None,
) -> None:
"""Initializes an instance of `Move`.
Args:
desired_speed: A float. If this value is zero, reward is given simply
for standing upright. Otherwise this specifies the horizontal velocity
at which the velocity-dependent reward component is maximized.
random: Optional, either a `numpy.random.RandomState` instance, an
integer seed for creating a new `RandomState`, or None to select a seed
automatically (default).
"""
self._desired_speed = desired_speed
super().__init__(random=random)
def initialize_episode(self, physics: Physics) -> None:
"""Sets the state of the environment at the start of each episode.
Args:
physics: An instance of `Physics`.
"""
# Initial configuration.
orientation = self.random.randn(4)
orientation /= np.linalg.norm(orientation)
_find_non_contacting_height(physics, orientation)
super().initialize_episode(physics)
def get_observation(self, physics: Physics) -> collections.OrderedDict:
"""Returns an observation to the agent."""
return _common_observations(physics)
def get_reward(self, physics: Physics) -> np.float64:
"""Returns a reward to the agent."""
# Move reward term.
move_reward = rewards.tolerance(
physics.torso_velocity()[0],
bounds=(self._desired_speed, float("inf")),
margin=self._desired_speed,
value_at_margin=0.5,
sigmoid="linear",
)
return _upright_reward(physics) * move_reward
class Escape(base.Task):
"""A quadruped task solved by escaping a bowl-shaped terrain."""
def initialize_episode(self, physics: Physics) -> None:
"""Sets the state of the environment at the start of each episode.
Args:
physics: An instance of `Physics`.
"""
# Get heightfield resolution, assert that it is square.
res = physics.model.hfield_nrow[_HEIGHTFIELD_ID]
assert res == physics.model.hfield_ncol[_HEIGHTFIELD_ID]
# Sinusoidal bowl shape.
row_grid, col_grid = np.ogrid[-1 : 1 : res * 1j, -1 : 1 : res * 1j]
radius = np.clip(np.sqrt(col_grid**2 + row_grid**2), 0.04, 1)
bowl_shape = 0.5 - np.cos(2 * np.pi * radius) / 2
# Random smooth bumps.
terrain_size = 2 * physics.model.hfield_size[_HEIGHTFIELD_ID, 0]
bump_res = int(terrain_size / _TERRAIN_BUMP_SCALE)
bumps = self.random.uniform(_TERRAIN_SMOOTHNESS, 1, (bump_res, bump_res))
smooth_bumps = ndimage.zoom(bumps, res / float(bump_res))
# Terrain is elementwise product.
terrain = bowl_shape * smooth_bumps
start_idx = physics.model.hfield_adr[_HEIGHTFIELD_ID]
physics.model.hfield_data[start_idx : start_idx + res**2] = terrain.ravel()
super().initialize_episode(physics)
# If we have a rendering context, we need to re-upload the modified
# heightfield data.
if physics.contexts:
with physics.contexts.gl.make_current() as ctx:
ctx.call(
mjlib.mjr_uploadHField,
physics.model.ptr,
physics.contexts.mujoco.ptr,
_HEIGHTFIELD_ID,
)
# Initial configuration.
orientation = self.random.randn(4)
orientation /= np.linalg.norm(orientation)
_find_non_contacting_height(physics, orientation)
def get_observation(self, physics: Physics) -> collections.OrderedDict:
"""Returns an observation to the agent."""
obs = _common_observations(physics)
obs["origin"] = physics.origin()
obs["rangefinder"] = physics.rangefinder()
return obs
def get_reward(self, physics: Physics) -> np.float64:
"""Returns a reward to the agent."""
# Escape reward term.
terrain_size = physics.model.hfield_size[_HEIGHTFIELD_ID, 0]
escape_reward = rewards.tolerance(
physics.origin_distance(),
bounds=(terrain_size, float("inf")),
margin=terrain_size,
value_at_margin=0,
sigmoid="linear",
)
return _upright_reward(physics, deviation_angle=20) * escape_reward
class Fetch(base.Task):
"""A quadruped task solved by bringing a ball to the origin."""
def initialize_episode(self, physics: Physics) -> None:
"""Sets the state of the environment at the start of each episode.
Args:
physics: An instance of `Physics`.
"""
# Initial configuration, random azimuth and horizontal position.
azimuth = self.random.uniform(0, 2 * np.pi)
orientation = np.array((np.cos(azimuth / 2), 0, 0, np.sin(azimuth / 2)))
spawn_radius = 0.9 * physics.named.model.geom_size["floor", 0]
x_pos, y_pos = self.random.uniform(-spawn_radius, spawn_radius, size=(2,))
_find_non_contacting_height(physics, orientation, x_pos, y_pos)
# Initial ball state.
physics.named.data.qpos["ball_root"][:2] = self.random.uniform(
-spawn_radius, spawn_radius, size=(2,)
)
physics.named.data.qpos["ball_root"][2] = 2
physics.named.data.qvel["ball_root"][:2] = 5 * self.random.randn(2)
super().initialize_episode(physics)
def get_observation(self, physics: Physics) -> OrderedDict:
"""Returns an observation to the agent."""
obs = _common_observations(physics)
obs["ball_state"] = physics.ball_state()
obs["target_position"] = physics.target_position()
return obs
def get_reward(self, physics: Physics) -> np.float64:
"""Returns a reward to the agent."""
# Reward for moving close to the ball.
arena_radius = physics.named.model.geom_size["floor", 0] * np.sqrt(2)
workspace_radius = physics.named.model.site_size["workspace", 0]
ball_radius = physics.named.model.geom_size["ball", 0]
reach_reward = rewards.tolerance(
physics.self_to_ball_distance(),
bounds=(0, workspace_radius + ball_radius),
sigmoid="linear",
margin=arena_radius,
value_at_margin=0,
)
# Reward for bringing the ball to the target.
target_radius = physics.named.model.site_size["target", 0]
fetch_reward = rewards.tolerance(
physics.ball_to_target_distance(),
bounds=(0, target_radius),
sigmoid="linear",
margin=arena_radius,
value_at_margin=0,
)
reach_then_fetch = reach_reward * (0.5 + 0.5 * fetch_reward)
return _upright_reward(physics) * reach_then_fetch
| 21,376 | 37.241503 | 87 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/utils.py | from __future__ import annotations
from typing import List
from lxml import etree # type: ignore
from carl.utils.types import Context
def adapt_context(
xml_string: bytes, context: Context, context_mask: List = []
) -> bytes:
"""Adapts and returns the xml_string of the model with the given context."""
def check_okay_to_set(context_feature: str | list[str]) -> bool:
"""Set context feature if present in context and not in context mask."""
is_okay: bool = True
context_features: list[str]
if type(context_feature) is str:
context_features = [context_feature] # type: ignore[assignment]
else:
context_features = context_feature # type: ignore[assignment]
for cf in context_features:
if not (cf in context and cf not in context_mask):
is_okay = False
break
return is_okay
mjcf = etree.fromstring(xml_string)
default = mjcf.find("./default/")
if default is None:
default = etree.Element("default")
mjcf.addnext(default)
if check_okay_to_set("joint_damping"):
# adjust damping for all joints if damping is already an attribute
for joint_find in mjcf.findall(".//joint[@damping]"):
joint_damping = joint_find.get("damping")
joint_find.set(
"damping", str(float(joint_damping) * context["joint_damping"])
)
if check_okay_to_set("joint_stiffness"):
# adjust stiffness for all joints if stiffness is already an attribute
for joint_find in mjcf.findall(".//joint[@stiffness]"):
joint_stiffness = joint_find.get("stiffness")
joint_find.set(
"stiffness", str(float(joint_stiffness) * context["joint_stiffness"])
)
# set default joint damping if default/joint is not present
joint = mjcf.find("./default/joint")
if joint is None:
joint = etree.Element("joint")
default.addnext(joint)
if check_okay_to_set("joint_damping"):
def_joint_damping = 0.1
default_joint_damping = str(
float(def_joint_damping) * context["joint_damping"]
)
joint.set("damping", default_joint_damping)
if check_okay_to_set("joint_stiffness"):
default_joint_stiffness = str(context["joint_stiffness"])
joint.set("stiffness", default_joint_stiffness)
# adjust friction for all geom elements with friction attribute
if check_okay_to_set(
["friction_tangential", "friction_torsional", "friction_rolling"]
):
for geom_find in mjcf.findall(".//geom[@friction]"):
friction = geom_find.get("friction").split(" ")
frict_str = ""
for i, (f, d) in enumerate(
zip(
friction,
[
context["friction_tangential"],
context["friction_torsional"],
context["friction_rolling"],
],
)
):
if (
(i == 0 and "friction_tangential" not in context_mask)
or (i == 1 and "friction_torsional" not in context_mask)
or (i == 2 and "friction_rolling" not in context_mask)
):
frict_str += str(float(f) * d) + " "
else:
frict_str += str(f) + " "
geom_find.set("friction", frict_str[:-1])
if check_okay_to_set("geom_density"):
# adjust density for all geom elements with density attribute
for geom_find in mjcf.findall(".//geom[@density]"):
geom_find.set(
"density",
str(float(geom_find.get("density")) * context["geom_density"]),
)
# create default geom if it does not exist
geom = mjcf.find("./default/geom")
if geom is None:
geom = etree.Element("geom")
default.addnext(geom)
# set default friction
if geom.get("friction") is None and check_okay_to_set(
["friction_tangential", "friction_torsional", "friction_rolling"]
):
default_friction_tangential = 1.0
default_friction_torsional = 0.005
default_friction_rolling = 0.0001
geom.set(
"friction",
" ".join(
[
(
str(
default_friction_tangential * context["friction_tangential"]
)
if "friction_tangential" not in context_mask
else str(default_friction_tangential)
),
(
str(default_friction_torsional * context["friction_torsional"])
if "friction_torsional" not in context_mask
else str(default_friction_torsional)
),
(
str(default_friction_rolling * context["friction_rolling"])
if "friction_rolling" not in context_mask
else str(default_friction_rolling)
),
]
),
)
if check_okay_to_set("geom_density"):
# set default density
geom_density = geom.get("density")
if geom_density is None:
geom_density = 1000
geom.set("density", str(float(geom_density) * context["geom_density"]))
if check_okay_to_set("actuator_strength"):
# scale all actuators with the actuator strength factor
actuators = mjcf.findall("./actuator/")
for actuator in actuators:
gear = actuator.get("gear")
if gear is None:
gear = 1
actuator.set("gear", str(float(gear) * context["actuator_strength"]))
# find option settings and override them if they exist, otherwise create new option
option = mjcf.find(".//option")
if option is None:
option = etree.Element("option")
mjcf.append(option)
if check_okay_to_set("gravity"):
gravity = option.get("gravity")
if gravity is not None:
g = gravity.split(" ")
gravity = " ".join([g[0], g[1], str(context["gravity"])])
else:
gravity = " ".join(["0", "0", str(context["gravity"])])
option.set("gravity", gravity)
if check_okay_to_set("wind"):
wind = option.get("wind")
if wind is not None:
w = wind.split(" ")
wind = " ".join(
[
(str(context["wind_x"]) if "wind_x" not in context_mask else w[0]),
(str(context["wind_y"]) if "wind_y" not in context_mask else w[1]),
(str(context["wind_z"]) if "wind_z" not in context_mask else w[2]),
]
)
else:
wind = " ".join(
[
(str(context["wind_x"]) if "wind_x" not in context_mask else "0"),
(str(context["wind_y"]) if "wind_y" not in context_mask else "0"),
(str(context["wind_z"]) if "wind_z" not in context_mask else "0"),
]
)
option.set("wind", wind)
if check_okay_to_set("timestep"):
option.set("timestep", str(context["timestep"]))
if check_okay_to_set("density"):
option.set("density", str(context["density"]))
if check_okay_to_set("viscosity"):
option.set("viscosity", str(context["viscosity"]))
xml_string = etree.tostring(mjcf, pretty_print=True)
return xml_string
| 7,735 | 37.29703 | 88 | py |
null | CARL-main/carl/envs/dmc/dmc_tasks/walker.py | # Copyright 2017 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Planar Walker Domain."""
from typing import Dict, List, Optional, Tuple, Union
import collections
import dm_env # type: ignore
import numpy as np
from dm_control import mujoco # type: ignore
from dm_control.rl import control # type: ignore
from dm_control.suite import base, common # type: ignore
from dm_control.suite.utils import randomizers # type: ignore
from dm_control.utils import containers, rewards # type: ignore
from carl.envs.dmc.dmc_tasks.utils import adapt_context # type: ignore
from carl.utils.types import Context
_DEFAULT_TIME_LIMIT = 25
_CONTROL_TIMESTEP = 0.025
# Minimal height of torso over foot above which stand reward is 1.
_STAND_HEIGHT = 1.2
# Horizontal speeds (meters/second) above which move reward is 1.
_WALK_SPEED = 1
_RUN_SPEED = 8
STEP_LIMIT = 1000
SUITE = containers.TaggedTasks()
def get_model_and_assets() -> Tuple[bytes, Dict]:
"""Returns a tuple containing the model XML string and a dict of assets."""
return common.read_model("walker.xml"), common.ASSETS
@SUITE.add("benchmarking") # type: ignore
def stand_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Stand task with the adapted context."""
xml_string, assets = get_model_and_assets()
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = PlanarWalker(move_speed=0, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add("benchmarking") # type: ignore
def walk_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Walk task with the adapted context."""
xml_string, assets = get_model_and_assets()
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = PlanarWalker(move_speed=_WALK_SPEED, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
@SUITE.add("benchmarking") # type: ignore
def run_context(
context: Context = {},
context_mask: List = [],
time_limit: int = _DEFAULT_TIME_LIMIT,
random: Union[np.random.RandomState, int, None] = None,
environment_kwargs: Optional[Dict] = None,
) -> dm_env:
"""Returns the Run task with the adapted context."""
xml_string, assets = get_model_and_assets()
if context != {}:
xml_string = adapt_context(
xml_string=xml_string, context=context, context_mask=context_mask
)
physics = Physics.from_xml_string(xml_string, assets)
task = PlanarWalker(move_speed=_RUN_SPEED, random=random)
environment_kwargs = environment_kwargs or {}
return control.Environment(
physics,
task,
time_limit=time_limit,
control_timestep=_CONTROL_TIMESTEP,
**environment_kwargs,
)
class Physics(mujoco.Physics):
"""Physics simulation with additional features for the Walker domain."""
def torso_upright(self) -> np.float64:
"""Returns projection from z-axes of torso to the z-axes of world."""
return self.named.data.xmat["torso", "zz"]
def torso_height(self) -> np.float64:
"""Returns the height of the torso."""
return self.named.data.xpos["torso", "z"]
def horizontal_velocity(self) -> np.float64:
"""Returns the horizontal velocity of the center-of-mass."""
return self.named.data.sensordata["torso_subtreelinvel"][0]
def orientations(self) -> np.ndarray:
"""Returns planar orientations of all bodies."""
return self.named.data.xmat[1:, ["xx", "xz"]].ravel()
class PlanarWalker(base.Task):
"""A planar walker task."""
def __init__(
self, move_speed: float, random: Union[np.random.RandomState, int, None] = None
) -> None:
"""Initializes an instance of `PlanarWalker`.
Args:
move_speed: A float. If this value is zero, reward is given simply for
standing up. Otherwise this specifies a target horizontal velocity for
the walking task.
random: Optional, either a `numpy.random.RandomState` instance, an
integer seed for creating a new `RandomState`, or None to select a seed
automatically (default).
"""
self._move_speed = move_speed
super().__init__(random=random)
def initialize_episode(self, physics: Physics) -> None:
"""Sets the state of the environment at the start of each episode.
In 'standing' mode, use initial orientation and small velocities.
In 'random' mode, randomize joint angles and let fall to the floor.
Args:
physics: An instance of `Physics`.
"""
randomizers.randomize_limited_and_rotational_joints(physics, self.random)
super().initialize_episode(physics)
def get_observation(self, physics: Physics) -> collections.OrderedDict:
"""Returns an observation of body orientations, height and velocites."""
obs = collections.OrderedDict()
obs["orientations"] = physics.orientations()
obs["height"] = physics.torso_height() # type: ignore
obs["velocity"] = physics.velocity()
self.get_reward(physics)
return obs
def get_reward(self, physics: Physics) -> np.float64:
"""Returns a reward to the agent."""
standing = rewards.tolerance(
physics.torso_height(),
bounds=(_STAND_HEIGHT, float("inf")),
margin=_STAND_HEIGHT / 2,
)
upright = (1 + physics.torso_upright()) / 2
stand_reward = (3 * standing + upright) / 4
if self._move_speed == 0:
return stand_reward
else:
move_reward = rewards.tolerance(
physics.horizontal_velocity(),
bounds=(self._move_speed, float("inf")),
margin=self._move_speed / 2,
value_at_margin=0.5,
sigmoid="linear",
)
return stand_reward * (5 * move_reward + 1) / 6
| 7,522 | 34.995215 | 87 | py |
null | CARL-main/carl/envs/mario/__init__.py | # flake8: noqa: F401
import warnings
try:
from carl.envs.mario.carl_mario import CARLMarioEnv
except Exception as e:
warnings.warn(f"Could not load CARLMarioEnv which is probably not installed ({e}).")
from carl.envs.mario.carl_mario_definitions import CONTEXT_BOUNDS as CARLMarioEnv_bounds
from carl.envs.mario.carl_mario_definitions import (
DEFAULT_CONTEXT as CARLMarioEnv_defaults,
)
| 402 | 30 | 88 | py |
null | CARL-main/carl/envs/mario/carl_mario.py | from typing import Dict, List, Optional, Union
import gym
from carl.context.selection import AbstractSelector
from carl.envs.carl_env import CARLEnv
from carl.envs.mario.carl_mario_definitions import (
DEFAULT_CONTEXT,
INITIAL_HEIGHT,
INITIAL_WIDTH,
)
from carl.envs.mario.mario_env import MarioEnv
from carl.envs.mario.toad_gan import generate_level
from carl.utils.trial_logger import TrialLogger
from carl.utils.types import Context, Contexts
class CARLMarioEnv(CARLEnv):
def __init__(
self,
env: gym.Env = MarioEnv(levels=[]),
contexts: Contexts = {},
hide_context: bool = True,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.05,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
):
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
super().__init__(
env=env,
contexts=contexts,
hide_context=True,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features="no",
default_context=default_context,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.levels: List[str] = []
self._update_context()
def _update_context(self) -> None:
self.env: MarioEnv
if not self.levels:
for context in self.contexts.values():
level = generate_level(
width=INITIAL_WIDTH,
height=INITIAL_HEIGHT,
level_index=context["level_index"],
initial_noise=context["noise"],
filter_unplayable=True,
)
self.levels.append(level)
self.env.mario_state = self.context["mario_state"]
self.env.mario_inertia = self.context["mario_inertia"]
self.env.levels = [self.levels[self.context_index]]
def _log_context(self) -> None:
if self.logger:
loggable_context = {k: v for k, v in self.context.items() if k != "noise"}
self.logger.write_context(
self.episode_counter, self.total_timestep_counter, loggable_context
)
| 2,895 | 36.128205 | 86 | py |
null | CARL-main/carl/envs/mario/carl_mario_definitions.py | import numpy as np
from torch import Tensor
try:
from carl.envs.mario.toad_gan import generate_initial_noise
except FileNotFoundError:
def generate_initial_noise(width: int, height: int, level_index: int) -> Tensor:
return Tensor()
INITIAL_WIDTH = 100
INITIAL_LEVEL_INDEX = 0
INITIAL_HEIGHT = 16
DEFAULT_CONTEXT = {
"level_index": INITIAL_LEVEL_INDEX,
"noise": generate_initial_noise(INITIAL_WIDTH, INITIAL_HEIGHT, INITIAL_LEVEL_INDEX),
"mario_state": 0,
"mario_inertia": 0.89,
}
CONTEXT_BOUNDS = {
"level_index": (None, None, "categorical", np.arange(0, 14)),
"noise": (-1.0, 1.0, float),
"mario_state": (None, None, "categorical", [0, 1, 2]),
"mario_inertia": (0.5, 1.5, float),
}
CATEGORICAL_CONTEXT_FEATURES = ["level_index", "mario_state"]
| 797 | 27.5 | 88 | py |
null | CARL-main/carl/envs/mario/generate_sample.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from typing import Any, List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torch import Tensor
from torch.nn.functional import interpolate
# Generates a noise tensor. Uses torch.randn.
def generate_spatial_noise(
size: Union[Any, List[int], Tuple[int]], device: Union[str, torch.device] = "cpu"
) -> Tensor:
return torch.randn(size, device=device, dtype=torch.float32)
# Generate a sample given a TOAD-GAN and additional parameters
@torch.no_grad() # type: ignore [misc]
def generate_sample(
generators: Tensor,
noise_maps: Tensor,
reals: Tensor,
noise_amplitudes: Tensor,
num_layer: int,
token_list: Tensor,
scale_v: float = 1.0,
scale_h: float = 1.0,
current_scale: int = 0,
gen_start_scale: int = 0,
initial_noise: Optional[Tensor] = None,
) -> List[str]:
in_s = None
images_cur: List[Tensor] = []
images: List[Tensor] = []
z_s: List[Tensor] = []
# Generate on GPU if available
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# Main loop
for G, Z_opt, noise_amp in zip(generators, noise_maps, noise_amplitudes):
if current_scale >= len(generators):
break # should not be reached
# Zero Padding
n_pad = int(num_layer)
m = nn.ZeroPad2d(int(n_pad))
# Calculate actual shape
nzx = (Z_opt.shape[2] - n_pad * 2) * scale_v
nzy = (Z_opt.shape[3] - n_pad * 2) * scale_h
# Init images list
images_prev = images_cur
images_cur = []
channels = len(token_list)
# Init in_s
if in_s is None:
in_s = torch.zeros(reals[0].shape[0], channels, *reals[0].shape[2:]).to(
device
)
elif in_s.sum() == 0:
in_s = torch.zeros(in_s.shape[0], channels, *in_s.shape[2:]).to(device)
if current_scale == 0: # First step: Make base noise
if initial_noise is not None and len(initial_noise) > 0:
z_curr = initial_noise.float().to(device)
else:
z_curr = generate_spatial_noise(
[1, channels, int(round(nzx)), int(round(nzy))], device=device
)
z_curr = m(z_curr)
else: # All other steps: Make added noise
if current_scale < gen_start_scale:
z_curr = z_s[current_scale]
else:
z_curr = generate_spatial_noise(
[1, channels, int(round(nzx)), int(round(nzy))], device=device
)
z_curr = m(z_curr)
if (not images_prev) or current_scale == 0: # if there is no "previous" image
I_prev = in_s
else:
I_prev = images[current_scale - 1]
# Bilinear interpolation for upscaling
I_prev = interpolate(
I_prev,
[int(round(nzx)), int(round(nzy))],
mode="bilinear",
align_corners=False,
)
I_prev = m(I_prev)
# Main Step
z_in = noise_amp * z_curr + I_prev
I_curr = G(z_in, I_prev, temperature=1)
# Append results
images_cur.append(I_curr)
if current_scale >= gen_start_scale:
images.append(I_curr)
z_s.append(z_curr)
current_scale += 1
return one_hot_to_ascii_level(I_curr, token_list)
def one_hot_to_ascii_level(level: Any, tokens: Any) -> List[str]:
"""Converts a full token level tensor to an ascii level."""
ascii_level = []
for i in range(level.shape[2]):
line = ""
for j in range(level.shape[3]):
line += tokens[level[:, :, i, j].argmax()]
if i < level.shape[2] - 1:
line += "\n"
ascii_level.append(line)
return ascii_level
| 3,858 | 30.373984 | 86 | py |
null | CARL-main/carl/envs/mario/level_image_gen.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from typing import Any, List, Tuple
import os
from PIL import Image, ImageEnhance, ImageOps
class LevelImageGen:
"""Generates PIL Image files from Super Mario Bros. ascii levels.
Initialize once and then use LevelImageGen.render() to generate images."""
def __init__(self, sprite_path: str):
"""sprite_path: path to the folder of sprite files, e.g. 'mario/sprites/'"""
# Load Graphics (assumes sprite_path points to "img" folder of Mario-AI-Framework or provided sprites folder
mariosheet = Image.open(os.path.join(sprite_path, "smallmariosheet.png"))
enemysheet = Image.open(os.path.join(sprite_path, "enemysheet.png"))
itemsheet = Image.open(os.path.join(sprite_path, "itemsheet.png"))
mapsheet = Image.open(os.path.join(sprite_path, "mapsheet.png"))
# Cut out the actual sprites:
sprite_dict = dict()
# Mario Sheet
sprite_dict["M"] = mariosheet.crop((4 * 16, 0, 5 * 16, 16))
# Enemy Sheet
enemy_names = ["r", "k", "g", "y", "wings", "*", "plant"]
for i, e in enumerate(enemy_names):
sprite_dict[e] = enemysheet.crop((0, i * 2 * 16, 16, (i + 1) * 2 * 16))
sprite_dict["E"] = enemysheet.crop(
(16, 2 * 2 * 16, 2 * 16, 3 * 2 * 16)
) # Set generic enemy to second goomba sprite
sprite_dict["plant"] = enemysheet.crop(
(16, (len(enemy_names) - 1) * 2 * 16, 2 * 16, len(enemy_names) * 2 * 16)
)
# Item Sheet
sprite_dict["shroom"] = itemsheet.crop((0, 0, 16, 16))
sprite_dict["flower"] = itemsheet.crop((16, 0, 2 * 16, 16))
sprite_dict["flower2"] = itemsheet.crop((0, 16, 16, 2 * 16))
sprite_dict["1up"] = itemsheet.crop((16, 16, 2 * 16, 2 * 16))
# Map Sheet
map_names = [
"-",
"X",
"#",
"B",
"b",
"b2",
"S",
"L",
"?",
"dump",
"@",
"Q",
"dump",
"!",
"D",
"o",
"o2",
"o3",
"<",
">",
"[",
"]",
"bg_sl_l",
"bg_top",
"bg_sl_r",
"bg_m_l",
"bg_m",
"bg_m_r",
"bush_l",
"bush_m",
"bush_r",
"cloud_l",
"cloud_m",
"cloud_r",
"cloud_b_l",
"cloud_b_m",
"cloud_b_r",
"waves",
"water",
"F_top",
"F_b",
"F",
"bg_sky",
"%",
"%_l",
"%_r",
"%_m",
"|",
"1",
"2",
"C",
"U",
"T",
"t",
"dump",
"dump",
]
sheet_length = (7, 8)
sprite_counter = 0
for i in range(sheet_length[0]):
for j in range(sheet_length[1]):
sprite_dict[map_names[sprite_counter]] = mapsheet.crop(
(j * 16, i * 16, (j + 1) * 16, (i + 1) * 16)
)
sprite_counter += 1
sprite_dict["@"] = sprite_dict["?"]
sprite_dict["!"] = sprite_dict["Q"]
self.sprite_dict = sprite_dict
def prepare_sprite_and_box(
self, ascii_level: List[str], sprite_key: str, curr_x: int, curr_y: int
) -> Tuple[Any, Tuple[int, int, int, int]]:
"""Helper to make correct sprites and sprite sizes to draw into the image.
Some sprites are bigger than one tile and the renderer needs to adjust for them."""
# Init default size
new_left = curr_x * 16
new_top = curr_y * 16
new_right = (curr_x + 1) * 16
new_bottom = (curr_y + 1) * 16
# Handle sprites depending on their type:
if sprite_key == "F": # Flag Pole
actual_sprite = Image.new("RGBA", (2 * 16, curr_y * 16))
actual_sprite.paste(self.sprite_dict["F_top"], (16, 0, 2 * 16, 16))
for s in range(curr_y):
actual_sprite.paste(
self.sprite_dict["F_b"], (16, (s + 1) * 16, 2 * 16, (s + 2) * 16)
)
actual_sprite.paste(self.sprite_dict["F"], (7, 1 * 16, 16 + 7, 2 * 16))
new_left = new_left - 16
new_top = new_top - (curr_y - 1) * 16
elif sprite_key in ["y", "E", "g", "k", "r"]: # enemy sprite
actual_sprite = self.sprite_dict[sprite_key]
new_top = new_top - 16
elif sprite_key in ["Y", "K", "R"]: # winged spiky/koopa sprite
actual_sprite = Image.new("RGBA", (2 * 16, 2 * 16))
actual_sprite.paste(
self.sprite_dict[str.lower(sprite_key)], (16, 0, 2 * 16, 2 * 16)
)
actual_sprite.paste(self.sprite_dict["wings"], (7, -7, 16 + 7, 2 * 16 - 7))
new_left = new_left - 16
new_top = new_top - 16
elif (
sprite_key == "G"
): # winged goomba sprite (untested because original has none?)
actual_sprite = Image.new("RGBA", (3 * 16, 2 * 16))
actual_sprite.paste(self.sprite_dict["wings"], (1, -5, 16 + 1, 2 * 16 - 5))
actual_sprite.paste(
ImageOps.mirror(self.sprite_dict["wings"]),
(2 * 16 - 1, -5, 3 * 16 - 1, 2 * 16 - 5),
)
actual_sprite.paste(
self.sprite_dict[str.lower(sprite_key)], (16, 0, 2 * 16, 2 * 16)
)
new_left = new_left - 16
new_top = new_top - 16
new_right = new_right + 16
elif sprite_key == "%": # jump through platform
if curr_x == 0:
if (
len(ascii_level[curr_y]) > 1
and ascii_level[curr_y][curr_x + 1] == sprite_key
): # middle piece
actual_sprite = self.sprite_dict["%_m"]
else: # single_piece
actual_sprite = self.sprite_dict["%"]
elif ascii_level[curr_y][curr_x - 1] == sprite_key:
if curr_x >= (len(ascii_level[curr_y]) - 1): # right end piece
actual_sprite = self.sprite_dict["%_r"]
elif ascii_level[curr_y][curr_x + 1] == sprite_key: # middle piece
actual_sprite = self.sprite_dict["%_m"]
else: # right end piece
actual_sprite = self.sprite_dict["%_r"]
else:
if curr_x >= (len(ascii_level[curr_y]) - 1): # single piece
actual_sprite = self.sprite_dict["%"]
elif ascii_level[curr_y][curr_x + 1] == sprite_key: # left end piece
actual_sprite = self.sprite_dict["%_l"]
else: # single piece
actual_sprite = self.sprite_dict[sprite_key]
elif sprite_key == "b": # bullet bill tower
if curr_y > 0:
if ascii_level[curr_y - 1][curr_x] == sprite_key:
actual_sprite = self.sprite_dict["b2"]
else:
actual_sprite = self.sprite_dict[sprite_key]
else:
actual_sprite = self.sprite_dict[sprite_key]
elif sprite_key == "*": # alternative bullet bill tower
if curr_y > 0:
if ascii_level[curr_y - 1][curr_x] != sprite_key: # top
actual_sprite = self.sprite_dict["B"]
elif curr_y > 1:
if ascii_level[curr_y - 2][curr_x] != sprite_key:
actual_sprite = self.sprite_dict["b"]
else:
actual_sprite = self.sprite_dict["b2"]
else:
actual_sprite = self.sprite_dict["b2"]
elif sprite_key in ["T", "t"]: # Pipes
# figure out what kind of pipe this is
if curr_y > 0 and ascii_level[curr_y - 1][curr_x] == sprite_key:
is_top = False
else:
is_top = True
pipelength_t = 0
while (
curr_y - pipelength_t >= 0
and ascii_level[curr_y - pipelength_t][curr_x] == sprite_key
):
pipelength_t += 1
pipelength_b = 0
while (
curr_y + pipelength_b < len(ascii_level)
and ascii_level[curr_y + pipelength_b][curr_x] == sprite_key
):
pipelength_b += 1
pipelength_l = 0
while (
curr_x - pipelength_l >= 0
and ascii_level[curr_y][curr_x - pipelength_l] == sprite_key
):
pipelength_l += 1
pipelength_r = 0
while (
curr_x + pipelength_r < len(ascii_level[curr_y])
and ascii_level[curr_y][curr_x - pipelength_r] == sprite_key
):
pipelength_r += 1
# Check for fall out criteria
try:
if pipelength_l % 2 == 0: # second half of a double pipe
is_left = False
is_right = True
elif pipelength_l % 2 == 1:
if (
curr_x >= len(ascii_level[curr_y])
or ascii_level[curr_y][curr_x + 1] != sprite_key
):
is_left = False
is_right = False
else:
is_left = True
is_right = False
else:
is_left = False
is_right = False
if is_left:
if ascii_level[curr_y - pipelength_t][curr_x + 1] == sprite_key:
is_left = False
is_right = False
if ascii_level[curr_y - pipelength_t + 1][curr_x + 1] != sprite_key:
is_left = False
is_right = False
if is_right:
if ascii_level[curr_y - pipelength_t][curr_x - 1] == sprite_key:
is_left = False
is_right = False
if ascii_level[curr_y - pipelength_t + 1][curr_x - 1] != sprite_key:
is_left = False
is_right = False
if curr_y + pipelength_b < len(ascii_level):
if is_left:
if ascii_level[curr_y + pipelength_b][curr_x + 1] == sprite_key:
is_left = False
is_right = False
if (
ascii_level[curr_y + pipelength_b - 1][curr_x + 1]
!= sprite_key
):
is_left = False
is_right = False
if is_right:
if ascii_level[curr_y + pipelength_b][curr_x - 1] == sprite_key:
is_left = False
is_right = False
if (
ascii_level[curr_y + pipelength_b - 1][curr_x - 1]
!= sprite_key
):
is_left = False
is_right = False
except IndexError:
# Default to single pipe
is_left = False
is_right = False
if is_top:
if is_left:
actual_sprite = self.sprite_dict["<"]
elif is_right:
if sprite_key == "T":
actual_sprite = Image.new("RGBA", (2 * 16, 3 * 16))
actual_sprite.paste(
self.sprite_dict["plant"], (8, 5, 16 + 8, 2 * 16 + 5)
)
actual_sprite.paste(
self.sprite_dict["<"], (0, 2 * 16, 16, 3 * 16)
)
actual_sprite.paste(
self.sprite_dict[">"], (16, 2 * 16, 2 * 16, 3 * 16)
)
new_left = new_left - 16
new_top = new_top - 2 * 16
else:
actual_sprite = self.sprite_dict[">"]
else:
if sprite_key == "T":
actual_sprite = Image.new("RGBA", (16, 3 * 16))
actual_sprite.paste(
self.sprite_dict["plant"], (0, 5, 16, 2 * 16 + 5)
)
actual_sprite.paste(
self.sprite_dict["T"], (0, 2 * 16, 16, 3 * 16)
)
new_top = new_top - 2 * 16
else:
actual_sprite = self.sprite_dict["T"]
else:
if is_left:
actual_sprite = self.sprite_dict["["]
elif is_right:
actual_sprite = self.sprite_dict["]"]
else:
actual_sprite = self.sprite_dict["t"]
elif sprite_key in [
"?",
"@",
"Q",
"!",
"C",
"U",
"L",
]: # Block/Brick hidden items
if sprite_key == "L":
i_key = "1up"
elif sprite_key in ["?", "@", "U"]:
i_key = "shroom"
else:
i_key = "o"
mask = self.sprite_dict[i_key].getchannel(3)
mask = ImageEnhance.Brightness(mask).enhance(0.7)
actual_sprite = Image.composite(
self.sprite_dict[i_key], self.sprite_dict[sprite_key], mask=mask
)
elif sprite_key in ["1", "2"]: # Hidden block
if sprite_key == "1":
i_key = "1up"
else:
i_key = "o"
mask1 = self.sprite_dict["D"].getchannel(3)
mask1 = ImageEnhance.Brightness(mask1).enhance(0.5)
tmp_sprite = Image.composite(
self.sprite_dict["D"], self.sprite_dict[sprite_key], mask=mask1
)
mask = self.sprite_dict[i_key].getchannel(3)
mask = ImageEnhance.Brightness(mask).enhance(0.7)
actual_sprite = Image.composite(
self.sprite_dict[i_key], tmp_sprite, mask=mask
)
else:
actual_sprite = self.sprite_dict[sprite_key]
return actual_sprite, (new_left, new_top, new_right, new_bottom)
def render(self, ascii_level: List[str]) -> Image:
"""Renders the ascii level as a PIL Image. Assumes the Background is sky"""
len_level = len(ascii_level[-1])
height_level = len(ascii_level)
# Fill base image with sky tiles
dst = Image.new("RGB", (len_level * 16, height_level * 16))
for y in range(height_level):
for x in range(len_level):
dst.paste(
self.sprite_dict["bg_sky"],
(x * 16, y * 16, (x + 1) * 16, (y + 1) * 16),
)
# Fill with actual tiles
for y in range(height_level):
for x in range(len_level):
curr_sprite = ascii_level[y][x]
sprite, box = self.prepare_sprite_and_box(
ascii_level, curr_sprite, x, y
)
dst.paste(sprite, box, mask=sprite)
return dst
| 15,849 | 36.828162 | 116 | py |
null | CARL-main/carl/envs/mario/mario_env.py | from typing import Any, ByteString, Deque, Dict, List, Literal, Optional, Union, cast
import os
import random
import socket
from collections import deque
import cv2
import gym
import numpy as np
from gym import spaces
from gym.core import ObsType
from gym.utils import seeding
from PIL import Image
from py4j.java_gateway import GatewayParameters, JavaGateway
from carl.envs.mario.level_image_gen import LevelImageGen
from .mario_game import MarioGame
from .utils import get_port, load_level
class MarioEnv(gym.Env):
metadata = {"render.modes": ["rgb_array"]}
def __init__(
self,
levels: List[str],
timer: int = 100,
visual: bool = False,
sticky_action_probability: float = 0.1,
frame_skip: int = 2,
frame_stack: int = 4,
frame_dim: int = 64,
hide_points_banner: bool = False,
sparse_rewards: bool = False,
grayscale: bool = False,
seed: int = 0,
):
self.gateway: Any = None
self.seed(seed)
self.level_names = levels
self.levels = [load_level(name) for name in levels]
self.timer = timer
self.visual = visual
self.frame_skip = frame_skip
self.frame_stack = frame_stack
self.sticky_action_probability = sticky_action_probability
self.hide_points_banner = hide_points_banner
self.sparse_rewards = sparse_rewards
self.points_banner_height = 4
self.grayscale = grayscale
self.last_action = None
self.width = self.height = frame_dim
self.observation_space = spaces.Box(
low=0,
high=255,
shape=[self.frame_stack if grayscale else 3, self.height, self.width],
dtype=np.uint8,
)
self.original_obs: Deque = deque(maxlen=self.frame_skip)
self.actions = [
[False, False, False, False, False], # noop
[False, False, True, False, False], # down
[False, True, False, False, False], # right
[False, True, False, True, False], # right speed
[False, True, False, False, True], # right jump
[False, True, False, True, True], # right speed jump
[True, False, False, False, False], # left
[True, False, False, False, True], # left jump
[True, False, False, True, True], # left speed jump
[False, False, False, False, True], # jump
]
self.action_space = spaces.Discrete(n=len(self.actions))
self._obs: Any = np.zeros(shape=self.observation_space.shape, dtype=np.uint8)
self.current_level_idx = 0
self.frame_size = -1
self.port = get_port()
self.mario_state: Literal[0, 1, 2] = 0 # normal, large, fire
self.mario_inertia = 0.89
self._init_game()
def reset(
self,
*,
seed: Optional[int] = None,
return_info: bool = False,
options: Optional[dict] = None,
) -> Union[ObsType, tuple[ObsType, dict]]:
self._reset_obs()
if self.game is None:
self.game: Any = self._init_game()
self.current_level_idx = (self.current_level_idx + 1) % len(self.levels)
level = self.levels[self.current_level_idx]
self.game.resetGame(level, self.timer, self.mario_state, self.mario_inertia)
self.game.computeObservationRGB()
buffer = self._receive()
frame = self._read_frame(buffer)
self._update_obs(frame)
if not return_info:
return self._obs.copy()
else:
return self._obs.copy(), {}
def step(self, action: Any) -> Any:
if self.sticky_action_probability != 0.0:
if (
self.last_action is not None
and random.random() < self.sticky_action_probability
):
a = self.actions[self.last_action]
else:
a = self.actions[action]
self.last_action = action
else:
a = self.actions[action]
assert self.game
frame = None
for i in range(self.frame_skip):
self.game.stepGame(*a)
if self.visual or i == self.frame_skip - 1:
self.game.computeObservationRGB()
buffer = self._receive()
frame = self._read_frame(buffer)
self._update_obs(frame)
reward, done, completionPercentage = (
self.game.computeReward(),
self.game.computeDone(),
self.game.getCompletionPercentage(),
)
info: Dict[str, Any] = {"completed": completionPercentage}
if self.visual:
info["original_obs"] = self.original_obs
return (
self._obs.copy(),
reward if not self.sparse_rewards else int(completionPercentage == 1.0),
done, # bool
info, # Dict[str, Any]
)
def render(self, *args: Any, **kwargs: Any) -> ObsType:
return self.original_obs[0]
def __getstate__(self) -> Dict:
assert self.gateway
self.gateway.close()
self.gateway = None
self.game = None
self.socket.shutdown(1)
self.socket.close()
return self.__dict__
def _reset_obs(self) -> None:
self._obs[:] = 0
self.original_obs.clear()
def _read_frame(self, buffer: Any) -> Any:
frame = (
np.frombuffer(buffer, dtype=np.int32).reshape(256, 256, 3).astype(np.uint8)
)
self.original_obs.append(frame)
return frame
def _update_obs(self, frame: Any) -> Any:
if self.grayscale:
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
frame = cv2.resize(frame, (self.width, self.height), cv2.INTER_NEAREST)
if self.hide_points_banner:
frame[: self.points_banner_height, :] = 0
if self.grayscale:
self._obs = np.concatenate([self._obs[1:], frame[np.newaxis]])
else:
self._obs = np.transpose(frame, axes=(2, 0, 1))
def _init_game(self) -> MarioGame:
self.gateway = JavaGateway(
gateway_parameters=GatewayParameters(
port=self.port,
eager_load=True,
)
)
self.game = cast(MarioGame, cast(Any, self.gateway.jvm).engine.core.MarioGame())
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect(("localhost", self.game.getPort()))
self.game.initGame()
self.frame_size = self.game.getFrameSize()
return self.game
def _receive(self) -> ByteString:
frameBuffer = b""
while len(frameBuffer) != self.frame_size:
frameBuffer += self.socket.recv(self.frame_size)
return frameBuffer
def get_action_meanings(self) -> List[str]:
return ACTION_MEANING
def render_current_level(self) -> Image:
img_gen = LevelImageGen(
sprite_path=os.path.abspath(
os.path.join(os.path.dirname(__file__), "sprites")
)
)
return img_gen.render(self.levels[self.current_level_idx].split("\n"))
def seed(self, seed: Optional[int] = None) -> List[Any]:
self.np_random, seed = seeding.np_random(seed)
return [seed]
ACTION_MEANING = [
"NOOP",
"DOWN",
"RIGHT",
"RIGHTSPEED",
"RIGHTJUMP",
"RIGHTSPEEDJUMP",
"LEFT",
"LEFTJUMP",
"LEFTSPEEDJUMP",
"JUMP",
]
| 7,520 | 31.986842 | 88 | py |
null | CARL-main/carl/envs/mario/mario_game.py | from abc import ABC, abstractmethod
class MarioGame(ABC):
@abstractmethod
def getPort(self) -> int:
pass
@abstractmethod
def initGame(self) -> None:
pass
@abstractmethod
def stepGame(
self, left: bool, right: bool, down: bool, speed: bool, jump: bool
) -> None:
pass
@abstractmethod
def resetGame(
self, level: str, timer: int, mario_state: int, inertia: float
) -> None:
pass
@abstractmethod
def computeObservationRGB(self) -> None:
pass
@abstractmethod
def computeReward(self) -> float:
pass
@abstractmethod
def computeDone(self) -> bool:
pass
@abstractmethod
def getCompletionPercentage(self) -> float:
pass
@abstractmethod
def getFrameSize(self) -> int:
pass
| 841 | 18.136364 | 74 | py |
null | CARL-main/carl/envs/mario/reachabillity.py | from typing import List, Tuple
import numpy as np
horizontal = 10 # when sprinting Mario can jump over a 10 tiles gap horizontally
vertical = 4 # Mario can jump over a 4 tile wall
diagonal = (
6 # Mario can jump over 6 tiles to clear a 4 block height difference when sprinting
)
empty = "-"
ignored = ["M", "F", "|", "E", "g", "k", "r", "y", "G", "K", "R", "Y", "*", "B", "o"]
def remove_ignored(level: List[str]) -> Tuple[List, Tuple[int, int], Tuple[int, int]]:
"""
Replaces all ignored tokens with the empty token in a level. In case of Mario and the flag the coordinates of the
blocks below are returned and they are also replaced.
:param level: a level in ASCII form
:return: the level in ASCII form with the ignored tokens replaced and the coordinates of the block below Mario and
the flag if existing
"""
new_level = []
mario = (-1, -1)
flag = (-1, -1)
for i, row in enumerate(level):
mario_y = row.find("M")
if mario_y >= 0:
mario = (i + 1, mario_y)
flag_y = row.find("F")
if flag_y >= 0:
flag = (i + 1, flag_y)
for token in ignored:
row = row.replace(token, empty)
new_level.append(row)
return new_level, mario, flag
def reachability_map(
level: List[str],
shape: Tuple[int, int],
has_mario: bool = False,
has_flag: bool = False,
check_outside: bool = False,
) -> Tuple[np.ndarray, bool]:
"""
This creates a numpy 2D array containing the reachability map for a given ASCII-Level.
Every solid block will have a 1 if Mario can stand on it and can reach the tile and a 0 else.
Currently ignoring sprint.
Levels are generated without Mario and the flag and as such the algorithm is not including these.
:param level: The level (slice) as a list containing the ASCII strings of each level row
:param shape: The level shape
:param has_mario: As levels are expected to be generated without Mario, this option has to be set to search for
Mario as a starting point
:param has_flag: As levels are expected to be generated without the flag, this option has to be set to determine
playability via reaching the flag
:param check_outside: If this option is set, playability will check if the player can reach the outside
:return: A numpy array where a 0 indicates an unreachable block and a 1 denotes a reachable block;
a boolean indicating if the level can be finished by the player
"""
level, mario, flag = remove_ignored(level)
reachability_map = np.zeros(shape=shape)
index_queue = []
# find the starting point, either the block Mario is standing on or the first solid block Mario could stand on
found_first = False
if has_mario:
index_queue.append(mario)
else:
for i in range(shape[0] - 1, 0, -1): # start from the bottom of the level
for j in range(0, shape[1]):
tile = level[i][j]
if (
tile != empty
and (
reachability_map[i][j] == 1
or not found_first
and i < shape[0] - 1
)
and i > 0
and level[i - 1][j] == empty
):
found, queue, _ = mark(level, reachability_map, i, j)
index_queue.extend(queue)
if not found_first:
found_first = found
break
if found_first:
break
# calculate all reachable positions by applying a BFS type of algorithm
outside = False
while len(index_queue) > 0:
index = index_queue.pop()
_, queue, reached_outside = mark(
level, reachability_map, index[0], index[1], check_outside=check_outside
)
if reached_outside:
outside = True
index_queue.extend(queue)
# a level is playable if either the flag is reachable or if no flag is included, the rightmost side can be reached
# Bug: if the level ends with a gap, it might be playable but still wouldn't count as such
playable = False
if has_flag:
if reachability_map[flag[0]][flag[1]]:
playable = True
else:
# look at all tiles in the last column
for i in range(1, shape[0]):
if reachability_map[shape[0] - i][shape[1] - 1]:
playable = True
break
if not playable and check_outside:
# Assumption is that reaching the outside is identical to completing the level
if outside:
playable = True
return reachability_map, playable
def check_blocked(
level: List[str], i: int, j: int, dh: int, dv: int, right: bool
) -> int:
"""
Checks for a given position, level and direction if a blockade exists in the range specified by dh and dv.
:param level: The level in ASCII form
:param i: x coordinate of the starting position
:param j: y coordinate of the starting position
:param dh: amount of blocks in the horizontal direction from the starting point the algorithm tries to jump
:param dv: amount of blocks in the vertical direction from the starting point the algorithm tries to jump
:param right: direction of the jump
:return: the blockade y value if a blockade is found, default max value otherwise
"""
blocked = horizontal + 1 # default value
boundary = j + dh if right else j - dh
try:
if level[i - dv][boundary] != empty:
height = 1 + dv
while height < vertical + 1:
v = i - dv - height
if v < 0:
# over maximum level height, cannot pass
blocked = dh
break
if level[v][boundary] != empty or dh + height > 10:
height += 1
else:
break
if height == vertical + 1:
blocked = dh
except IndexError:
# over maximum level height, cannot pass
blocked = dh
return blocked
def check_down(
level: List[str],
map: np.ndarray,
i: int,
j: int,
dh: int,
check_outside: bool,
right: bool,
) -> Tuple[bool, bool, List[Tuple[int, int]]]:
drop = 1
found_first = False
reach_outside = False
found = []
boundary = j + dh if right else j - dh
if boundary > map.shape[1] - 1:
if check_outside:
reach_outside = True
else:
y = min(max(boundary, 0), map.shape[1] - 1)
while i + drop < map.shape[0]:
# right and down
x = i + drop
above = x - 1
if (
level[x][y] != empty
and above >= 0
and level[above][y] == empty
and map[x][y] != 1
):
map[x][y] = 1
found.append((x, y))
found_first = True
break
drop += 1
return found_first, reach_outside, found
def mark(
level: List[str],
reachability_map: np.ndarray,
i: int,
j: int,
check_outside: bool = False,
) -> Tuple[bool, List[Tuple[int, int]], bool]:
"""
For a given position and a level this will mark all tiles reachable from the given position and collect all
these positions for further use.
:param level: The level (slice) as a list containing the ASCII strings of each level row
:param map: The current reachability map where the reachable tiles will be marked
:param i: x coordinate
:param j: y coordinate
:param check_outside: if the algorithm should indicate that the player can reach the right outside of the level
:return: A boolean indicating if any tile can be reached from this position, a list of all reachable positions and
if the outside can be reached
"""
found_first = False
reach_outside = False
found = []
blocked_level = vertical + 1
blocked_right = horizontal + 1
blocked_left = horizontal + 1
blocked_down_right = horizontal + 1
blocked_down_left = horizontal + 1
# mark diagonally
for dh in range(0, horizontal + 1):
# check down as far as possible, Mario can fall down the whole level until he hits a solid block
if blocked_down_right == horizontal + 1:
blocked_down_right = check_blocked(level, i, j, dh, 0, right=True)
if blocked_down_right >= dh:
found_rechable, found_outside, positions = check_down(
level, reachability_map, i, j, dh, check_outside, right=True
)
if found_rechable:
found_first = True
if found_outside:
reach_outside = True
found.extend(positions)
if blocked_down_left == horizontal + 1:
blocked_down_left = check_blocked(level, i, j, dh, 0, right=False)
if blocked_down_left >= dh:
found_rechable, found_outside, positions = check_down(
level, reachability_map, i, j, dh, check_outside, right=False
)
if found_rechable:
found_first = True
if found_outside:
reach_outside = True
found.extend(positions)
for dv in range(0, vertical + 1):
if dh != 0 or dv != 0:
if dv >= blocked_level:
break
# check if vertical path is blocked
if dh == 0:
if level[i - dv][j] != empty:
blocked_level = dv
continue
# check if horizontal right path is blocked
if blocked_right == horizontal + 1:
blocked_right = check_blocked(level, i, j, dh, dv, right=True)
if dh <= blocked_right and dh + dv <= 10:
# right and up
x = min(max(i - dv, 0), reachability_map.shape[0] - 1)
right = j + dh
if right > reachability_map.shape[1] - 1 and check_outside:
reach_outside = True
y = min(max(right, 0), reachability_map.shape[1] - 1)
above = x - 1
if (
level[x][y] != empty
and above >= 0
and level[above][y] == empty
and reachability_map[x][y] != 1
):
reachability_map[x][y] = 1
found.append((x, y))
found_first = True
# check if horizontal left path is blocked
if blocked_left == horizontal + 1:
blocked_left = check_blocked(level, i, j, dh, dv, right=False)
if dh <= blocked_left and dh + dv <= 10:
# left and up
x = min(max(i - dv, 0), reachability_map.shape[0] - 1)
y = min(max(j - dh, 0), reachability_map.shape[1] - 1)
above = x - 1
if (
level[x][y] != empty
and above >= 0
and level[above][y] == empty
and reachability_map[x][y] != 1
):
reachability_map[x][y] = 1
found.append((x, y))
found_first = True
return found_first, found, reach_outside
| 11,693 | 36.722581 | 118 | py |
null | CARL-main/carl/envs/mario/toad_gan.py | from typing import Optional
import functools
import os
import sys
from dataclasses import dataclass
import torch
from torch import Tensor
from carl.envs.mario.generate_sample import generate_sample, generate_spatial_noise
from carl.envs.mario.reachabillity import reachability_map
@dataclass
class TOADGAN:
def __init__(
self,
Gs: Tensor,
Zs: Tensor,
reals: Tensor,
NoiseAmp: Tensor,
token_list: Tensor,
num_layers: int,
):
self.generators = Gs
self.noise_maps = Zs
self.reals = reals
self.noise_amplitudes = NoiseAmp
self.token_list = token_list
self.num_layer = num_layers
@property
def original_height(self) -> int:
return self.reals[-1].shape[-2]
@property
def original_width(self) -> int:
return self.reals[-1].shape[-1]
GENERATOR_DIR = os.path.abspath(
os.path.join(os.path.dirname(__file__), "TOAD-GUI", "generators", "v2")
)
GENERATOR_PATHS = sorted(
os.listdir(GENERATOR_DIR),
key=lambda name: [int(index) for index in name.replace("TOAD_GAN_", "").split("-")],
)
@functools.lru_cache(maxsize=None)
def load_generator(level_index: int) -> TOADGAN:
import carl.envs.mario.models as models
sys.modules["models"] = models
gen_path = os.path.join(GENERATOR_DIR, GENERATOR_PATHS[level_index])
reals = torch.load(
"%s/reals.pth" % gen_path,
map_location="cuda:0" if torch.cuda.is_available() else "cpu",
)
Zs = torch.load(
"%s/noise_maps.pth" % gen_path,
map_location="cuda:0" if torch.cuda.is_available() else "cpu",
)
NoiseAmp = torch.load(
"%s/noise_amplitudes.pth" % gen_path,
map_location="cuda:0" if torch.cuda.is_available() else "cpu",
)
token_list = torch.load("%s/token_list.pth" % gen_path)
num_layers = torch.load("%s/num_layer.pth" % gen_path)
Gs = torch.load(
"%s/generators.pth" % gen_path,
map_location="cuda:0" if torch.cuda.is_available() else "cpu",
)
return TOADGAN(
Gs=Gs,
Zs=Zs,
reals=reals,
NoiseAmp=NoiseAmp,
num_layers=num_layers,
token_list=token_list,
)
def generate_level(
width: int,
height: int,
level_index: int,
initial_noise: Optional[torch.Tensor] = None,
filter_unplayable: bool = True,
) -> str:
toad_gan = load_generator(level_index)
playable = False
level = None
tries = 0
while not playable:
tries += 1
level = generate_sample(
**vars(toad_gan),
scale_h=width / toad_gan.original_width,
scale_v=height / toad_gan.original_height,
initial_noise=initial_noise,
)
if filter_unplayable and tries < 100:
_, playable = reachability_map(
level, shape=(height, width), check_outside=True
)
else:
playable = True
assert level
return "".join(level)
def generate_initial_noise(width: int, height: int, level_index: int) -> Tensor:
toad_gan = load_generator(level_index)
base_noise_map = toad_gan.noise_maps[0]
nzx = (
(base_noise_map.shape[2] - 2 * toad_gan.num_layer)
* height
/ toad_gan.original_height
)
nzy = (
(base_noise_map.shape[3] - 2 * toad_gan.num_layer)
* width
/ toad_gan.original_width
)
noise_shape = (1, len(toad_gan.token_list), int(round(nzx)), int(round(nzy)))
noise = generate_spatial_noise(noise_shape)
return noise
| 3,584 | 26.576923 | 88 | py |
null | CARL-main/carl/envs/mario/utils.py | from typing import Tuple
import atexit
import os
import socket
import sys
from contextlib import closing
from py4j.java_gateway import JavaGateway
from xvfbwrapper import Xvfb
MARIO_AI_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), "Mario-AI-Framework")
)
_gateway = None
_port = None
def find_free_port() -> int:
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
s.bind(("", 0))
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
return s.getsockname()[1]
def load_level(level_name: str = "lvl-1.txt") -> str:
prefix = (
os.path.join(MARIO_AI_PATH, "levels", "original")
if level_name.startswith("lvl-")
else ""
)
with open(os.path.join(prefix, level_name), "r") as f:
level = f.read()
return level
def get_port() -> int:
global _gateway
global _port
if _gateway is None:
_gateway, _port = launch_gateway()
return _port
def launch_gateway() -> Tuple[JavaGateway, int]:
vdisplay = Xvfb(width=1280, height=740, colordepth=16)
vdisplay.start()
atexit.register(lambda: vdisplay.stop())
free_port = find_free_port()
return (
JavaGateway.launch_gateway(
classpath=os.path.join(MARIO_AI_PATH, "carl"),
redirect_stderr=sys.stderr,
redirect_stdout=sys.stdout,
die_on_exit=True,
port=free_port,
),
free_port,
)
| 1,467 | 23.466667 | 73 | py |
null | CARL-main/carl/envs/mario/models/__init__.py | 0 | 0 | 0 | py |
|
null | CARL-main/carl/envs/mario/models/conv_block.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from typing import Tuple, Union
import torch.nn as nn
class ConvBlock(nn.Sequential):
"""Conv block containing Conv2d, BatchNorm2d and LeakyReLU Layers."""
def __init__(
self,
in_channel: int,
out_channel: int,
ker_size: Union[int, Tuple[int, int]],
padd: Union[str, Union[int, Tuple[int, int]]],
stride: Union[int, Tuple[int, int]],
):
super().__init__()
self.add_module(
"conv",
nn.Conv2d(
in_channel,
out_channel,
kernel_size=ker_size,
stride=stride,
padding=padd,
),
)
self.add_module("norm", nn.BatchNorm2d(out_channel))
self.add_module("LeakyRelu", nn.LeakyReLU(0.2, inplace=True))
| 858 | 25.84375 | 73 | py |
null | CARL-main/carl/envs/mario/models/discriminator.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from argparse import Namespace
import torch
import torch.nn as nn
from torch import Tensor
from .conv_block import ConvBlock
class Level_WDiscriminator(nn.Module):
"""Patch based Discriminator. Uses Namespace opt."""
def __init__(self, opt: Namespace):
super().__init__()
self.is_cuda = torch.cuda.is_available()
N = int(opt.nfc)
self.head = ConvBlock(opt.nc_current, N, (3, 3), opt.padd_size, 1)
self.body = nn.Sequential()
for i in range(opt.num_layer - 2):
block = ConvBlock(N, N, (3, 3), opt.padd_size, 1)
self.body.add_module("block%d" % (i + 1), block)
block = ConvBlock(N, N, (3, 3), opt.padd_size, 1)
self.body.add_module("block%d" % (opt.num_layer - 2), block)
self.tail = nn.Conv2d(N, 1, kernel_size=(3, 3), stride=1, padding=opt.padd_size)
def forward(self, x: Tensor) -> Tensor:
x = self.head(x)
x = self.body(x)
x = self.tail(x)
return x
| 1,049 | 29 | 88 | py |
null | CARL-main/carl/envs/mario/models/generator.py | # Code from https://github.com/Mawiszus/TOAD-GAN
from argparse import Namespace
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from .conv_block import ConvBlock
class Level_GeneratorConcatSkip2CleanAdd(nn.Module):
"""Patch based Generator. Uses namespace opt."""
def __init__(self, opt: Namespace):
super().__init__()
self.is_cuda = torch.cuda.is_available()
N = int(opt.nfc)
self.head = ConvBlock(opt.nc_current, N, (3, 3), opt.padd_size, 1)
self.body = nn.Sequential()
for i in range(opt.num_layer - 2):
block = ConvBlock(N, N, (3, 3), opt.padd_size, 1)
self.body.add_module("block%d" % (i + 1), block)
block = ConvBlock(N, N, (3, 3), opt.padd_size, 1)
self.body.add_module("block%d" % (opt.num_layer - 2), block)
self.tail = nn.Sequential(
nn.Conv2d(
N, opt.nc_current, kernel_size=(3, 3), stride=1, padding=opt.padd_size
),
)
def forward(self, x: Tensor, y: Tensor, temperature: float = 1) -> Tensor:
x = self.head(x)
x = self.body(x)
x = self.tail(x)
x = F.softmax(
x * temperature, dim=1
) # Softmax is added here to allow for the temperature parameter
ind = int((y.shape[2] - x.shape[2]) / 2)
y = y[:, :, ind : (y.shape[2] - ind), ind : (y.shape[3] - ind)]
return x + y
| 1,464 | 31.555556 | 86 | py |
null | CARL-main/carl/envs/mario/sprites/README.md | ## Notice
This folder contains the sprite images from https://github.com/amidos2006/Mario-AI-Framework/tree/master/img.
They are necessary for the Mario-AI-Framework and our level preview renderer. | 198 | 48.75 | 109 | md |
null | CARL-main/carl/envs/rna/__init__.py | # flake8: noqa: F401
# isort: skip_file
try:
from carl.envs.rna.carl_rna import CARLRnaDesignEnv
from carl.envs.rna.carl_rna_definitions import (
DEFAULT_CONTEXT as CARLRnaDesignEnv_defaults,
CONTEXT_BOUNDS as CARLRnaDesignEnv_bounds,
)
except Exception as e:
print(e)
| 301 | 26.454545 | 55 | py |
null | CARL-main/carl/envs/rna/carl_rna.py | # pylint: disable=missing-module-docstring # isort: skip_file
from typing import Optional, Dict, Union, List, Tuple, Any
import numpy as np
import gym
from carl.envs.carl_env import CARLEnv
from carl.envs.rna.parse_dot_brackets import parse_dot_brackets
from carl.envs.rna.rna_environment import (
RnaDesignEnvironment,
RnaDesignEnvironmentConfig,
)
from carl.utils.trial_logger import TrialLogger
from carl.envs.rna.carl_rna_definitions import (
DEFAULT_CONTEXT,
ACTION_SPACE,
OBSERVATION_SPACE,
CONTEXT_BOUNDS,
)
from carl.utils.types import Context, Contexts
from carl.context.selection import AbstractSelector
class CARLRnaDesignEnv(CARLEnv):
def __init__(
self,
env: gym.Env = None,
data_location: str = "carl/envs/rna/learna/data",
contexts: Contexts = {},
hide_context: bool = False,
add_gaussian_noise_to_context: bool = False,
gaussian_noise_std_percentage: float = 0.01,
logger: Optional[TrialLogger] = None,
scale_context_features: str = "no",
default_context: Optional[Context] = DEFAULT_CONTEXT,
max_episode_length: int = 500,
state_context_features: Optional[List[str]] = None,
context_mask: Optional[List[str]] = None,
dict_observation_space: bool = False,
context_selector: Optional[
Union[AbstractSelector, type[AbstractSelector]]
] = None,
context_selector_kwargs: Optional[Dict] = None,
obs_low: Optional[int] = 11,
obs_high: Optional[int] = 11,
):
"""
Parameters
----------
env: gym.Env, optional
Defaults to classic control environment mountain car from gym (MountainCarEnv).
contexts: List[Dict], optional
Different contexts / different environment parameter settings.
instance_mode: str, optional
"""
if not contexts:
contexts = {0: DEFAULT_CONTEXT}
if env is None:
env_config = RnaDesignEnvironmentConfig(
mutation_threshold=DEFAULT_CONTEXT["mutation_threshold"],
reward_exponent=DEFAULT_CONTEXT["reward_exponent"],
state_radius=DEFAULT_CONTEXT["state_radius"],
)
dot_brackets = parse_dot_brackets(
dataset=DEFAULT_CONTEXT["dataset"], # type: ignore[arg-type]
data_dir=data_location,
target_structure_ids=DEFAULT_CONTEXT["target_structure_ids"], # type: ignore[arg-type]
)
env = RnaDesignEnvironment(dot_brackets, env_config)
env.action_space = ACTION_SPACE
env.observation_space = OBSERVATION_SPACE
env.reward_range = (-np.inf, np.inf)
env.metadata = {}
# The data_location in the RNA env refers to the place where the dataset is downloaded to, so it is not changed
# with the context.
env.data_location = data_location
super().__init__(
env=env,
contexts=contexts,
hide_context=hide_context,
add_gaussian_noise_to_context=add_gaussian_noise_to_context,
gaussian_noise_std_percentage=gaussian_noise_std_percentage,
logger=logger,
scale_context_features=scale_context_features,
default_context=default_context,
max_episode_length=max_episode_length,
state_context_features=state_context_features,
dict_observation_space=dict_observation_space,
context_selector=context_selector,
context_selector_kwargs=context_selector_kwargs,
context_mask=context_mask,
)
self.whitelist_gaussian_noise = list(DEFAULT_CONTEXT)
self.obs_low = obs_low
self.obs_high = obs_high
def step(self, action: np.ndarray) -> Tuple[List[int], float, Any, Any]:
# Step function has a different name in this env
state, reward, done = self.env.execute(action) # type: ignore[has-type]
self.step_counter += 1
return state, reward, done, {}
def _update_context(self) -> None:
dot_brackets = parse_dot_brackets(
dataset=self.context["dataset"],
data_dir=self.env.data_location, # type: ignore[has-type]
target_structure_ids=self.context["target_structure_ids"],
)
env_config = RnaDesignEnvironmentConfig(
mutation_threshold=self.context["mutation_threshold"],
reward_exponent=self.context["reward_exponent"],
state_radius=self.context["state_radius"],
)
self.env = RnaDesignEnvironment(dot_brackets, env_config)
self.build_observation_space(
env_lower_bounds=-np.inf * np.ones(self.obs_low),
env_upper_bounds=np.inf * np.ones(self.obs_high),
context_bounds=CONTEXT_BOUNDS, # type: ignore[arg-type]
)
| 4,929 | 40.083333 | 119 | py |
null | CARL-main/carl/envs/rna/carl_rna_definitions.py | import numpy as np
from gym import spaces
DEFAULT_CONTEXT = {
"mutation_threshold": 5,
"reward_exponent": 1,
"state_radius": 5,
"dataset": "eterna",
"target_structure_ids": None,
}
CONTEXT_BOUNDS = {
"mutation_threshold": (0.1, np.inf, float),
"reward_exponent": (0.1, np.inf, float),
"state_radius": (1, np.inf, float),
"dataset": ("eterna", "rfam_taneda", None),
"target_structure_ids": (
0,
np.inf,
[list, int],
), # This is conditional on the dataset (and also a list)
}
ACTION_SPACE = spaces.Discrete(4)
OBSERVATION_SPACE = spaces.Box(low=-np.inf * np.ones(11), high=np.inf * np.ones(11))
| 664 | 26.708333 | 84 | py |
null | CARL-main/carl/envs/rna/parse_dot_brackets.py | # flake8: noqa: F401
# isort: skip_file
from pathlib import Path
from typing import List, Optional, Union, Generator
def parse_dot_brackets(
dataset: str,
data_dir: str,
target_structure_ids: Optional[List[int]] = None,
target_structure_path: Optional[Union[str, Path]] = None,
) -> List[str]:
"""Generate the targets for next epoch.
Parameters
----------
dataset : str
The name of the benchmark to use targets from
data_dir : str
The directory of the target structures.
target_structure_ids : Optional[Union[List[int], int]], optional
Use specific targets by ids., by default None
target_structure_path : Optional[str], optional
pecify a path to the targets., by default None
Returns
-------
Generator[int]
An epoch generator for the specified target structures.
"""
if target_structure_path:
target_paths = [target_structure_path]
elif target_structure_ids:
target_paths = [
Path(data_dir, dataset, f"{id_}.rna") for id_ in target_structure_ids
]
else:
target_paths = list(Path(data_dir, dataset).glob("*.rna"))
return [data_path.read_text().rstrip() for data_path in target_paths] # type: ignore[union-attr]
| 1,278 | 29.452381 | 101 | py |
null | CARL-main/carl/envs/rna/readme.md | # **CARL RNA Environment**
This is the CARL RNA environment that has been adapted from the [Learning to Design RNA](https://openreview.net/pdf?id=ByfyHh05tQ) by Runge et. al. The code has been adapted from [https://github.com/automl/learna](https://github.com/automl/learna) with a carl wrapper written around the envionment.
## Datasets
To download and build the datasets we report on in our publications, namely the Rfam-Taneda [[Taneda, 2011]](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3169953/pdf/aabc-4-001.pdf) dataset and our three proposed datasets, Rfam-Learn-Train, Rfam-Learn-Validation and Rfam-Learn-Test, run the following command after installation of all requirements.
```
cd data
./download_and_build_rfam_learn.sh
./download_and_build_rfam_taneda.sh
```
This will download all files and save them into the `data/` directory. | 851 | 64.538462 | 349 | md |
null | CARL-main/carl/envs/rna/rna_environment.py | # isort: skip_file
"""
Code adapted from https://github.com/automl/learna
"""
import time
from itertools import product
from dataclasses import dataclass
from distance import hamming
import numpy as np
from RNA import fold
import gym
from typing import Any, List
@dataclass
class RnaDesignEnvironmentConfig:
"""
Dataclass for the configuration of the environment.
Parameters
----------
mutation_threshold:
Defines the minimum distance needed before applying the local
improvement step.
reward_exponent:
A parameter to shape the reward function.
state_radius:
The state representation is a (2*<state_radius> + 1)-gram
at each position.
use_conv:
Bool to state if a convolutional network is used or not.
use_embedding:
Bool to state if embedding is used or not.
"""
mutation_threshold: Any = 5
reward_exponent: Any = 1.0
state_radius: Any = 5
use_conv: bool = True
use_embedding: bool = False
def _string_difference_indices(s1, s2): # type: ignore[no-untyped-def]
"""
Returns all indices where s1 and s2 differ.
Parameters
----------
s1:
The first sequence.
s2:
The second sequence.
Returns
-------
List of indices where s1 and s2 differ.
"""
return [index for index in range(len(s1)) if s1[index] != s2[index]]
def _encode_dot_bracket( # type: ignore[no-untyped-def]
secondary: str, env_config: RnaDesignEnvironmentConfig
): # type: ignore[no-untyped-def]
"""
Encode the dot_bracket notated target structure. The encoding can either be binary
or by the embedding layer.
Parameters
----------
secondary:
The target structure in dot_bracket notation.
env_config:
The configuration of the environment.
Returns
-------
List of encoding for each site of the padded target structure.
"""
padding = "=" * env_config.state_radius
padded_secondary = padding + secondary + padding
if env_config.use_embedding:
site_encoding = {".": 0, "(": 1, ")": 2, "=": 3}
else:
site_encoding = {".": 0, "(": 1, ")": 1, "=": 0}
# Sites corresponds to 1 pixel with 1 channel if convs are applied directly
if env_config.use_conv and not env_config.use_embedding:
return [[site_encoding[site]] for site in padded_secondary]
return [site_encoding[site] for site in padded_secondary]
def _encode_pairing(secondary: str): # type: ignore[no-untyped-def]
pairing_encoding = [None] * len(secondary)
stack = []
for index, symbol in enumerate(secondary, 0):
if symbol == "(":
stack.append(index)
elif symbol == ")":
paired_site = stack.pop()
pairing_encoding[paired_site] = index # type: ignore[no-untyped-def,call-overload]
pairing_encoding[index] = paired_site # type: ignore[call-overload]
return pairing_encoding
class _Target(object):
"""
Class of the target structure. Provides encodings and id.
"""
_id_counter = 0
def __init__(self, dot_bracket, env_config): # type: ignore[no-untyped-def]
"""
Initialize a target structure.
Parameters
----------
dot_bracket:
dot_bracket encoded target structure.
env_config:
The environment configuration.
"""
_Target._id_counter += 1
self.id = _Target._id_counter # For processing results
self.dot_bracket = dot_bracket
self._pairing_encoding = _encode_pairing(self.dot_bracket)
self.padded_encoding = _encode_dot_bracket(self.dot_bracket, env_config)
def __len__(self): # type: ignore[no-untyped-def]
return len(self.dot_bracket)
def get_paired_site(self, site): # type: ignore[no-untyped-def]
"""
Get the paired site for <site> (base pair).
Args:
site: The site to check the pairing site for.
Returns:
The site that pairs with <site> if exists.
"""
return self._pairing_encoding[site]
class _Design(object):
"""
Class of the designed candidate solution.
"""
action_to_base = {0: "G", 1: "A", 2: "U", 3: "C"}
action_to_pair = {0: "GC", 1: "CG", 2: "AU", 3: "UA"}
def __init__(self, length=None, primary=None): # type: ignore[no-untyped-def]
"""
Initialize a candidate solution.
Parameters
----------
length:
The length of the candidate solution.
primary:
The sequence of the candidate solution.
"""
if primary:
self._primary_list = primary
else:
self._primary_list = [None] * length
self._dot_bracket = None
self._current_site = 0
def get_mutated(self, mutations, sites): # type: ignore[no-untyped-def]
"""
Locally change the candidate solution.
Parameters
----------
mutations:
Possible mutations for the specified sites
sites:
The sites to be mutated
Returns
-------
A Design object with the mutated candidate solution.
"""
mutatedprimary = self._primary_list.copy()
for site, mutation in zip(sites, mutations):
mutatedprimary[site] = mutation
return _Design(primary=mutatedprimary)
def assign_sites( # type: ignore[no-untyped-def]
self, action, site, paired_site=None
): # type: ignore[no-untyped-def]
"""
Assign nucleotides to sites for designing a candidate solution.
Parameters
----------
action:
The agents action to assign a nucleotide.
site:
The site to which the nucleotide is assigned to.
paired_site:
Defines if the site is assigned with a base pair or not.
"""
self._current_site += 1
if paired_site:
base_current, base_paired = self.action_to_pair[action]
self._primary_list[site] = base_current
self._primary_list[paired_site] = base_paired
else:
self._primary_list[site] = self.action_to_base[action]
@property
def first_unassigned_site(self): # type: ignore[no-untyped-def]
try:
while self._primary_list[self._current_site] is not None:
self._current_site += 1
return self._current_site
except IndexError:
return None
@property
def primary(self): # type: ignore[no-untyped-def]
return "".join(self._primary_list)
def _random_epoch_gen(data): # type: ignore[no-untyped-def]
"""
Generator to get epoch data.
Parameters
----------
data:
The targets of the epoch
"""
while True:
for i in np.random.permutation(len(data)):
yield data[i]
@dataclass
class EpisodeInfo:
"""
Information class.
"""
__slots__ = ["target_id", "time", "normalized_hamming_distance"]
target_id: int
time: float
normalized_hamming_distance: float
class RnaDesignEnvironment(gym.Env):
"""
The environment for RNA design using deep reinforcement learning.
"""
def __init__( # type: ignore[no-untyped-def]
self, dot_brackets: List[str], env_config
): # type: ignore[no-untyped-def]
"""Initialize the environment
Args
dot_brackets : dot_bracket encoded target structure
env_config : The environment configuration.
"""
self._env_config = env_config
targets = [
_Target(dot_bracket, self._env_config) for dot_bracket in dot_brackets
]
self._target_gen = _random_epoch_gen(targets)
self.target = None
self.design = None
self.episodes_info = [] # type: ignore[var-annotated]
def __str__(self): # type: ignore[no-untyped-def]
return "RnaDesignEnvironment"
def seed(self, seed): # type: ignore[no-untyped-def]
return None
def reset(self): # type: ignore[no-untyped-def]
"""
Reset the environment. First function called by runner. Returns first state.
Returns:
The first state.
"""
self.target = next(self._target_gen)
self.design = _Design(len(self.target))
return self._get_state()
def _apply_action(self, action): # type: ignore[no-untyped-def]
"""
Assign a nucleotide to a site.
Args:
action: The action chosen by the agent.
"""
current_site = self.design.first_unassigned_site
paired_site = self.target.get_paired_site(
current_site
) # None for unpaired sites
self.design.assign_sites(action, current_site, paired_site)
def _get_state(self): # type: ignore[no-untyped-def]
"""
Get a state dependend on the padded encoding of the target structure.
Returns:
The next state.
"""
start = self.design.first_unassigned_site
return self.target.padded_encoding[
start : start + 2 * self._env_config.state_radius + 1
]
def _local_improvement(self, folded_design): # type: ignore[no-untyped-def]
"""
Compute Hamming distance of locally improved candidate solutions.
Agrs
folded_design: The folded candidate solution.
Returns:
The minimum Hamming distance of all imporved candidate solutions.
"""
differing_sites = _string_difference_indices(
self.target.dot_bracket, folded_design
)
hamming_distances = []
for mutation in product("AGCU", repeat=len(differing_sites)):
mutated = self.design.get_mutated(mutation, differing_sites)
folded_mutated, _ = fold(mutated.primary)
hamming_distance = hamming(folded_mutated, self.target.dot_bracket)
hamming_distances.append(hamming_distance)
if hamming_distance == 0: # For better timing results
return 0
return min(hamming_distances)
def _get_reward(self, terminal): # type: ignore[no-untyped-def]
"""
Compute the reward after assignment of all nucleotides.
Args:
terminal: Bool defining if final timestep is reached yet.
Returns:
The reward at the terminal timestep or 0 if not at the terminal timestep.
"""
if not terminal:
return 0
folded_design, _ = fold(self.design.primary)
hamming_distance = hamming(folded_design, self.target.dot_bracket)
if 0 < hamming_distance < self._env_config.mutation_threshold:
hamming_distance = self._local_improvement(folded_design)
normalized_hamming_distance = hamming_distance / len(self.target)
# For hparam optimization
episode_info = EpisodeInfo(
target_id=self.target.id,
time=time.time(),
normalized_hamming_distance=normalized_hamming_distance,
)
self.episodes_info.append(episode_info)
return (1 - normalized_hamming_distance) ** self._env_config.reward_exponent
def execute(self, actions): # type: ignore[no-untyped-def]
"""
Execute one interaction of the environment with the agent.
Args:
action: Current action of the agent.
Returns:
state: The next state for the agent.
terminal: The signal for end of an episode.
reward: The reward if at terminal timestep, else 0.
"""
self._apply_action(actions)
terminal = self.design.first_unassigned_site is None
state = None if terminal else self._get_state()
reward = self._get_reward(terminal)
return state, terminal, reward
def close(self): # type: ignore[no-untyped-def]
pass
@property
def states(self): # type: ignore[no-untyped-def]
type = "int" if self._env_config.use_embedding else "float"
if self._env_config.use_conv and not self._env_config.use_embedding:
return dict(type=type, shape=(1 + 2 * self._env_config.state_radius, 1))
return dict(type=type, shape=(1 + 2 * self._env_config.state_radius,))
@property
def actions(self): # type: ignore[no-untyped-def]
return dict(type="int", num_actions=4)
| 12,643 | 29.46747 | 95 | py |
null | CARL-main/carl/envs/rna/data/download_and_build_eterna.py | # flake8: noqa: F401
# # isort: skip_file
from urllib.request import Request
from tqdm import tqdm
import requests # type: ignore[import]
def _download_dataset_from_http(url: str, download_path: str) -> None:
"""Donwload the dataset from a given url
Parameters
----------
url : string
URL for the dataset location
download_path : str
Location of storing the dataset
"""
response = requests.get(url, stream=True)
with open(download_path, "wb+") as dataset_file:
progress_bar = tqdm(
unit="B",
unit_scale=True,
unit_divisor=1024,
total=int(response.headers["Content-Length"]),
)
for data in tqdm(response.iter_content()):
progress_bar.update(len(data))
dataset_file.write(data)
def download_eterna(download_path: str) -> None:
eterna_url = (
"https://ars.els-cdn.com/content/image/1-s2.0-S0022283615006567-mmc5.txt"
)
_download_dataset_from_http(eterna_url, download_path)
def extract_secondarys(download_path: str, dump_path: str) -> None:
"""Download secondary information/features
Parameters
----------
download_path : str
path to downloaded files
dump_path : str
path to dump secondary features
"""
with open(download_path) as input:
parsed = list(zip(*(line.strip().split("\t") for line in input)))
secondarys = parsed[4][1:]
with open(dump_path, "w") as data_file:
for structure in secondarys:
if structure[-1] == "_": # Weird dataset bug
structure = structure[:-1]
data_file.write(f"{structure}\n")
if __name__ == "__main__":
download_path = f'{"data/eterna/raw/eterna_raw.txt"}'
dump_path = f'{"data/eterna/interim/eterna.txt"}'
download_eterna(download_path)
extract_secondarys(download_path, dump_path)
| 1,914 | 28.015152 | 81 | py |
null | CARL-main/carl/envs/rna/data/download_and_build_rfam_learn.sh | #!/usr/bin/env bash
# So far RNA has been tested only on linux systems
mkdir -p data/rfam_learn/{raw,test,train,validation}
cd data/
wget https://www.dropbox.com/s/cfhnkzdx4ciy7zf/rfam_learn.tar.gz?dl=1 -O rfam_learn.tar.gz
tar xf rfam_learn.tar.gz
rm -f rfam_learn.tar.gz | 274 | 29.555556 | 90 | sh |
null | CARL-main/carl/envs/rna/data/download_and_build_rfam_taneda.sh | # So far RNA has been tested only on linux systems
cd data/
mkdir rfam_taneda
cd rfam_taneda
wget rna.eit.hirosaki-u.ac.jp/modena/v0028/linux/modena.dataset.tar.gz
tar -xf modena.dataset.tar.gz
rm -f modena.dataset.tar.gz
rm -rf ct_version
i=1
while [[ i -le 30 ]]; do
if [ $i == 23 ]; then
:
elif [[ $i -le 9 ]]; then
cat RF0000$i* > $i.rna;
elif [[ $i -le 22 ]]; then
cat RF000$i* > $i.rna;
else
cat RF000$i* > $(($i - 1)).rna;
fi
let i=$i+1;
done
rm -f *.ss | 510 | 16.62069 | 70 | sh |
null | CARL-main/carl/envs/rna/data/parse_dot_brackets.py | # flake8: noqa: F401
# isort: skip_file
from email.generator import Generator
from pathlib import Path
from typing import List
def parse_dot_brackets(
dataset: str,
data_dir: str,
target_structure_ids: List[int] = None,
target_structure_path: Path = None,
) -> List[str]:
"""Generate the targets for next epoch.
The most common encoding for the RNA secondary structure is the dot-bracket
notation, consisting in a balanced parentheses string composed by a
three-character alphabet {.,(,)}, that can be unambiguously converted
in the RNA secondary structure.
Parameters
----------
dataset: str
The name of the benchmark to use targets from
data_dir: str
The directory of the target structures.
target_structure_ids: List[int]
Use specific targets by ids.
target_structure_path: str
Specify a path to the targets
Returns
-------
List[str]
An epoch generator for the specified target structure(s)
"""
if target_structure_path:
target_paths = [target_structure_path]
elif target_structure_ids:
target_paths = [
Path(data_dir, dataset, f"{id_}.rna") for id_ in target_structure_ids
]
else:
target_paths = list(Path(data_dir, dataset).glob("*.rna"))
return [data_path.read_text().rstrip() for data_path in target_paths]
| 1,399 | 27 | 81 | py |
null | CARL-main/carl/envs/rna/data/secondaries_to_single_files.sh | # So far RNA has been tested only on linux systems
DATAPATH=$1
SECONDARY_FILE=$2
NUM_SECONDARIES=$(cat $SECONDARY_FILE | wc -l )
i=1;
while [[ i -le $NUM_SECONDARIES ]];
do awk "NR==$i{print;exit}" $SECONDARY_FILE > $DATAPATH/$i.rna;
let i=$i+1;
done
Footer
| 262 | 19.230769 | 64 | sh |
null | CARL-main/carl/utils/__init__.py | 0 | 0 | 0 | py |
|
null | CARL-main/carl/utils/trial_logger.py | from typing import Union
import argparse
from pathlib import Path
import configargparse
import pandas as pd
from carl.utils.types import Context
class TrialLogger(object):
"""
Holds all train arguments and sets up logging directory and stables baselines
logging, writes trial setup and writes context feature history.
Following logging happens at the corresponding events:
after each step:
reward (progress.csv) (StableBaselines logger)
step (progress.csv) (StableBaselines logger)
after each episode:
context (context_history.csv) (TrialLogger)
episode (context_history.csv) (TrialLogger)
step (context_history.csv) (TrialLogger)
once on train start:
experiment config (env, agent, seed, set of contexts) (TrialLogger)
hyperparameters
"""
def __init__(
self,
logdir: Union[str, Path],
parser: configargparse.ArgParser,
trial_setup_args: argparse.Namespace,
add_context_feature_names_to_logdir: bool = False,
):
"""
Parameters
----------
logdir: Union[str, Path]
Base logging directory. The actual logging directory, accessible via self.logdir,
is logdir / "{agent}_{seed}".
Agent and seed are provided via trial_setup_args.
If add_context_feature_names_to_logdir is True,
the logging directory will be logdir / context_feature_dirname /f"{agent}_{seed}".
context_feature_dirname are all context feature names provided via
trial_setup_args.context_feature_args joined by "__".
parser: configargparse.ArgParser
Argument parser containing all arguments from runscript. Needed to write
trial setup file.
trial_setup_args: argparse.Namespace
Parsed arguments from parser. Arguments are supposed to be parsed before in case
new arguments are added via some external logic.
add_context_feature_names_to_logdir: bool, False
See logdir for effect.
"""
self.parser = parser
seed = trial_setup_args.seed
agent = trial_setup_args.agent
if add_context_feature_names_to_logdir:
context_feature_args = trial_setup_args.context_feature_args
names = [
n for n in context_feature_args if "std" not in n and "mean" not in n
] # TODO make sure to exclude numbers
context_feature_dirname = "default"
if names:
context_feature_dirname = (
names[0] if len(names) == 1 else "__".join(names)
)
self.logdir = Path(logdir) / context_feature_dirname / f"{agent}_{seed}"
else:
self.logdir = Path(logdir) / f"{agent}_{seed}"
self.logdir.mkdir(parents=True, exist_ok=True)
self.trial_setup_args = trial_setup_args
self.trial_setup_fn = self.logdir / "trial_setup.ini"
self.context_history_fn = self.logdir / "context_history.csv"
self.prepared_context_history_file = False
def write_trial_setup(self) -> None:
"""
Write trial setup to file with path logdir / "trial_setup.ini".
Returns
-------
None
"""
output_file_paths = [str(self.trial_setup_fn)]
self.parser.write_config_file(
parsed_namespace=self.trial_setup_args, output_file_paths=output_file_paths
)
def write_context(self, episode: int, step: int, context: Context) -> None:
"""
Context will be written to csv file (logdir / "context_history.csv").
The format is as follows:
episode,step,context_feature_0,context_feature_1,...,context_feature_n
0,1,345345,234234,...,234234
Parameters
----------
episode: int
Episode.
step: int
Timestep.
context: Context
Keys: Context features names/ids, values: context feature values.
Returns
-------
None
"""
columns = ["episode", "step"] + list(context.keys())
values = [episode, step] + list(context.values())
df = pd.DataFrame(values).T
df.columns = columns
write_header = False
mode = "a"
if not self.prepared_context_history_file:
write_header = True
mode = "w"
self.prepared_context_history_file = True
df.to_csv(
path_or_buf=self.context_history_fn,
sep=",",
header=write_header,
index=False,
mode=mode,
)
| 4,697 | 32.557143 | 94 | py |
null | CARL-main/carl/utils/types.py | from typing import Any, Dict, List, TypeVar, Union
import numpy as np
Context = Dict[str, Any]
Contexts = Dict[Any, Context]
Vector = Union[List[Any], np.ndarray]
ObsType = TypeVar("ObsType")
| 194 | 20.666667 | 50 | py |
null | CARL-main/carl/utils/doc_building/__init__.py | 0 | 0 | 0 | py |
|
null | CARL-main/carl/utils/doc_building/build.py | from typing import Dict, Tuple
from pathlib import Path
import numpy as np
import pandas as pd
from gym import spaces
import carl.envs
# JUST FOR DOCS / is dynamic in code!!
MARIO_OBSERVATION_SPACE = spaces.Box(
low=0,
high=255,
shape=[4, 64, 64],
dtype=np.uint8,
) # is dynamic in code
MARIO_ACTION_SPACE = spaces.Discrete(n=10)
def build() -> Tuple[pd.DataFrame, Dict, Dict]:
filepath = Path(__file__)
outdir = filepath.parent.parent.parent.parent / "docs/source/environments/data"
print("Build environment overview table.")
# Create snapshot
local_vars = vars(carl.envs)
k_env_family = "Env. Family"
k_env_name = "Name"
k_n_context_features = "# Context Features"
k_action_space = "Action Space"
k_obs_space = "Obs. Space"
# Filter envs
mustinclude = "CARL"
forbidden = ["defaults", "bounds"]
overview_table_entries = []
bounds_entries = {}
defaults_entries = {}
for varname, var in local_vars.items():
if mustinclude in varname and not np.any([f in varname for f in forbidden]):
env_name = varname
module = var.__module__
env_family = module.split(".")[-2]
env = var()
action_space = str(env.env.action_space)
observation_space = str(env.env.observation_space)
context = env.contexts[list(env.contexts.keys())[0]]
n_context_features = len(context)
data = {
k_env_family: env_family,
k_env_name: varname,
k_n_context_features: n_context_features,
k_action_space: action_space,
k_obs_space: observation_space,
}
overview_table_entries.append(data)
defaults_entries[env_name] = local_vars[f"{env_name}_defaults"]
bounds_entries[env_name] = local_vars[f"{env_name}_bounds"]
# if len(overview_table_entries) == 3: # TODO change back
# break
# Add Mario Information
env_families = ["Mario"]
env_names = ["CARLMarioEnv"]
from carl.envs.mario.carl_mario_definitions import CONTEXT_BOUNDS as mario_bounds
from carl.envs.mario.carl_mario_definitions import DEFAULT_CONTEXT as mario_defaults
unicorn_defaults = [mario_defaults]
N_context_features = [len(c) for c in unicorn_defaults]
action_spaces = [MARIO_ACTION_SPACE]
observation_spaces = [MARIO_OBSERVATION_SPACE]
unicorn_bounds = [mario_bounds]
for i in range(len(env_names)):
data = {
k_env_family: env_families[i],
k_env_name: env_names[i],
k_n_context_features: N_context_features[i],
k_action_space: action_spaces[i],
k_obs_space: observation_spaces[i],
}
overview_table_entries.append(data)
defaults_entries[env_names[i]] = unicorn_defaults[i]
bounds_entries[env_names[i]] = unicorn_bounds[i]
df = pd.DataFrame(overview_table_entries)
# Save overview table
csv_filename = outdir / "tab_overview_environments.csv"
csv_filename.parent.mkdir(exist_ok=True, parents=True)
overview_columns = [
k_env_family,
k_env_name,
k_n_context_features,
k_action_space,
k_obs_space,
]
save_df = df[overview_columns]
save_df.to_csv(csv_filename, index=False)
env_names = list(defaults_entries.keys())
for env_name in env_names:
fname = outdir / f"context_definitions/{env_name}.csv"
fname.parent.mkdir(parents=True, exist_ok=True)
defaults = defaults_entries[env_name]
defaults_df = pd.Series(defaults)
defaults_df.index.name = "Context Feature"
defaults_df.name = "Default"
bounds = bounds_entries[env_name]
bounds_df = pd.Series(bounds)
bounds_df.index.name = "Context Feature"
bounds_df.name = "Bounds"
context_def_df = pd.concat([defaults_df, bounds_df], axis=1)
context_def_df.to_csv(fname)
print("Done!")
return df, defaults_entries, bounds_entries
if __name__ == "__main__":
df, defaults_entries, bounds_entries = build()
| 4,177 | 31.387597 | 88 | py |
null | CARL-main/carl/utils/doc_building/plot_context_space.py | """
Boxplot
- number of context features
- percentage of continuous CFs
- number of CFs changing the dynamics
- number of CFs changing the reward
"""
from __future__ import annotations
if __name__ == "__main__":
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import carl.envs
global_vars = vars(carl.envs)
vars = {
k: v for k, v in global_vars.items() if "Env" in k or "Meta" in k or "CARL" in k
}
env_names = [n for n in vars.keys() if "bounds" not in n and "defaults" not in n]
env_context_feature_names = {}
context_feature_names: list[str] = []
dfs: list[pd.DataFrame] = []
n_context_features_per_env = []
n_float_cfs = 0
for env_name in env_names:
defaults = pd.Series(vars[env_name + "_defaults"])
n_context_features_per_env.append(len(defaults))
bounds = vars[env_name + "_bounds"]
bounds_vals = list(bounds.values())
n_float_cfs += np.sum([1 for v in bounds_vals if v[2] == float])
env_context_feature_names[env_name] = defaults.keys()
n_context_features = np.sum(n_context_features_per_env)
n_reward_changing = 7
n_dynami_changing = 129
env_names.extend(["CARLMarioEnv", "CARLRnaDesignEnv"])
n_context_features += 3 + 5
n_float_cfs += 0 + 0 # integers == continuous?
percentage_float_cfs = n_float_cfs / n_context_features
dfp = pd.Series(
{
"$n_{{total}}$": n_context_features,
"$n_{{dynamics}}$": n_dynami_changing,
"$n_{{reward}}$": n_reward_changing,
"$n_{{continuous}}$": n_float_cfs,
}
)
dfp.name = "Context Features"
vals = dfp.to_numpy()
labels = dfp.index
fontsize = 15
sns.set_style("whitegrid")
figsize = (2.5, 2)
dpi = 200
fname = "plots/context_feature_statistics.png"
p = Path(fname)
p.parent.mkdir(exist_ok=True, parents=True)
fig = plt.figure(figsize=figsize, dpi=dpi)
ax = fig.add_subplot(111)
ax = sns.barplot(x=vals, y=labels, ax=ax, palette="colorblind", orient="h")
xmin = 0
xmax = max(vals)
ax.set_xlim(xmin, xmax)
ax.set_frame_on(False)
ax.axes.get_yaxis().set_visible(False)
for i, label in enumerate(labels):
x = 10
y = i + 0.2
text = f"{label} = {vals[i]:.0f}"
ax.text(x, y, text, fontsize=fontsize)
fig.set_tight_layout(True)
plt.show()
fig.savefig(fname, bbox_inches="tight")
dfp.to_csv(Path(fname).parent / "context_feature_statistics.csv")
| 2,611 | 27.703297 | 88 | py |
null | CARL-main/carl/utils/doc_building/plot_radar.py | from __future__ import annotations
if __name__ == "__main__":
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from carl.utils.doc_building.plotting import radar_factory
env_context_feature_names = {
"CARLMountainCarEnv": [
"force",
"goal_position",
"goal_velocity",
"gravity",
"max_position",
"max_speed",
"min_position",
"start_position",
"start_position_std",
"start_velocity",
"start_velocity_std",
],
"CARLPendulumEnv": ["dt", "g", "l", "m", "max_speed"],
"CARLAcrobotEnv": [
"link_com_1",
"link_com_2",
"link_length_1",
"link_length_2",
"link_mass_1",
"link_mass_2",
"link_moi",
"max_velocity_1",
"max_velocity_2",
],
"CARLCartPoleEnv": [
"force_magnifier",
"gravity",
"masscart",
"masspole",
"pole_length",
"update_interval",
],
"CARLMountainCarContinuousEnv": [
"goal_position",
"goal_velocity",
"max_position",
"max_position_start",
"max_speed",
"max_velocity_start",
"min_position",
"min_position_start",
"min_velocity_start",
"power",
],
"CARLLunarLanderEnv": [
"FPS",
"GRAVITY_X",
"GRAVITY_Y",
"INITIAL_RANDOM",
"LEG_AWAY",
"LEG_DOWN",
"LEG_H",
"LEG_SPRING_TORQUE",
"LEG_W",
"MAIN_ENGINE_POWER",
"SCALE",
"SIDE_ENGINE_AWAY",
"SIDE_ENGINE_HEIGHT",
"SIDE_ENGINE_POWER",
"VIEWPORT_H",
"VIEWPORT_W",
],
"CARLVehicleRacingEnv": ["VEHICLE"],
"CARLBipedalWalkerEnv": [
"FPS",
"FRICTION",
"GRAVITY_X",
"GRAVITY_Y",
"INITIAL_RANDOM",
"LEG_DOWN",
"LEG_H",
"LEG_W",
"LIDAR_RANGE",
"MOTORS_TORQUE",
"SCALE",
"SPEED_HIP",
"SPEED_KNEE",
"TERRAIN_GRASS",
"TERRAIN_HEIGHT",
"TERRAIN_LENGTH",
"TERRAIN_STARTPAD",
"TERRAIN_STEP",
"VIEWPORT_H",
"VIEWPORT_W",
],
"CARLAnt": [
"actuator_strength",
"angular_damping",
"friction",
"gravity",
"joint_angular_damping",
"joint_stiffness",
"torso_mass",
],
"CARLHalfcheetah": [
"angular_damping",
"friction",
"gravity",
"joint_angular_damping",
"joint_stiffness",
"torso_mass",
],
"CARLHumanoid": [
"angular_damping",
"friction",
"gravity",
"joint_angular_damping",
"torso_mass",
],
"CARLFetch": [
"actuator_strength",
"angular_damping",
"friction",
"gravity",
"joint_angular_damping",
"joint_stiffness",
"target_distance",
"target_radius",
"torso_mass",
],
"CARLGrasp": [
"actuator_strength",
"angular_damping",
"friction",
"gravity",
"joint_angular_damping",
"joint_stiffness",
"target_distance",
"target_height",
"target_radius",
],
"CARLUr5e": [
"actuator_strength",
"angular_damping",
"friction",
"gravity",
"joint_angular_damping",
"joint_stiffness",
"target_distance",
"target_radius",
"torso_mass",
],
"CARLRnaDesignEnv": [
"mutation_threshold",
"reward_exponent",
"state_radius",
"dataset",
"target_structure_ids",
],
"CARLMarioEnv": ["level_index", "noise", "mario_state"],
"CARLDmcWalkerEnv": [
"gravity",
"friction_tangential",
"friction_torsional",
"friction_rolling",
"timestep",
"joint_damping",
"joint_stiffness",
"actuator_strength",
"density",
"viscosity",
"geom_density",
"wind_x",
"wind_y",
"wind_z",
],
"CARLDmcQuadrupedEnv": [
"gravity",
"friction_tangential",
"friction_torsional",
"friction_rolling",
"timestep",
"joint_damping",
"joint_stiffness",
"actuator_strength",
"density",
"viscosity",
"geom_density",
"wind_x",
"wind_y",
"wind_z",
],
"CARLDmcFishEnv": [
"gravity",
"friction_tangential",
"friction_torsional",
"friction_rolling",
"timestep",
"joint_damping",
"joint_stiffness",
"actuator_strength",
"density",
"viscosity",
"geom_density",
"wind_x",
"wind_y",
"wind_z",
],
"CARLDmcFingerEnv": [
"gravity",
"friction_tangential",
"friction_torsional",
"friction_rolling",
"timestep",
"joint_damping",
"joint_stiffness",
"actuator_strength",
"density",
"viscosity",
"geom_density",
"wind_x",
"wind_y",
"wind_z",
"limb_length_0",
"limb_length_1",
"spinner_radius",
"spinner_length",
],
}
action_space_sizes = [
(3,),
(1,),
(3,),
(2,),
(1,),
(4,),
(3,),
(4,),
(8,),
(6,),
(17,),
(10,),
(19,),
(6,),
(8,),
(10,),
(6,),
(12,),
(5,),
(2,),
]
state_space_sizes = [
(2,),
(3,),
(6,),
(4,),
(2,),
(8,),
(96, 96, 3),
(24,),
(87,),
(23,),
(299,),
(101,),
(132,),
(66,),
(11,),
(64, 64, 3),
(24,),
(78,),
(24,),
(9,),
]
n_context_features = [
11,
5,
9,
6,
10,
16,
1,
20,
7,
6,
5,
9,
9,
9,
5,
3,
14,
]
env_names = [
"CARLMountainCarEnv",
"CARLPendulumEnv",
"CARLAcrobotEnv",
"CARLCartPoleEnv",
"CARLMountainCarContinuousEnv",
"CARLLunarLanderEnv",
"CARLVehicleRacingEnv",
"CARLBipedalWalkerEnv",
"CARLAnt",
"CARLHalfcheetah",
"CARLHumanoid",
"CARLFetch",
"CARLGrasp",
"CARLUr5e",
"CARLRnaDesignEnv",
"CARLMarioEnv",
"CARLDmcWalkerEnv",
"CARLDmcQuadrupedEnv",
"CARLDmcFishEnv",
"CARLDmcFingerEnv",
]
n_cfs_d = [11, 5, 8, 6, 10, 16, 1, 20, 7, 6, 5, 9, 9, 9, 4, 3, 14, 14, 14, 18]
n_cfs_r = [0, 0, 0, 0, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
n_cfs = 131
n_dynami_changing = 129
n_reward_changing = 7
n_float_cfs = 114
percentage_float_cfs = n_float_cfs / n_cfs
env_types = {
"classic_control": [
"CARLAcrobotEnv",
"CARLCartPoleEnv",
"CARLMountainCarEnv",
"CARLMountainCarContinuousEnv",
"CARLPendulumEnv",
],
"box2d": ["CARLBipedalWalkerEnv", "CARLLunarLanderEnv", "CARLVehicleRacingEnv"],
"brax": ["CARLAnt", "CARLFetch", "CARLGrasp", "CARLHumanoid", "CARLUr5e"],
"dmc": [
"CARLDmcWalkerEnv",
"CARLDmcQuadrupedEnv",
"CARLDmcFishEnv",
"CARLDmcFingerEnv",
],
"misc": ["CARLMarioEnv", "CARLRnaDesignEnv"],
}
data: list[pd.DataFrame] = []
for env_type in env_types:
envs = env_types[env_type]
title = env_type
ids = [env_names.index(e) for e in envs]
# ss_sizes = [state_space_sizes[i][0] for i in ids]
# as_sizes = [action_space_sizes[i][0] for i in ids]
ss_sizes = [np.prod(state_space_sizes[i]) for i in ids]
as_sizes = [np.prod(action_space_sizes[i]) for i in ids]
reward_changing = [n_cfs_r[i] for i in ids]
dynamics_changing = [n_cfs_d[i] for i in ids]
cf_numbers = [len(env_context_feature_names[env_names[i]]) for i in ids]
# print(ss_sizes, as_sizes, cf_numbers)
data.append(
pd.DataFrame(
{
"env_type": [env_type] * len(ids),
"env_name": envs,
"state_space_size": ss_sizes,
"action_space_size": as_sizes,
"n_context_features": cf_numbers,
"n_cf_reward": reward_changing,
"n_cf_dyna": dynamics_changing,
}
)
)
data = pd.concat(data)
# normalize values
cols = [c for c in data.columns if c not in ["env_type", "env_name"]] # type: ignore [attr-defined]
max_values_per_col = []
for col in cols:
if col == "state_space_size":
data[col] = np.log(data[col])
max_val = data[col].max()
max_values_per_col.append(max_val)
data[col] /= max_val
cols_plot = [
"state_space_size",
"action_space_size",
"n_cf_reward",
"n_cf_dyna",
"n_context_features",
]
xticklabels = [
"state space size",
"action\nspace \nsize",
"$n_{cf, reward}$",
"$n_{cf,dynamics}$",
"$n_{cf}$",
]
figtitle = "Environments"
N = len(cols_plot)
theta = radar_factory(N, frame="polygon")
figsize = (10, 2.5)
dpi = 250
fig, axs = plt.subplots(
figsize=figsize,
nrows=1,
ncols=len(env_types),
subplot_kw=dict(projection="radar"),
dpi=dpi,
)
# fig.subplots_adjust(wspace=0.25, hspace=0.20, top=0.99, bottom=0.01)
# Plot the four cases from the example data on separate axes
for ax, env_type in zip(axs.flat, env_types):
D = data[data["env_type"] == env_type] # type: ignore [call-overload]
labels = D["env_name"].to_list()
color_palette_name = "colorblind"
n = len(D)
colors = sns.color_palette(color_palette_name, n)
plot_data = D[cols_plot].to_numpy()
ax.set_rgrids([0.2, 0.4, 0.6, 0.8])
title = env_type.replace("_", " ")
if title == "misc":
title = "RNA + Mario"
ax.set_title(
title,
weight="normal",
# size="medium", # position=(0.5, 0.25), transform=ax.transAxes,
horizontalalignment="center",
verticalalignment="center",
pad=15,
fontsize=12,
)
for i, (d, color) in enumerate(zip(plot_data, colors)):
ax.plot(theta, d, color=color, label=labels[i])
ax.fill(theta, d, facecolor=color, alpha=0.25)
ax.set_varlabels(
xticklabels, horizontalalignment="center", verticalalignment="center"
)
# ax.legend(loc=(0.25, -.5), labelspacing=0.1, fontsize='small')
rticks = np.linspace(0, 1, 5)
ax.set_rticks(rticks)
plt.setp(ax.get_yticklabels(), visible=False)
# add legend relative to top-left plot
# labels = ('Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5')
# legend = axs[0, 0].legend(labels, loc=(0.9, .95),
# labelspacing=0.1, fontsize='small')
# fig.text(0.5, 0.965, figtitle,
# horizontalalignment='center', color='black', weight='bold',
# size='large')
fig.set_tight_layout(True)
figfname = Path(__file__).parent / "generated" / "radar_env_space.pdf"
fig.savefig(figfname, bbox_inches="tight", dpi=300)
plt.show()
| 12,721 | 26.477322 | 104 | py |
null | CARL-main/carl/utils/doc_building/plotting.py | from typing import Any, Dict, List, Tuple
import numpy as np
from matplotlib.lines import Line2D
from matplotlib.patches import Circle, RegularPolygon
from matplotlib.path import Path
from matplotlib.projections import register_projection
from matplotlib.projections.polar import PolarAxes
from matplotlib.spines import Spine
from matplotlib.transforms import Affine2D
def radar_factory(num_vars: int, frame: str = "circle") -> np.ndarray:
"""
Create a radar chart with `num_vars` axes.
This function creates a RadarAxes projection and registers it.
https://matplotlib.org/stable/gallery/specialty_plots/radar_chart.html
Parameters
----------
num_vars : int
Number of variables for radar chart.
frame : {'circle', 'polygon'}
Shape of frame surrounding axes.
"""
# calculate evenly-spaced axis angles
theta = np.linspace(0, 2 * np.pi, num_vars, endpoint=False)
class RadarAxes(PolarAxes):
name = "radar"
# use 1 line segment to connect specified points
RESOLUTION = 1
def __init__(self, *args: Tuple, **kwargs: Dict):
super().__init__(*args, **kwargs)
# rotate plot such that the first axis is at the top
self.set_theta_zero_location("N")
def fill(self, *args: Tuple, closed: bool = True, **kwargs: Dict) -> Any:
"""Override fill so that line is closed by default"""
return super().fill(closed=closed, *args, **kwargs)
def plot(self, *args: Tuple, **kwargs: Dict) -> None:
"""Override plot so that line is closed by default"""
lines = super().plot(*args, **kwargs)
for line in lines:
self._close_line(line)
def _close_line(self, line: Line2D) -> None:
x, y = line.get_data()
# FIXME: markers at x[0], y[0] get doubled-up
if x[0] != x[-1]:
x = np.append(x, x[0])
y = np.append(y, y[0])
line.set_data(x, y)
def set_varlabels(self, labels: List[str], **kwargs: Dict) -> None:
self.set_thetagrids(np.degrees(theta), labels, **kwargs)
def _gen_axes_patch(self) -> Any:
# The Axes patch must be centered at (0.5, 0.5) and of radius 0.5
# in axes coordinates.
if frame == "circle":
return Circle((0.5, 0.5), 0.5)
elif frame == "polygon":
return RegularPolygon((0.5, 0.5), num_vars, radius=0.5, edgecolor="k")
else:
raise ValueError("Unknown value for 'frame': %s" % frame)
def _gen_axes_spines(self) -> Dict[str, Spine]:
if frame == "circle":
return super()._gen_axes_spines()
elif frame == "polygon":
# spine_type must be 'left'/'right'/'top'/'bottom'/'circle'.
spine = Spine(
axes=self,
spine_type="circle",
path=Path.unit_regular_polygon(num_vars),
)
# unit_regular_polygon gives a polygon of radius 1 centered at
# (0, 0) but we want a polygon of radius 0.5 centered at (0.5,
# 0.5) in axes coordinates.
spine.set_transform(
Affine2D().scale(0.5).translate(0.5, 0.5) + self.transAxes
)
return {"polar": spine}
else:
raise ValueError("Unknown value for 'frame': %s" % frame)
register_projection(RadarAxes)
return theta
| 3,591 | 36.416667 | 86 | py |
null | CARL-main/carl/utils/doc_building/print_tables.py | if __name__ == "__main__":
from typing import List
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.offsetbox import AnchoredText
import carl.envs
def plot_context_feature_freq(
context_feature_names: List[str], fname: str = ""
) -> None:
filter_cf_names = True
if filter_cf_names:
aliases = {
"mass": ["mass", "m"],
"geometry": ["length", "l", "height", "h", "width", "w", "radius"],
"power": ["power"],
"gravity": ["gravity", "g"],
"force": ["force"],
"position": ["position", "distance"],
"velocity": ["velocity", "speed"],
"torque": ["torque"],
"damping": ["damping"],
"friction": ["friction"],
}
cfs = []
for cf in context_feature_names:
cf = cf.lower()
for alias, alias_values in aliases.items():
longs = [a for a in alias_values if len(a) > 2]
shorts = [a for a in alias_values if len(a) <= 2]
if np.any([a in cf for a in longs]) or np.any(
[
cf == a
or cf[-len(a) :] == a
or cf[: len(a) + 1] == a + "_"
or cf == a
for a in shorts
]
):
cf = alias
cfs.append(cf)
context_feature_names = cfs
cf_names_unique, counts = np.unique(context_feature_names, return_counts=True)
counts_orig = counts
ids = np.argsort(counts)
cf_names_unique = cf_names_unique[ids]
counts = counts[ids]
filter_single_occurrences = True
cf_names_single_occurrences = []
if filter_single_occurrences:
ids = counts == 1
cf_names_single_occurrences = cf_names_unique[ids]
cf_names_single_occurrences.sort()
cf_names_unique = cf_names_unique[~ids]
counts = counts[~ids]
# context feature frequency
fig = plt.figure(figsize=(5, 7), dpi=200)
ax = fig.add_subplot(111)
ax.barh(cf_names_unique, counts)
ax.set_yticklabels(cf_names_unique, ha="right", fontsize=8)
ax.set_title(
f"Context Feature Frequency (lazily filtered, $n = {np.sum(counts_orig)}$)",
fontsize=10,
)
ax.grid(axis="x", which="both")
if filter_single_occurrences:
text = "Single occurrences:\n" + "\n".join(
[f"{cf}" for cf in cf_names_single_occurrences]
)
at2 = AnchoredText(
text,
loc="lower right",
prop=dict(size=8),
frameon=False,
# bbox_to_anchor=(0., 1.),
# bbox_transform=ax.transAxes
)
at2.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
ax.add_artist(at2)
fig.set_tight_layout(True)
if fname:
fig.savefig(fname, bbox_inches="tight")
plt.show()
global_vars = vars(carl.envs)
vars = {
k: v for k, v in global_vars.items() if "Env" in k or "Meta" in k or "CARL" in k
}
env_names = [
n
for n in vars.keys()
if "bounds" not in n and "defaults" not in n and "mask" not in n
]
env_context_feature_names = {}
context_feature_names = []
dfs = []
n_context_features = []
for env_name in env_names:
defaults = pd.Series(
getattr(eval(getattr(carl.envs, env_name).__module__), "DEFAULT_CONTEXT")
) # pd.Series(vars[env_name + "_defaults"])
n_context_features.append(len(defaults))
bounds = getattr(
eval(getattr(carl.envs, env_name).__module__), "CONTEXT_BOUNDS"
) # vars[env_name + "_bounds"]
print_bounds = {}
for k, v in bounds.items():
lower = v[0]
upper = v[1]
datatype = v[2]
if datatype == "categorical":
pass
else:
datatype = datatype.__name__
print_bounds[k] = (lower, upper, datatype)
# print_bounds = {k: (v[0], v[1], v[2].__name__) for k, v in bounds.items()}
bounds = pd.Series(print_bounds)
defaults.sort_index(inplace=True)
bounds.sort_index(inplace=True)
df = pd.DataFrame()
df["Default"] = defaults
df["Bounds"] = [b[:2] for b in bounds]
df["Bounds"].replace(to_replace=(None, None), value="-", inplace=True)
df["Bounds"][df["Bounds"] == (None, None)] = "-"
df["Type"] = [b[2] for b in bounds]
rows = df.index
context_feature_names.extend(rows)
# if "Acro" in env_name:
# special_format_cols = ["max_velocity_1", "max_velocity_2"]
# for b in bounds:
# print(f"({b[0]}, {b[1]})", type(b[0]))
# index = [r.lower().replace("_", " ") for r in rows]
# tuples = [(env_name, ind) for ind in index]
# index = pd.MultiIndex.from_tuples(tuples, names=["Environment", "Context Feature"])
# df.index = index
dfs.append(df)
env_context_feature_names[env_name] = list(defaults.keys())
df_cf_defbounds = pd.concat(dfs)
# Requires latex \usepackage{booktabs}
bold_rows = False
table_str = df_cf_defbounds.to_latex(
header=True,
index=True,
index_names=True,
float_format="{:0.2f}".format,
bold_rows=bold_rows,
caption=(
"Context Features: Defaults and Bounds",
"Context Features: Defaults and bounds for each environment.",
),
label="tab:context_features_defaults_bounds",
# position="c",?
)
df_cf_defbounds_fname = (
Path(__file__).parent / "generated" / "context_features_defaults_bounds.tex"
)
df_cf_defbounds_fname.parent.mkdir(exist_ok=True, parents=True)
with open(df_cf_defbounds_fname, "w") as file:
file.write(table_str)
for env_name, df in zip(env_names, dfs):
# index = [ind[1] for ind in df.index] # no multi-index anymore
# df.index = index
df.index.name = "Context Feature"
df.reset_index(level=0, inplace=True)
table_str = df.to_latex(
header=True,
index=False,
index_names=True,
float_format="{:0.2f}".format,
bold_rows=bold_rows,
caption=(
f"{env_name}", #: Context Features with Defaults, Bounds and Types",
f"{env_name}", #: Context Features with Defaults, Bounds and Types"
),
label=f"tab:context_features_defaults_bounds_{env_name}",
# position="c",?
)
table_str = table_str.replace("{table}", "{subtable}")
table_str = table_str.replace(
r"\begin{subtable}", r"\begin{subtable}{0.4\textwidth}"
)
# print(table_str)
fname = (
df_cf_defbounds_fname.parent
/ f"context_features_defaults_bounds_{env_name}.tex"
)
with open(fname, "w") as file:
file.write(table_str)
# plot_context_feature_freq(context_feature_names=context_feature_names, fname="utils/context_feature_freq.png")
def plot_statistics(
env_names: List[str], n_context_features: int, fname: str = ""
) -> None:
fig = plt.figure(figsize=(5, 7), dpi=200)
ax = fig.add_subplot(111)
ax.barh(env_names, n_context_features)
ax.set_yticklabels(env_names, ha="right", fontsize=8)
ax.set_title("TODO", fontsize=10)
ax.grid(axis="x", which="both")
fig.set_tight_layout(True)
if fname:
fig.savefig(fname, bbox_inches="tight")
plt.show()
# collect size of state space
calc_new = False
if calc_new:
state_space_sizes = []
action_space_sizes = []
for env_name in env_names:
env = eval(env_name)(hide_context=True)
state = env.observation_space
action_space = env.action_space
env.close()
state_space_sizes.append(state.shape)
action_space_sizes.append(action_space.shape)
print(env_name, state.shape)
else:
env_names = [
"CARLMountainCarEnv",
"CARLPendulumEnv",
"CARLAcrobotEnv",
"CARLCartPoleEnv",
"CARLMountainCarContinuousEnv",
"CARLLunarLanderEnv",
"CARLVehicleRacingEnv",
"CARLBipedalWalkerEnv",
"CARLAnt",
"CARLHalfcheetah",
"CARLHumanoid",
"CARLFetch",
"CARLGrasp",
"CARLUr5e",
]
# hide_context = False
state_space_sizes = [
(13,),
(8,),
(15,),
(10,),
(12,),
(24,),
(96, 96, 3),
(44,),
(94,),
(29,),
(304,),
(110,),
(141,),
(75,),
]
# hide_context = True
state_space_sizes = [
(2,),
(3,),
(6,),
(4,),
(2,),
(8,),
(96, 96, 3),
(24,),
(87,),
(23,),
(299,),
(101,),
(132,),
(66,),
] # , (11,), (64, 64, 3)]
action_space_sizes = [
(3,),
(1,),
(3,),
(2,),
(1,),
(4,),
(3,),
(4,),
(8,),
(6,),
(17,),
(10,),
(19,),
(6,),
]
fname = df_cf_defbounds_fname.parent / "env_statistics.png"
env_names.append("CARLRnaDesignEnv")
n_context_features.append(5)
state_space_sizes.append((11,))
action_space_sizes.append((8,)) # 2 types with 4 actions
env_context_feature_names["CARLRnaDesignEnv"] = [
"mutation_threshold",
"reward_exponent",
"state_radius",
"dataset",
"target_structure_ids",
]
env_names.append("CARLMarioEnv")
n_context_features.append(3)
state_space_sizes.append((64, 64, 3))
action_space_sizes.append((10,))
env_context_feature_names["CARLMarioEnv"] = ["level_index", "noise", "mario_state"]
# plot_statistics(env_names, n_context_features, fname=fname)
s_sizes = [s[0] for s in state_space_sizes if len(s) == 1]
# plot_statistics(env_names, s_sizes)
a_sizes = [s[0] for s in action_space_sizes]
# plot_statistics(env_names, a_sizes)
sns.set_style("darkgrid")
sns.set_context("paper")
n_envs = len(env_names)
n_axes = 2
figsize = (3, 2 * n_axes)
dpi = 200
fig = plt.figure(figsize=figsize, dpi=dpi)
axes = fig.subplots(nrows=n_axes, ncols=1)
ax = axes[0]
ax = sns.histplot(x=s_sizes, ax=ax, bins=n_envs)
ax.set_xlabel("State Space Size")
ax.set_ylabel("$n_{{envs}}$")
ax = axes[1]
ax = sns.histplot(x=a_sizes, ax=ax, bins=n_envs)
ax.set_xlabel("Action Space Size")
ax.set_ylabel("$n_{{envs}}$")
fig.set_tight_layout(True)
fig.savefig(fname, bbox_inches="tight", dpi=300)
plt.show()
| 11,646 | 31.263158 | 116 | py |
null | CARL-main/carl/utils/doc_building/render_brax_env.py | if __name__ == "__main__":
from typing import List
import brax
import jax
from brax import envs
from brax.io import html
from IPython.display import HTML
env_name = "fetch" # @param ['ant', 'humanoid', 'fetch', 'grasp', 'halfcheetah', 'ur5e', 'reacher']
env_fn = envs.create_fn(env_name=env_name)
env = env_fn()
state = env.reset(rng=jax.random.PRNGKey(seed=1))
def visualize(sys: brax.System, qps: List[brax.QP]) -> HTML:
"""Renders a 3D visualization of the environment."""
return HTML(html.render(sys, qps))
# htmlrender = visualize(env.sys, [state.qp])
html.save_html(path=f"tmp/env_render/{env_name}.html", sys=env.sys, qps=[state.qp])
| 714 | 33.047619 | 104 | py |
null | CARL-main/docs/conf.py | import os, sys
sys.path.insert(0, os.path.abspath(".."))
import automl_sphinx_theme # Must come after the path injection above
from carl import copyright, author, version, name
options = {"copyright": copyright,
"author": author,
"version": version,
"versions": {
f"v{version} (stable)": "#",
},
"name": name,
"html_theme_options": {
"github_url": "https://github.com/automl/automl_sphinx_theme",
"twitter_url": "https://twitter.com/automl_org?lang=de",
},
#this is here to exclude the examples gallery since they are not documented
"extensions": ["myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon", # Enables to understand NumPy docstring
# "numpydoc",
"sphinx.ext.autosummary",
"sphinx.ext.autosectionlabel",
"sphinx_autodoc_typehints",
"sphinx.ext.doctest",
]
}
# Import conf.py from the automl theme
automl_sphinx_theme.set_options(globals(), options)
| 1,301 | 36.2 | 89 | py |
null | CARL-main/docs/themes/smac/docs-navbar.html | <div class="container-xl">
<div id="navbar-start">
{% for navbar_item in theme_navbar_start %}
{% include navbar_item %}
{% endfor %}
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" aria-label="{{ _('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
{% set navbar_class, navbar_align = navbar_align_class() %}
<div id="navbar-collapsible" class="{{ navbar_class }} collapse navbar-collapse">
<div id="navbar-center" class="{{ navbar_align }}">
{% for navbar_item in theme_navbar_center %}
<div class="navbar-center-item">
{% include navbar_item %}
</div>
{% endfor %}
</div>
<div id="navbar-end">
{% for navbar_item in theme_navbar_end %}
<div class="navbar-end-item">
{% include navbar_item %}
</div>
{% endfor %}
</div>
</div>
</div>
| 995 | 30.125 | 203 | html |
null | CARL-main/docs/themes/smac/docs-sidebar.html | 0 | 0 | 0 | html |
|
null | CARL-main/docs/themes/smac/footer.html | <footer class="footer mt-5 mt-md-0">
<div class="container">
{% for footer_item in theme_footer_items %}
<div class="footer-item">
{% include footer_item %}
</div>
{% endfor %}
</div>
</footer> | 219 | 23.444444 | 47 | html |
null | CARL-main/docs/themes/smac/gc.html | <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ _('Site') }} <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc">{{ toctree(maxdepth=10) }}</ul>
</li> | 200 | 49.25 | 102 | html |
null | CARL-main/docs/themes/smac/icon-links.html | {%- macro icon_link_nav_item(url, icon, name) -%}
{%- if url | length > 2 %}
<li class="nav-item">
<a class="nav-link" href="{{ url }}" rel="noopener" target="_blank" title="{{ _(name) }}">
<span><i class="{{ icon }}"></i></span>
<label class="sr-only">{{ _(name) }}</label>
</a>
</li>
{%- endif -%}
{%- endmacro -%}
<ul id="navbar-icon-links" class="navbar-nav" aria-label="{{ _(theme_icon_links_label) }}">
{%- block icon_link_shortcuts -%}
{{ icon_link_nav_item(theme_github_url, "fab fa-github-square", "GitHub") -}}
{{ icon_link_nav_item(theme_gitlab_url, "fab fa-gitlab", "GitLab") -}}
{{ icon_link_nav_item(theme_bitbucket_url, "fab fa-bitbucket", "Bitbucket") -}}
{{ icon_link_nav_item(theme_twitter_url, "fab fa-twitter-square", "Twitter") -}}
{% endblock -%}
{%- for icon_link in theme_icon_links -%}
{{ icon_link_nav_item(icon_link["url"], icon_link["icon"], icon_link["name"]) -}}
{%- endfor %}
</ul>
| 1,062 | 45.217391 | 100 | html |
null | CARL-main/docs/themes/smac/layout.html | {%- extends "basic/layout.html" %}
{%- import "static/webpack-macros.html" as _webpack with context %}
{%- block css %}
{{ _webpack.head_pre_bootstrap() }}
{{ _webpack.head_pre_icons() }}
{% block fonts %}
{{ _webpack.head_pre_fonts() }}
{% endblock %}
{{- css() }}
{{ _webpack.head_js_preload() }}
{%- endblock %}
{%- block extrahead %}
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="{{ language }}">
{% for favicon in theme_favicons %}
{% if favicon.href[:4] == 'http'%}
<link rel="{{ favicon.rel }}" sizes="{{ favicon.sizes }}" href="{{ favicon.href }}">
{% else %}
<link rel="{{ favicon.rel }}" sizes="{{ favicon.sizes }}" href="{{ pathto('_static/' + favicon.href, 1) }}">
{% endif %}
{% endfor %}
<!-- Google Analytics -->
{{ generate_google_analytics_script(id=theme_google_analytics_id) }}
{%- endblock %}
{# Silence the sidebar's, relbar's #}
{% block header %}{% endblock %}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebarsourcelink %}{% endblock %}
{% block body_tag %}
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
{%- endblock %}
{%- block content %}
{# Added to support a banner with an alert #}
<div class="container-fluid" id="banner"></div>
{% block docs_navbar %}
<nav class="navbar navbar-light navbar-expand-lg bg-light fixed-top bd-navbar" id="navbar-main">
{%- include "docs-navbar.html" %}
</nav>
{% endblock %}
<div class="container-xl">
<div class="row">
{% block docs_sidebar %}
{% if sidebars %}
<!-- Only show if we have sidebars configured, else just a small margin -->
<div class="col-12 col-md-3 bd-sidebar">
{%- for sidebartemplate in sidebars %}
{%- include sidebartemplate %}
{%- endfor %}
</div>
{% else %}
<div class="col-12 col-md-1 col-xl-2 bd-sidebar no-sidebar"></div>
{% endif %}
{% endblock %}
{% block docs_toc %}
<div class="d-none d-xl-block col-xl-2 bd-toc">
{% if meta is defined and not (meta is not none and 'notoc' in meta) %}
{% for toc_item in theme_page_sidebar_items %}
<div class="toc-item">
{% include toc_item %}
</div>
{% endfor %}
{% endif %}
</div>
{% endblock %}
{% block docs_main %}
{% if sidebars %}
{% set content_col_class = "col-md-9 col-xl-7" %}
{% else %}
{% set content_col_class = "col-md-11 col-xl-8" %}
{% endif %}
<main class="col-12 {{ content_col_class }} py-md-5 pl-md-5 pr-md-4 bd-content" role="main">
{% block docs_body %}
<div>
{% block body %} {% endblock %}
</div>
{% endblock %}
{% if theme_show_prev_next %}
{% include "templates/prev-next.html" %}
{% endif %}
</main>
{% endblock %}
</div>
</div>
{%- block scripts_end %}
{{ _webpack.body_post() }}
{%- endblock %}
{%- endblock %}
{%- block footer %}
{%- include "footer.html" %}
{%- endblock %}
| 3,409 | 31.169811 | 114 | html |
null | CARL-main/docs/themes/smac/search-field.html | <form class="bd-search align-items-center" action="{{ pathto('search') }}" method="get"
style="width: 100%;">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="{{ _(theme_search_bar_text) }}" aria-label="{{ theme_search_bar_text }}" autocomplete="off" >
</form>
| 334 | 46.857143 | 177 | html |
null | CARL-main/docs/themes/smac/smac_theme.py | """
Bootstrap-based sphinx theme from the PyData community
"""
# flake8: noqa: E402
# mypy: ignore-errors
import os
from sphinx.errors import ExtensionError
from sphinx.util import logging
from sphinx.environment.adapters.toctree import TocTree
from sphinx import addnodes
import jinja2
from bs4 import BeautifulSoup as bs
__version__ = "0.7.1"
logger = logging.getLogger(__name__)
def update_config(app, env):
theme_options = app.config["html_theme_options"]
if theme_options.get("search_bar_position") == "navbar":
logger.warn(
(
"Deprecated config `search_bar_position` used."
"Use `search-field.html` in `navbar_end` template list instead."
)
)
if not isinstance(theme_options.get("icon_links", []), list):
raise ExtensionError(
(
"`icon_links` must be a list of dictionaries, you provided "
f"type {type(theme_options.get('icon_links'))}."
)
)
def update_templates(app, pagename, templatename, context, doctree):
"""Update template names for page build."""
template_sections = [
"theme_navbar_start",
"theme_navbar_center",
"theme_navbar_end",
"theme_footer_items",
"theme_page_sidebar_items",
"sidebars",
]
for section in template_sections:
if context.get(section):
# Break apart `,` separated strings so we can use , in the defaults
if isinstance(context.get(section), str):
context[section] = [
ii.strip() for ii in context.get(section).split(",")
]
# Add `.html` to templates with no suffix
for ii, template in enumerate(context.get(section)):
if not os.path.splitext(template)[1]:
context[section][ii] = template + ".html"
def add_toctree_functions(app, pagename, templatename, context, doctree):
"""Add functions so Jinja templates can add toctree objects."""
def generate_nav_html(kind, startdepth=None, **kwargs):
"""
Return the navigation link structure in HTML. Arguments are passed
to Sphinx "toctree" function (context["toctree"] below).
We use beautifulsoup to add the right CSS classes / structure for bootstrap.
See https://www.sphinx-doc.org/en/master/templating.html#toctree.
Parameters
----------
kind : ["navbar", "sidebar", "raw"]
The kind of UI element this toctree is generated for.
startdepth : int
The level of the toctree at which to start. By default, for
the navbar uses the normal toctree (`startdepth=0`), and for
the sidebar starts from the second level (`startdepth=1`).
kwargs: passed to the Sphinx `toctree` template function.
Returns
-------
HTML string (if kind in ["navbar", "sidebar"])
or BeautifulSoup object (if kind == "raw")
"""
if startdepth is None:
startdepth = 0 # 1 if kind == "sidebar" else 0
if startdepth == 0:
toc_sphinx = context["toctree"](**kwargs)
else:
# select the "active" subset of the navigation tree for the sidebar
toc_sphinx = index_toctree(app, pagename, startdepth, **kwargs)
soup = bs(toc_sphinx, "html.parser")
# pair "current" with "active" since that's what we use w/ bootstrap
for li in soup("li", {"class": "current"}):
li["class"].append("active")
# Remove navbar/sidebar links to sub-headers on the page
for li in soup.select("li"):
# Remove
if li.find("a"):
href = li.find("a")["href"]
if "#" in href and href != "#":
li.decompose()
if kind == "navbar":
# Add CSS for bootstrap
for li in soup("li"):
li["class"].append("nav-item")
li.find("a")["class"].append("nav-link")
# only select li items (not eg captions)
out = "\n".join([ii.prettify() for ii in soup.find_all("li")])
elif kind == "sidebar":
# Add bootstrap classes for first `ul` items
for ul in soup("ul", recursive=False):
ul.attrs["class"] = ul.attrs.get("class", []) + ["nav", "bd-sidenav"]
# Add icons and labels for collapsible nested sections
_add_collapse_checkboxes(soup)
out = soup.prettify()
elif kind == "raw":
out = soup
return out
def generate_toc_html(kind="html"):
"""Return the within-page TOC links in HTML."""
if "toc" not in context:
return ""
soup = bs(context["toc"], "html.parser")
# Add toc-hN + visible classes
def add_header_level_recursive(ul, level):
if ul is None:
return
if level <= (context["theme_show_toc_level"] + 1):
ul["class"] = ul.get("class", []) + ["visible"]
for li in ul("li", recursive=False):
li["class"] = li.get("class", []) + [f"toc-h{level}"]
add_header_level_recursive(li.find("ul", recursive=False), level + 1)
add_header_level_recursive(soup.find("ul"), 1)
# Add in CSS classes for bootstrap
for ul in soup("ul"):
ul["class"] = ul.get("class", []) + ["nav", "section-nav", "flex-column"]
for li in soup("li"):
li["class"] = li.get("class", []) + ["nav-item", "toc-entry"]
if li.find("a"):
a = li.find("a")
a["class"] = a.get("class", []) + ["nav-link"]
# If we only have one h1 header, assume it's a title
h1_headers = soup.select(".toc-h1")
if len(h1_headers) == 1:
title = h1_headers[0]
# If we have no sub-headers of a title then we won't have a TOC
if not title.select(".toc-h2"):
out = ""
else:
out = title.find("ul").prettify()
# Else treat the h1 headers as sections
else:
out = soup.prettify()
# Return the toctree object
if kind == "html":
return out
else:
return soup
def get_nav_object(maxdepth=None, collapse=False, includehidden=True, **kwargs):
"""Return a list of nav links that can be accessed from Jinja.
Parameters
----------
maxdepth: int
How many layers of TocTree will be returned
collapse: bool
Whether to only include sub-pages of the currently-active page,
instead of sub-pages of all top-level pages of the site.
kwargs: key/val pairs
Passed to the `toctree` Sphinx method
"""
if context["master_doc"] == pagename:
logger.warn("`get_nav_object` is deprecated and will be removed in v0.7.0")
toc_sphinx = context["toctree"](
maxdepth=maxdepth, collapse=collapse, includehidden=includehidden, **kwargs
)
soup = bs(toc_sphinx, "html.parser")
# # If no toctree is defined (AKA a single-page site), skip this
# if toctree is None:
# return []
nav_object = soup_to_python(soup, only_pages=True)
return nav_object
def get_page_toc_object():
"""Return a list of within-page TOC links that can be accessed from Jinja."""
if context["master_doc"] == pagename:
logger.warn(
("`get_page_toc_object` is deprecated and will be " "removed in v0.7.0")
)
if "toc" not in context:
return ""
soup = bs(context["toc"], "html.parser")
try:
toc_object = soup_to_python(soup, only_pages=False)
except Exception:
return []
# If there's only one child, assume we have a single "title" as top header
# so start the TOC at the first item's children (AKA, level 2 headers)
if len(toc_object) == 1:
return toc_object[0]["children"]
else:
return toc_object
def navbar_align_class():
"""Return the class that aligns the navbar based on config."""
align = context.get("theme_navbar_align", "content")
align_options = {
"content": ("col-lg-9", "mr-auto"),
"left": ("", "mr-auto"),
"right": ("", "ml-auto"),
}
if align not in align_options:
raise ValueError(
(
"Theme optione navbar_align must be one of"
f"{align_options.keys()}, got: {align}"
)
)
return align_options[align]
def generate_google_analytics_script(id):
"""Handle the two types of google analytics id."""
if id:
if "G-" in id:
script = f"""
<script
async
src='https://www.googletagmanager.com/gtag/js?id={id}'
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){{ dataLayer.push(arguments); }}
gtag('js', new Date());
gtag('config', '{id}');
</script>
"""
else:
script = f"""
<script
async
src='https://www.google-analytics.com/analytics.js'
></script>
<script>
window.ga = window.ga || function () {{
(ga.q = ga.q || []).push(arguments) }};
ga.l = +new Date;
ga('create', '{id}', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
</script>
"""
soup = bs(script, "html.parser")
return soup
return ""
context["generate_nav_html"] = generate_nav_html
context["generate_toc_html"] = generate_toc_html
context["get_nav_object"] = get_nav_object
context["get_page_toc_object"] = get_page_toc_object
context["navbar_align_class"] = navbar_align_class
context["generate_google_analytics_script"] = generate_google_analytics_script
def _add_collapse_checkboxes(soup):
# based on https://github.com/pradyunsg/furo
toctree_checkbox_count = 0
for element in soup.find_all("li", recursive=True):
# We check all "li" elements, to add a "current-page" to the correct li.
classes = element.get("class", [])
# Nothing more to do, unless this has "children"
if not element.find("ul"):
continue
# Add a class to indicate that this has children.
element["class"] = classes + ["has-children"]
# We're gonna add a checkbox.
toctree_checkbox_count += 1
checkbox_name = f"toctree-checkbox-{toctree_checkbox_count}"
# Add the "label" for the checkbox which will get filled.
if soup.new_tag is None:
continue
label = soup.new_tag("label", attrs={"for": checkbox_name})
label.append(soup.new_tag("i", attrs={"class": "fas fa-chevron-down"}))
element.insert(1, label)
# Add the checkbox that's used to store expanded/collapsed state.
checkbox = soup.new_tag(
"input",
attrs={
"type": "checkbox",
"class": ["toctree-checkbox"],
"id": checkbox_name,
"name": checkbox_name,
},
)
# if this has a "current" class, be expanded by default
# (by checking the checkbox)
if "current" in classes:
checkbox.attrs["checked"] = ""
element.insert(1, checkbox)
def _get_local_toctree_for(
self: TocTree, indexname: str, docname: str, builder, collapse: bool, **kwargs
):
"""Return the "local" TOC nodetree (relative to `indexname`)."""
# this is a copy of `TocTree.get_toctree_for`, but where the sphinx version
# always uses the "master" doctree:
# doctree = self.env.get_doctree(self.env.config.master_doc)
# we here use the `indexname` additional argument to be able to use a subset
# of the doctree (e.g. starting at a second level for the sidebar):
# doctree = app.env.tocs[indexname].deepcopy()
doctree = self.env.tocs[indexname].deepcopy()
toctrees = []
if "includehidden" not in kwargs:
kwargs["includehidden"] = True
if "maxdepth" not in kwargs or not kwargs["maxdepth"]:
kwargs["maxdepth"] = 0
else:
kwargs["maxdepth"] = int(kwargs["maxdepth"])
kwargs["collapse"] = collapse
for toctreenode in doctree.traverse(addnodes.toctree):
toctree = self.resolve(docname, builder, toctreenode, prune=True, **kwargs)
if toctree:
toctrees.append(toctree)
if not toctrees:
return None
result = toctrees[0]
for toctree in toctrees[1:]:
result.extend(toctree.children)
return result
def index_toctree(app, pagename: str, startdepth: int, collapse: bool = False, **kwargs):
"""
Returns the "local" (starting at `startdepth`) TOC tree containing the
current page, rendered as HTML bullet lists.
This is the equivalent of `context["toctree"](**kwargs)` in sphinx
templating, but using the startdepth-local instead of global TOC tree.
"""
# this is a variant of the function stored in `context["toctree"]`, which is
# defined as `lambda **kwargs: self._get_local_toctree(pagename, **kwargs)`
# with `self` being the HMTLBuilder and the `_get_local_toctree` basically
# returning:
# return self.render_partial(TocTree(self.env).get_toctree_for(
# pagename, self, collapse, **kwargs))['fragment']
if "includehidden" not in kwargs:
kwargs["includehidden"] = False
if kwargs.get("maxdepth") == "":
kwargs.pop("maxdepth")
toctree = TocTree(app.env)
ancestors = toctree.get_toctree_ancestors(pagename)
try:
indexname = ancestors[-startdepth]
except IndexError:
# eg for index.rst, but also special pages such as genindex, py-modindex, search
# those pages don't have a "current" element in the toctree, so we can
# directly return an emtpy string instead of using the default sphinx
# toctree.get_toctree_for(pagename, app.builder, collapse, **kwargs)
return ""
toctree_element = _get_local_toctree_for(
toctree, indexname, pagename, app.builder, collapse, **kwargs
)
return app.builder.render_partial(toctree_element)["fragment"]
def soup_to_python(soup, only_pages=False):
"""
Convert the toctree html structure to python objects which can be used in Jinja.
Parameters
----------
soup : BeautifulSoup object for the toctree
only_pages : bool
Only include items for full pages in the output dictionary. Exclude
anchor links (TOC items with a URL that starts with #)
Returns
-------
nav : list of dicts
The toctree, converted into a dictionary with key/values that work
within Jinja.
"""
# toctree has this structure (caption only for toctree, not toc)
# <p class="caption">...</span></p>
# <ul>
# <li class="toctree-l1"><a href="..">..</a></li>
# <li class="toctree-l1"><a href="..">..</a></li>
# ...
def extract_level_recursive(ul, navs_list):
for li in ul.find_all("li", recursive=False):
ref = li.a
url = ref["href"]
title = "".join(map(str, ref.contents))
active = "current" in li.get("class", [])
# If we've got an anchor link, skip it if we wish
if only_pages and "#" in url and url != "#":
continue
# Converting the docutils attributes into jinja-friendly objects
nav = {}
nav["title"] = title
nav["url"] = url
nav["active"] = active
navs_list.append(nav)
# Recursively convert children as well
nav["children"] = []
ul = li.find("ul", recursive=False)
if ul:
extract_level_recursive(ul, nav["children"])
navs = []
for ul in soup.find_all("ul", recursive=False):
extract_level_recursive(ul, navs)
return navs
# -----------------------------------------------------------------------------
def setup_edit_url(app, pagename, templatename, context, doctree):
"""Add a function that jinja can access for returning the edit URL of a page."""
def get_edit_url():
"""Return a URL for an "edit this page" link."""
file_name = f"{pagename}{context['page_source_suffix']}"
# Make sure that doc_path has a path separator only if it exists (to avoid //)
doc_path = context.get("doc_path", "")
if doc_path and not doc_path.endswith("/"):
doc_path = f"{doc_path}/"
default_provider_urls = {
"bitbucket_url": "https://bitbucket.org",
"github_url": "https://github.com",
"gitlab_url": "https://gitlab.com",
}
edit_url_attrs = {}
# ensure custom URL is checked first, if given
url_template = context.get("edit_page_url_template")
if url_template is not None:
if "file_name" not in url_template:
raise ExtensionError(
"Missing required value for `use_edit_page_button`. "
"Ensure `file_name` appears in `edit_page_url_template`: "
f"{url_template}"
)
edit_url_attrs[("edit_page_url_template",)] = url_template
edit_url_attrs.update(
{
("bitbucket_user", "bitbucket_repo", "bitbucket_version"): (
"{{ bitbucket_url }}/{{ bitbucket_user }}/{{ bitbucket_repo }}"
"/carl/{{ bitbucket_version }}"
"/{{ doc_path }}{{ file_name }}?mode=edit"
),
("github_user", "github_repo", "github_version"): (
"{{ github_url }}/{{ github_user }}/{{ github_repo }}"
"/edit/{{ github_version }}/{{ doc_path }}{{ file_name }}"
),
("gitlab_user", "gitlab_repo", "gitlab_version"): (
"{{ gitlab_url }}/{{ gitlab_user }}/{{ gitlab_repo }}"
"/-/edit/{{ gitlab_version }}/{{ doc_path }}{{ file_name }}"
),
}
)
doc_context = dict(default_provider_urls)
doc_context.update(context)
doc_context.update(doc_path=doc_path, file_name=file_name)
for attrs, url_template in edit_url_attrs.items():
if all(doc_context.get(attr) not in [None, "None"] for attr in attrs):
return jinja2.Template(url_template).render(**doc_context)
raise ExtensionError(
"Missing required value for `use_edit_page_button`. "
"Ensure one set of the following in your `html_context` "
f"configuration: {sorted(edit_url_attrs.keys())}"
)
context["get_edit_url"] = get_edit_url
# Ensure that the max TOC level is an integer
context["theme_show_toc_level"] = int(context.get("theme_show_toc_level", 1))
# -----------------------------------------------------------------------------
from distutils.version import LooseVersion
from docutils import nodes
import sphinx
from sphinx.writers.html5 import HTML5Translator
from sphinx.util import logging
from sphinx.ext.autosummary import autosummary_table
class BootstrapHTML5Translator(HTML5Translator):
"""Custom HTML Translator for a Bootstrap-ified Sphinx layout
This is a specialization of the HTML5 Translator of sphinx.
Only a couple of functions have been overridden to produce valid HTML to be
directly styled with Bootstrap, and fulfill acessibility best practices.
"""
def __init__(self, *args, **kwds):
super().__init__(*args, **kwds)
self.settings.table_style = "table"
def starttag(self, *args, **kwargs):
"""ensure an aria-level is set for any heading role"""
if kwargs.get("ROLE") == "heading" and "ARIA-LEVEL" not in kwargs:
kwargs["ARIA-LEVEL"] = "2"
return super().starttag(*args, **kwargs)
def visit_table(self, node):
# type: (nodes.Element) -> None
# copy of sphinx source to *not* add 'docutils' and 'align-default' classes
# but add 'table' class
# generate_targets_for_table is deprecated in 4.0
if LooseVersion(sphinx.__version__) < LooseVersion("4.0"):
self.generate_targets_for_table(node)
self._table_row_index = 0
classes = [cls.strip(" \t\n") for cls in self.settings.table_style.split(",")]
# we're looking at the 'real_table', which is wrapped by an autosummary
if isinstance(node.parent, autosummary_table):
classes += ["autosummary"]
# classes.insert(0, "docutils") # compat
# if 'align' in node:
# classes.append('align-%s' % node['align'])
tag = self.starttag(node, "table", CLASS=" ".join(classes))
self.body.append(tag)
# -----------------------------------------------------------------------------
def get_html_theme_path():
"""Return list of HTML theme paths."""
theme_path = os.path.abspath(os.path.dirname(__file__))
return [theme_path]
def setup(app):
print("hi")
theme_path = get_html_theme_path()[0]
app.add_html_theme("smac_theme", theme_path)
app.set_translator("html", BootstrapHTML5Translator)
# Read the Docs uses ``readthedocs`` as the name of the build, and also
# uses a special "dirhtml" builder so we need to replace these both with
# our custom HTML builder
app.set_translator("readthedocs", BootstrapHTML5Translator, override=True)
app.set_translator("readthedocsdirhtml", BootstrapHTML5Translator, override=True)
app.connect("env-updated", update_config)
app.connect("html-page-context", setup_edit_url)
app.connect("html-page-context", add_toctree_functions)
app.connect("html-page-context", update_templates)
# Update templates for sidebar
pkgdir = os.path.abspath(os.path.dirname(__file__))
path_templates = os.path.join(pkgdir, "templates")
app.config.templates_path.append(path_templates)
return {"parallel_read_safe": True, "parallel_write_safe": True}
| 22,899 | 35.349206 | 89 | py |
null | CARL-main/docs/themes/smac/title.html | <h4 class="mt-0 mb-0">{{ project }}</h4>
<div class="mb-3">v{{ version }}</div> | 79 | 39 | 40 | html |
null | CARL-main/docs/themes/smac/static/webpack-macros.html | <!-- these macros are generated by "yarn build:production". do not edit by hand. -->
{% macro head_pre_icons() %}
<link rel="stylesheet"
href="{{ pathto('_static/vendor/fontawesome/5.13.0/css/all.min.css', 1) }}">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="{{ pathto('_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2', 1) }}">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="{{ pathto('_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2', 1) }}">
{% endmacro %}
{% macro head_pre_fonts() %}
{% endmacro %}
{% macro head_pre_bootstrap() %}
<link href="{{ pathto('_static/css/theme.css', 1) }}" rel="stylesheet">
<link href="{{ pathto('_static/css/index.ac9c05f7c49ca1e1f876c6e36360ea26.css', 1) }}" rel="stylesheet">
{% endmacro %}
{% macro head_js_preload() %}
<link rel="preload" as="script" href="{{ pathto('_static/js/index.9ea38e314b9e6d9dab77.js', 1) }}">
{% endmacro %}
{% macro body_post() %}
<script src="{{ pathto('_static/js/index.9ea38e314b9e6d9dab77.js', 1) }}"></script>
{% endmacro %} | 1,094 | 42.8 | 106 | html |
null | CARL-main/docs/themes/smac/static/css/custom.css | .bd-search {
margin: 0;
padding-left: 0;
padding-right: 0;
}
.bd-search .icon {
left: 10px;
}
#navbar-collapsible {
padding: 0;
}
#navbar-icon-links {
margin: 0 15px 0 0;
}
.navbar-nav {
flex-direction: row;
}
.navbar-light .navbar-nav li a.nav-link {
padding: 0 5px 0 0;
}
@media (max-width:959.98px){.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid,.navbar-expand-lg>.container-lg,.navbar-expand-lg>.container-md,.navbar-expand-lg>.container-sm,.navbar-expand-lg>.container-xl{
padding-right: 15px;
padding-left: 15px;
}}
p.sphx-glr-signature, p.sphx-glr-timing, .sphx-glr-download, .sphx-glr-download-link-note {
display: none;
}
.sphx-glr-thumbcontainer::before {
display: none !important;
}
.sphx-glr-thumbcontainer {
margin: 1px 0 !important;
background-color: grey;
min-height: auto !important;
padding: 0 !important;
width: 100% !important;
border: 0 !important;
}
.sphx-glr-thumbcontainer a.headerlink {
display: none;
}
.sphx-glr-thumbcontainer p {
margin: 0 !important;
}
.sphx-glr-thumbcontainer .figure {
height: auto !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
}
.sphx-glr-thumbcontainer .figure p.caption {
padding: 0 !important;
}
.sphx-glr-thumbcontainer .figure p.caption:hover {
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
.sphx-glr-thumbcontainer img {
display: none !important;
}
.sphx-glr-thumbcontainer .figure img {
display: none !important;
}
.sphx-glr-thumbcontainer a.internal {
position: relative !important;
padding: 30px 15px !important;
background-color: rgb(128, 128, 128) !important;
color: white !important;
border: 0 !important;
vertical-align: middle;
border-radius: 5px;
}
.sphx-glr-thumbcontainer a.internal:hover {
background-color: rgb(60, 60, 60) !important;
border: 0 !important;
box-shadow: none !important;
-webkit-box-shadow: none !important;
text-decoration: none;
}
/* Disable tooltip */
.sphx-glr-thumbcontainer::after {
display: none !important;
}
.sphx-glr-thumbcontainer:hover {
border: 0 !important;
box-shadow: none !important;
}
.sphx-glr-thumbcontainer[tooltip]::before, .sphx-glr-thumbcontainer[tooltip]::after,
.sphx-glr-thumbcontainer[tooltip]:hover::before, .sphx-glr-thumbcontainer[tooltip]:hover::after {
display: none;
} | 2,464 | 20.25 | 220 | css |
null | CARL-main/docs/themes/smac/static/css/index.ac9c05f7c49ca1e1f876c6e36360ea26.css | /*!
* Bootstrap v4.6.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/:root{--blue:#007bff;--indigo:#6610f2;--purple:#6f42c1;--pink:#e83e8c;--red:#dc3545;--orange:#fd7e14;--yellow:#ffc107;--green:#28a745;--teal:#20c997;--cyan:#17a2b8;--white:#fff;--gray:#6c757d;--gray-dark:#343a40;--primary:#007bff;--secondary:#6c757d;--success:#28a745;--info:#17a2b8;--warning:#ffc107;--danger:#dc3545;--light:#f8f9fa;--dark:#343a40;--breakpoint-xs:0;--breakpoint-sm:540px;--breakpoint-md:720px;--breakpoint-lg:960px;--breakpoint-xl:1200px;--font-family-sans-serif:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace}*,:after,:before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0)}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Liberation Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-size:1rem;line-height:1.5;color:#212529;text-align:left}[tabindex="-1"]:focus:not(:focus-visible){outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;text-decoration:underline dotted;cursor:help;border-bottom:0;text-decoration-skip-ink:none}address{font-style:normal;line-height:inherit}address,dl,ol,ul{margin-bottom:1rem}dl,ol,ul{margin-top:0}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;background-color:transparent}a:hover{color:#0056b3}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto;-ms-overflow-style:scrollbar}figure{margin:0 0 1rem}img{border-style:none}img,svg{vertical-align:middle}svg{overflow:hidden}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit;text-align:-webkit-match-parent}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-bottom:.5rem;font-weight:500;line-height:1.2}.h1,h1{font-size:2.5rem}.h2,h2{font-size:2rem}.h3,h3{font-size:1.75rem}.h4,h4{font-size:1.5rem}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:6rem}.display-1,.display-2{font-weight:300;line-height:1.2}.display-2{font-size:5.5rem}.display-3{font-size:4.5rem}.display-3,.display-4{font-weight:300;line-height:1.2}.display-4{font-size:3.5rem}hr{margin-top:1rem;margin-bottom:1rem;border-top:1px solid rgba(0,0,0,.1)}.small,small{font-size:80%;font-weight:400}.mark,mark{padding:.2em;background-color:#fcf8e3}.list-inline,.list-unstyled{padding-left:0;list-style:none}.list-inline-item{display:inline-block}.list-inline-item:not(:last-child){margin-right:.5rem}.initialism{font-size:90%;text-transform:uppercase}.blockquote{margin-bottom:1rem;font-size:1.25rem}.blockquote-footer{display:block;font-size:80%;color:#6c757d}.blockquote-footer:before{content:"\2014\00A0"}.img-fluid,.img-thumbnail{max-width:100%;height:auto}.img-thumbnail{padding:.25rem;background-color:#fff;border:1px solid #dee2e6;border-radius:.25rem}.figure{display:inline-block}.figure-img{margin-bottom:.5rem;line-height:1}.figure-caption{font-size:90%;color:#6c757d}code{font-size:87.5%;color:#e83e8c;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:87.5%;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:100%;font-weight:700}pre{display:block;font-size:87.5%;color:#212529}pre code{font-size:inherit;color:inherit;word-break:normal}.pre-scrollable{max-height:340px;overflow-y:scroll}.container,.container-fluid,.container-lg,.container-md,.container-sm,.container-xl{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:540px){.container,.container-sm{max-width:540px}}@media (min-width:720px){.container,.container-md,.container-sm{max-width:720px}}@media (min-width:960px){.container,.container-lg,.container-md,.container-sm{max-width:960px}}@media (min-width:1200px){.container,.container-lg,.container-md,.container-sm,.container-xl{max-width:1400px}}.row{display:flex;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*=col-]{padding-right:0;padding-left:0}.col,.col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12,.col-auto,.col-lg,.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-auto,.col-md,.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12,.col-md-auto,.col-sm,.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-auto,.col-xl,.col-xl-1,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-auto{position:relative;width:100%;padding-right:15px;padding-left:15px}.col{flex-basis:0;flex-grow:1;max-width:100%}.row-cols-1>*{flex:0 0 100%;max-width:100%}.row-cols-2>*{flex:0 0 50%;max-width:50%}.row-cols-3>*{flex:0 0 33.33333%;max-width:33.33333%}.row-cols-4>*{flex:0 0 25%;max-width:25%}.row-cols-5>*{flex:0 0 20%;max-width:20%}.row-cols-6>*{flex:0 0 16.66667%;max-width:16.66667%}.col-auto{flex:0 0 auto;width:auto;max-width:100%}.col-1{flex:0 0 8.33333%;max-width:8.33333%}.col-2{flex:0 0 16.66667%;max-width:16.66667%}.col-3{flex:0 0 25%;max-width:25%}.col-4{flex:0 0 33.33333%;max-width:33.33333%}.col-5{flex:0 0 41.66667%;max-width:41.66667%}.col-6{flex:0 0 50%;max-width:50%}.col-7{flex:0 0 58.33333%;max-width:58.33333%}.col-8{flex:0 0 66.66667%;max-width:66.66667%}.col-9{flex:0 0 75%;max-width:75%}.col-10{flex:0 0 83.33333%;max-width:83.33333%}.col-11{flex:0 0 91.66667%;max-width:91.66667%}.col-12{flex:0 0 100%;max-width:100%}.order-first{order:-1}.order-last{order:13}.order-0{order:0}.order-1{order:1}.order-2{order:2}.order-3{order:3}.order-4{order:4}.order-5{order:5}.order-6{order:6}.order-7{order:7}.order-8{order:8}.order-9{order:9}.order-10{order:10}.order-11{order:11}.order-12{order:12}.offset-1{margin-left:8.33333%}.offset-2{margin-left:16.66667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.33333%}.offset-5{margin-left:41.66667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.33333%}.offset-8{margin-left:66.66667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.33333%}.offset-11{margin-left:91.66667%}@media (min-width:540px){.col-sm{flex-basis:0;flex-grow:1;max-width:100%}.row-cols-sm-1>*{flex:0 0 100%;max-width:100%}.row-cols-sm-2>*{flex:0 0 50%;max-width:50%}.row-cols-sm-3>*{flex:0 0 33.33333%;max-width:33.33333%}.row-cols-sm-4>*{flex:0 0 25%;max-width:25%}.row-cols-sm-5>*{flex:0 0 20%;max-width:20%}.row-cols-sm-6>*{flex:0 0 16.66667%;max-width:16.66667%}.col-sm-auto{flex:0 0 auto;width:auto;max-width:100%}.col-sm-1{flex:0 0 8.33333%;max-width:8.33333%}.col-sm-2{flex:0 0 16.66667%;max-width:16.66667%}.col-sm-3{flex:0 0 25%;max-width:25%}.col-sm-4{flex:0 0 33.33333%;max-width:33.33333%}.col-sm-5{flex:0 0 41.66667%;max-width:41.66667%}.col-sm-6{flex:0 0 50%;max-width:50%}.col-sm-7{flex:0 0 58.33333%;max-width:58.33333%}.col-sm-8{flex:0 0 66.66667%;max-width:66.66667%}.col-sm-9{flex:0 0 75%;max-width:75%}.col-sm-10{flex:0 0 83.33333%;max-width:83.33333%}.col-sm-11{flex:0 0 91.66667%;max-width:91.66667%}.col-sm-12{flex:0 0 100%;max-width:100%}.order-sm-first{order:-1}.order-sm-last{order:13}.order-sm-0{order:0}.order-sm-1{order:1}.order-sm-2{order:2}.order-sm-3{order:3}.order-sm-4{order:4}.order-sm-5{order:5}.order-sm-6{order:6}.order-sm-7{order:7}.order-sm-8{order:8}.order-sm-9{order:9}.order-sm-10{order:10}.order-sm-11{order:11}.order-sm-12{order:12}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.33333%}.offset-sm-2{margin-left:16.66667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.33333%}.offset-sm-5{margin-left:41.66667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.33333%}.offset-sm-8{margin-left:66.66667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.33333%}.offset-sm-11{margin-left:91.66667%}}@media (min-width:720px){.col-md{flex-basis:0;flex-grow:1;max-width:100%}.row-cols-md-1>*{flex:0 0 100%;max-width:100%}.row-cols-md-2>*{flex:0 0 50%;max-width:50%}.row-cols-md-3>*{flex:0 0 33.33333%;max-width:33.33333%}.row-cols-md-4>*{flex:0 0 25%;max-width:25%}.row-cols-md-5>*{flex:0 0 20%;max-width:20%}.row-cols-md-6>*{flex:0 0 16.66667%;max-width:16.66667%}.col-md-auto{flex:0 0 auto;width:auto;max-width:100%}.col-md-1{flex:0 0 8.33333%;max-width:8.33333%}.col-md-2{flex:0 0 16.66667%;max-width:16.66667%}.col-md-3{flex:0 0 25%;max-width:25%}.col-md-4{flex:0 0 33.33333%;max-width:33.33333%}.col-md-5{flex:0 0 41.66667%;max-width:41.66667%}.col-md-6{flex:0 0 50%;max-width:50%}.col-md-7{flex:0 0 58.33333%;max-width:58.33333%}.col-md-8{flex:0 0 66.66667%;max-width:66.66667%}.col-md-9{flex:0 0 75%;max-width:75%}.col-md-10{flex:0 0 83.33333%;max-width:83.33333%}.col-md-11{flex:0 0 91.66667%;max-width:91.66667%}.col-md-12{flex:0 0 100%;max-width:100%}.order-md-first{order:-1}.order-md-last{order:13}.order-md-0{order:0}.order-md-1{order:1}.order-md-2{order:2}.order-md-3{order:3}.order-md-4{order:4}.order-md-5{order:5}.order-md-6{order:6}.order-md-7{order:7}.order-md-8{order:8}.order-md-9{order:9}.order-md-10{order:10}.order-md-11{order:11}.order-md-12{order:12}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.33333%}.offset-md-2{margin-left:16.66667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.33333%}.offset-md-5{margin-left:41.66667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.33333%}.offset-md-8{margin-left:66.66667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.33333%}.offset-md-11{margin-left:91.66667%}}@media (min-width:960px){.col-lg{flex-basis:0;flex-grow:1;max-width:100%}.row-cols-lg-1>*{flex:0 0 100%;max-width:100%}.row-cols-lg-2>*{flex:0 0 50%;max-width:50%}.row-cols-lg-3>*{flex:0 0 33.33333%;max-width:33.33333%}.row-cols-lg-4>*{flex:0 0 25%;max-width:25%}.row-cols-lg-5>*{flex:0 0 20%;max-width:20%}.row-cols-lg-6>*{flex:0 0 16.66667%;max-width:16.66667%}.col-lg-auto{flex:0 0 auto;width:auto;max-width:100%}.col-lg-1{flex:0 0 8.33333%;max-width:8.33333%}.col-lg-2{flex:0 0 16.66667%;max-width:16.66667%}.col-lg-3{flex:0 0 25%;max-width:25%}.col-lg-4{flex:0 0 33.33333%;max-width:33.33333%}.col-lg-5{flex:0 0 41.66667%;max-width:41.66667%}.col-lg-6{flex:0 0 50%;max-width:50%}.col-lg-7{flex:0 0 58.33333%;max-width:58.33333%}.col-lg-8{flex:0 0 66.66667%;max-width:66.66667%}.col-lg-9{flex:0 0 75%;max-width:75%}.col-lg-10{flex:0 0 83.33333%;max-width:83.33333%}.col-lg-11{flex:0 0 91.66667%;max-width:91.66667%}.col-lg-12{flex:0 0 100%;max-width:100%}.order-lg-first{order:-1}.order-lg-last{order:13}.order-lg-0{order:0}.order-lg-1{order:1}.order-lg-2{order:2}.order-lg-3{order:3}.order-lg-4{order:4}.order-lg-5{order:5}.order-lg-6{order:6}.order-lg-7{order:7}.order-lg-8{order:8}.order-lg-9{order:9}.order-lg-10{order:10}.order-lg-11{order:11}.order-lg-12{order:12}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.33333%}.offset-lg-2{margin-left:16.66667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.33333%}.offset-lg-5{margin-left:41.66667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.33333%}.offset-lg-8{margin-left:66.66667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.33333%}.offset-lg-11{margin-left:91.66667%}}@media (min-width:1200px){.col-xl{flex-basis:0;flex-grow:1;max-width:100%}.row-cols-xl-1>*{flex:0 0 100%;max-width:100%}.row-cols-xl-2>*{flex:0 0 50%;max-width:50%}.row-cols-xl-3>*{flex:0 0 33.33333%;max-width:33.33333%}.row-cols-xl-4>*{flex:0 0 25%;max-width:25%}.row-cols-xl-5>*{flex:0 0 20%;max-width:20%}.row-cols-xl-6>*{flex:0 0 16.66667%;max-width:16.66667%}.col-xl-auto{flex:0 0 auto;width:auto;max-width:100%}.col-xl-1{flex:0 0 8.33333%;max-width:8.33333%}.col-xl-2{flex:0 0 16.66667%;max-width:16.66667%}.col-xl-3{flex:0 0 25%;max-width:25%}.col-xl-4{flex:0 0 33.33333%;max-width:33.33333%}.col-xl-5{flex:0 0 41.66667%;max-width:41.66667%}.col-xl-6{flex:0 0 50%;max-width:50%}.col-xl-7{flex:0 0 58.33333%;max-width:58.33333%}.col-xl-8{flex:0 0 66.66667%;max-width:66.66667%}.col-xl-9{flex:0 0 75%;max-width:75%}.col-xl-10{flex:0 0 83.33333%;max-width:83.33333%}.col-xl-11{flex:0 0 91.66667%;max-width:91.66667%}.col-xl-12{flex:0 0 100%;max-width:100%}.order-xl-first{order:-1}.order-xl-last{order:13}.order-xl-0{order:0}.order-xl-1{order:1}.order-xl-2{order:2}.order-xl-3{order:3}.order-xl-4{order:4}.order-xl-5{order:5}.order-xl-6{order:6}.order-xl-7{order:7}.order-xl-8{order:8}.order-xl-9{order:9}.order-xl-10{order:10}.order-xl-11{order:11}.order-xl-12{order:12}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.33333%}.offset-xl-2{margin-left:16.66667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.33333%}.offset-xl-5{margin-left:41.66667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.33333%}.offset-xl-8{margin-left:66.66667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.33333%}.offset-xl-11{margin-left:91.66667%}}.table{width:100%;margin-bottom:1rem;color:#212529}.table td,.table th{padding:.75rem;vertical-align:top;border-top:1px solid #dee2e6}.table thead th{vertical-align:bottom;border-bottom:2px solid #dee2e6}.table tbody+tbody{border-top:2px solid #dee2e6}.table-sm td,.table-sm th{padding:.3rem}.table-bordered,.table-bordered td,.table-bordered th{border:1px solid #dee2e6}.table-bordered thead td,.table-bordered thead th{border-bottom-width:2px}.table-borderless tbody+tbody,.table-borderless td,.table-borderless th,.table-borderless thead th{border:0}.table-striped tbody tr:nth-of-type(odd){background-color:rgba(0,0,0,.05)}.table-hover tbody tr:hover{color:#212529;background-color:rgba(0,0,0,.075)}.table-primary,.table-primary>td,.table-primary>th{background-color:#b8daff}.table-primary tbody+tbody,.table-primary td,.table-primary th,.table-primary thead th{border-color:#7abaff}.table-hover .table-primary:hover,.table-hover .table-primary:hover>td,.table-hover .table-primary:hover>th{background-color:#9fcdff}.table-secondary,.table-secondary>td,.table-secondary>th{background-color:#d6d8db}.table-secondary tbody+tbody,.table-secondary td,.table-secondary th,.table-secondary thead th{border-color:#b3b7bb}.table-hover .table-secondary:hover,.table-hover .table-secondary:hover>td,.table-hover .table-secondary:hover>th{background-color:#c8cbcf}.table-success,.table-success>td,.table-success>th{background-color:#c3e6cb}.table-success tbody+tbody,.table-success td,.table-success th,.table-success thead th{border-color:#8fd19e}.table-hover .table-success:hover,.table-hover .table-success:hover>td,.table-hover .table-success:hover>th{background-color:#b1dfbb}.table-info,.table-info>td,.table-info>th{background-color:#bee5eb}.table-info tbody+tbody,.table-info td,.table-info th,.table-info thead th{border-color:#86cfda}.table-hover .table-info:hover,.table-hover .table-info:hover>td,.table-hover .table-info:hover>th{background-color:#abdde5}.table-warning,.table-warning>td,.table-warning>th{background-color:#ffeeba}.table-warning tbody+tbody,.table-warning td,.table-warning th,.table-warning thead th{border-color:#ffdf7e}.table-hover .table-warning:hover,.table-hover .table-warning:hover>td,.table-hover .table-warning:hover>th{background-color:#ffe8a1}.table-danger,.table-danger>td,.table-danger>th{background-color:#f5c6cb}.table-danger tbody+tbody,.table-danger td,.table-danger th,.table-danger thead th{border-color:#ed969e}.table-hover .table-danger:hover,.table-hover .table-danger:hover>td,.table-hover .table-danger:hover>th{background-color:#f1b0b7}.table-light,.table-light>td,.table-light>th{background-color:#fdfdfe}.table-light tbody+tbody,.table-light td,.table-light th,.table-light thead th{border-color:#fbfcfc}.table-hover .table-light:hover,.table-hover .table-light:hover>td,.table-hover .table-light:hover>th{background-color:#ececf6}.table-dark,.table-dark>td,.table-dark>th{background-color:#c6c8ca}.table-dark tbody+tbody,.table-dark td,.table-dark th,.table-dark thead th{border-color:#95999c}.table-hover .table-dark:hover,.table-hover .table-dark:hover>td,.table-hover .table-dark:hover>th{background-color:#b9bbbe}.table-active,.table-active>td,.table-active>th,.table-hover .table-active:hover,.table-hover .table-active:hover>td,.table-hover .table-active:hover>th{background-color:rgba(0,0,0,.075)}.table .thead-dark th{color:#fff;background-color:#343a40;border-color:#454d55}.table .thead-light th{color:#495057;background-color:#e9ecef;border-color:#dee2e6}.table-dark{color:#fff;background-color:#343a40}.table-dark td,.table-dark th,.table-dark thead th{border-color:#454d55}.table-dark.table-bordered{border:0}.table-dark.table-striped tbody tr:nth-of-type(odd){background-color:hsla(0,0%,100%,.05)}.table-dark.table-hover tbody tr:hover{color:#fff;background-color:hsla(0,0%,100%,.075)}@media (max-width:539.98px){.table-responsive-sm{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-sm>.table-bordered{border:0}}@media (max-width:719.98px){.table-responsive-md{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-md>.table-bordered{border:0}}@media (max-width:959.98px){.table-responsive-lg{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-lg>.table-bordered{border:0}}@media (max-width:1199.98px){.table-responsive-xl{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive-xl>.table-bordered{border:0}}.table-responsive{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.table-responsive>.table-bordered{border:0}.form-control{display:block;width:100%;height:calc(1.5em + .75rem + 2px);padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;border-radius:.25rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control::-ms-expand{background-color:transparent;border:0}.form-control:-moz-focusring{color:transparent;text-shadow:0 0 0 #495057}.form-control:focus{color:#495057;background-color:#fff;border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.form-control::placeholder{color:#6c757d;opacity:1}.form-control:disabled,.form-control[readonly]{background-color:#e9ecef;opacity:1}input[type=date].form-control,input[type=datetime-local].form-control,input[type=month].form-control,input[type=time].form-control{appearance:none}select.form-control:focus::-ms-value{color:#495057;background-color:#fff}.form-control-file,.form-control-range{display:block;width:100%}.col-form-label{padding-top:calc(.375rem + 1px);padding-bottom:calc(.375rem + 1px);margin-bottom:0;font-size:inherit;line-height:1.5}.col-form-label-lg{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);font-size:1.25rem;line-height:1.5}.col-form-label-sm{padding-top:calc(.25rem + 1px);padding-bottom:calc(.25rem + 1px);font-size:.875rem;line-height:1.5}.form-control-plaintext{display:block;width:100%;padding:.375rem 0;margin-bottom:0;font-size:1rem;line-height:1.5;color:#212529;background-color:transparent;border:solid transparent;border-width:1px 0}.form-control-plaintext.form-control-lg,.form-control-plaintext.form-control-sm{padding-right:0;padding-left:0}.form-control-sm{height:calc(1.5em + .5rem + 2px);padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.form-control-lg{height:calc(1.5em + 1rem + 2px);padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}select.form-control[multiple],select.form-control[size],textarea.form-control{height:auto}.form-group{margin-bottom:1rem}.form-text{display:block;margin-top:.25rem}.form-row{display:flex;flex-wrap:wrap;margin-right:-5px;margin-left:-5px}.form-row>.col,.form-row>[class*=col-]{padding-right:5px;padding-left:5px}.form-check{position:relative;display:block;padding-left:1.25rem}.form-check-input{position:absolute;margin-top:.3rem;margin-left:-1.25rem}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{color:#6c757d}.form-check-label{margin-bottom:0}.form-check-inline{display:inline-flex;align-items:center;padding-left:0;margin-right:.75rem}.form-check-inline .form-check-input{position:static;margin-top:0;margin-right:.3125rem;margin-left:0}.valid-feedback{display:none;width:100%;margin-top:.25rem;font-size:80%;color:#28a745}.valid-tooltip{position:absolute;top:100%;left:0;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;line-height:1.5;color:#fff;background-color:rgba(40,167,69,.9);border-radius:.25rem}.form-row>.col>.valid-tooltip,.form-row>[class*=col-]>.valid-tooltip{left:5px}.is-valid~.valid-feedback,.is-valid~.valid-tooltip,.was-validated :valid~.valid-feedback,.was-validated :valid~.valid-tooltip{display:block}.form-control.is-valid,.was-validated .form-control:valid{border-color:#28a745;padding-right:calc(1.5em + .75rem);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right calc(.375em + .1875rem) center;background-size:calc(.75em + .375rem) calc(.75em + .375rem)}.form-control.is-valid:focus,.was-validated .form-control:valid:focus{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.was-validated textarea.form-control:valid,textarea.form-control.is-valid{padding-right:calc(1.5em + .75rem);background-position:top calc(.375em + .1875rem) right calc(.375em + .1875rem)}.custom-select.is-valid,.was-validated .custom-select:valid{border-color:#28a745;padding-right:calc(.75em + 2.3125rem);background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") right .75rem center/8px 10px no-repeat,#fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3E%3C/svg%3E") center right 1.75rem/calc(.75em + .375rem) calc(.75em + .375rem) no-repeat}.custom-select.is-valid:focus,.was-validated .custom-select:valid:focus{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.form-check-input.is-valid~.form-check-label,.was-validated .form-check-input:valid~.form-check-label{color:#28a745}.form-check-input.is-valid~.valid-feedback,.form-check-input.is-valid~.valid-tooltip,.was-validated .form-check-input:valid~.valid-feedback,.was-validated .form-check-input:valid~.valid-tooltip{display:block}.custom-control-input.is-valid~.custom-control-label,.was-validated .custom-control-input:valid~.custom-control-label{color:#28a745}.custom-control-input.is-valid~.custom-control-label:before,.was-validated .custom-control-input:valid~.custom-control-label:before{border-color:#28a745}.custom-control-input.is-valid:checked~.custom-control-label:before,.was-validated .custom-control-input:valid:checked~.custom-control-label:before{border-color:#34ce57;background-color:#34ce57}.custom-control-input.is-valid:focus~.custom-control-label:before,.was-validated .custom-control-input:valid:focus~.custom-control-label:before{box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.custom-control-input.is-valid:focus:not(:checked)~.custom-control-label:before,.custom-file-input.is-valid~.custom-file-label,.was-validated .custom-control-input:valid:focus:not(:checked)~.custom-control-label:before,.was-validated .custom-file-input:valid~.custom-file-label{border-color:#28a745}.custom-file-input.is-valid:focus~.custom-file-label,.was-validated .custom-file-input:valid:focus~.custom-file-label{border-color:#28a745;box-shadow:0 0 0 .2rem rgba(40,167,69,.25)}.invalid-feedback{display:none;width:100%;margin-top:.25rem;font-size:80%;color:#dc3545}.invalid-tooltip{position:absolute;top:100%;left:0;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;line-height:1.5;color:#fff;background-color:rgba(220,53,69,.9);border-radius:.25rem}.form-row>.col>.invalid-tooltip,.form-row>[class*=col-]>.invalid-tooltip{left:5px}.is-invalid~.invalid-feedback,.is-invalid~.invalid-tooltip,.was-validated :invalid~.invalid-feedback,.was-validated :invalid~.invalid-tooltip{display:block}.form-control.is-invalid,.was-validated .form-control:invalid{border-color:#dc3545;padding-right:calc(1.5em + .75rem);background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3E%3Ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right calc(.375em + .1875rem) center;background-size:calc(.75em + .375rem) calc(.75em + .375rem)}.form-control.is-invalid:focus,.was-validated .form-control:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.was-validated textarea.form-control:invalid,textarea.form-control.is-invalid{padding-right:calc(1.5em + .75rem);background-position:top calc(.375em + .1875rem) right calc(.375em + .1875rem)}.custom-select.is-invalid,.was-validated .custom-select:invalid{border-color:#dc3545;padding-right:calc(.75em + 2.3125rem);background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") right .75rem center/8px 10px no-repeat,#fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3E%3Ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3E%3C/svg%3E") center right 1.75rem/calc(.75em + .375rem) calc(.75em + .375rem) no-repeat}.custom-select.is-invalid:focus,.was-validated .custom-select:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.form-check-input.is-invalid~.form-check-label,.was-validated .form-check-input:invalid~.form-check-label{color:#dc3545}.form-check-input.is-invalid~.invalid-feedback,.form-check-input.is-invalid~.invalid-tooltip,.was-validated .form-check-input:invalid~.invalid-feedback,.was-validated .form-check-input:invalid~.invalid-tooltip{display:block}.custom-control-input.is-invalid~.custom-control-label,.was-validated .custom-control-input:invalid~.custom-control-label{color:#dc3545}.custom-control-input.is-invalid~.custom-control-label:before,.was-validated .custom-control-input:invalid~.custom-control-label:before{border-color:#dc3545}.custom-control-input.is-invalid:checked~.custom-control-label:before,.was-validated .custom-control-input:invalid:checked~.custom-control-label:before{border-color:#e4606d;background-color:#e4606d}.custom-control-input.is-invalid:focus~.custom-control-label:before,.was-validated .custom-control-input:invalid:focus~.custom-control-label:before{box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.custom-control-input.is-invalid:focus:not(:checked)~.custom-control-label:before,.custom-file-input.is-invalid~.custom-file-label,.was-validated .custom-control-input:invalid:focus:not(:checked)~.custom-control-label:before,.was-validated .custom-file-input:invalid~.custom-file-label{border-color:#dc3545}.custom-file-input.is-invalid:focus~.custom-file-label,.was-validated .custom-file-input:invalid:focus~.custom-file-label{border-color:#dc3545;box-shadow:0 0 0 .2rem rgba(220,53,69,.25)}.form-inline{display:flex;flex-flow:row wrap;align-items:center}.form-inline .form-check{width:100%}@media (min-width:540px){.form-inline label{justify-content:center}.form-inline .form-group,.form-inline label{display:flex;align-items:center;margin-bottom:0}.form-inline .form-group{flex:0 0 auto;flex-flow:row wrap}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-plaintext{display:inline-block}.form-inline .custom-select,.form-inline .input-group{width:auto}.form-inline .form-check{display:flex;align-items:center;justify-content:center;width:auto;padding-left:0}.form-inline .form-check-input{position:relative;flex-shrink:0;margin-top:0;margin-right:.25rem;margin-left:0}.form-inline .custom-control{align-items:center;justify-content:center}.form-inline .custom-control-label{margin-bottom:0}}.btn{display:inline-block;font-weight:400;color:#212529;text-align:center;vertical-align:middle;user-select:none;background-color:transparent;border:1px solid transparent;padding:.375rem .75rem;font-size:1rem;line-height:1.5;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn:hover{color:#212529;text-decoration:none}.btn.focus,.btn:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.btn.disabled,.btn:disabled{opacity:.65}.btn:not(:disabled):not(.disabled){cursor:pointer}a.btn.disabled,fieldset:disabled a.btn{pointer-events:none}.btn-primary{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary.focus,.btn-primary:focus,.btn-primary:hover{color:#fff;background-color:#0069d9;border-color:#0062cc}.btn-primary.focus,.btn-primary:focus{box-shadow:0 0 0 .2rem rgba(38,143,255,.5)}.btn-primary.disabled,.btn-primary:disabled{color:#fff;background-color:#007bff;border-color:#007bff}.btn-primary:not(:disabled):not(.disabled).active,.btn-primary:not(:disabled):not(.disabled):active,.show>.btn-primary.dropdown-toggle{color:#fff;background-color:#0062cc;border-color:#005cbf}.btn-primary:not(:disabled):not(.disabled).active:focus,.btn-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(38,143,255,.5)}.btn-secondary{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-secondary.focus,.btn-secondary:focus,.btn-secondary:hover{color:#fff;background-color:#5a6268;border-color:#545b62}.btn-secondary.focus,.btn-secondary:focus{box-shadow:0 0 0 .2rem rgba(130,138,145,.5)}.btn-secondary.disabled,.btn-secondary:disabled{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-secondary:not(:disabled):not(.disabled).active,.btn-secondary:not(:disabled):not(.disabled):active,.show>.btn-secondary.dropdown-toggle{color:#fff;background-color:#545b62;border-color:#4e555b}.btn-secondary:not(:disabled):not(.disabled).active:focus,.btn-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(130,138,145,.5)}.btn-success{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success.focus,.btn-success:focus,.btn-success:hover{color:#fff;background-color:#218838;border-color:#1e7e34}.btn-success.focus,.btn-success:focus{box-shadow:0 0 0 .2rem rgba(72,180,97,.5)}.btn-success.disabled,.btn-success:disabled{color:#fff;background-color:#28a745;border-color:#28a745}.btn-success:not(:disabled):not(.disabled).active,.btn-success:not(:disabled):not(.disabled):active,.show>.btn-success.dropdown-toggle{color:#fff;background-color:#1e7e34;border-color:#1c7430}.btn-success:not(:disabled):not(.disabled).active:focus,.btn-success:not(:disabled):not(.disabled):active:focus,.show>.btn-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(72,180,97,.5)}.btn-info{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info.focus,.btn-info:focus,.btn-info:hover{color:#fff;background-color:#138496;border-color:#117a8b}.btn-info.focus,.btn-info:focus{box-shadow:0 0 0 .2rem rgba(58,176,195,.5)}.btn-info.disabled,.btn-info:disabled{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-info:not(:disabled):not(.disabled).active,.btn-info:not(:disabled):not(.disabled):active,.show>.btn-info.dropdown-toggle{color:#fff;background-color:#117a8b;border-color:#10707f}.btn-info:not(:disabled):not(.disabled).active:focus,.btn-info:not(:disabled):not(.disabled):active:focus,.show>.btn-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(58,176,195,.5)}.btn-warning{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-warning.focus,.btn-warning:focus,.btn-warning:hover{color:#212529;background-color:#e0a800;border-color:#d39e00}.btn-warning.focus,.btn-warning:focus{box-shadow:0 0 0 .2rem rgba(222,170,12,.5)}.btn-warning.disabled,.btn-warning:disabled{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-warning:not(:disabled):not(.disabled).active,.btn-warning:not(:disabled):not(.disabled):active,.show>.btn-warning.dropdown-toggle{color:#212529;background-color:#d39e00;border-color:#c69500}.btn-warning:not(:disabled):not(.disabled).active:focus,.btn-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(222,170,12,.5)}.btn-danger{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger.focus,.btn-danger:focus,.btn-danger:hover{color:#fff;background-color:#c82333;border-color:#bd2130}.btn-danger.focus,.btn-danger:focus{box-shadow:0 0 0 .2rem rgba(225,83,97,.5)}.btn-danger.disabled,.btn-danger:disabled{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-danger:not(:disabled):not(.disabled).active,.btn-danger:not(:disabled):not(.disabled):active,.show>.btn-danger.dropdown-toggle{color:#fff;background-color:#bd2130;border-color:#b21f2d}.btn-danger:not(:disabled):not(.disabled).active:focus,.btn-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(225,83,97,.5)}.btn-light{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light.focus,.btn-light:focus,.btn-light:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.btn-light.focus,.btn-light:focus{box-shadow:0 0 0 .2rem rgba(216,217,219,.5)}.btn-light.disabled,.btn-light:disabled{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-light:not(:disabled):not(.disabled).active,.btn-light:not(:disabled):not(.disabled):active,.show>.btn-light.dropdown-toggle{color:#212529;background-color:#dae0e5;border-color:#d3d9df}.btn-light:not(:disabled):not(.disabled).active:focus,.btn-light:not(:disabled):not(.disabled):active:focus,.show>.btn-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(216,217,219,.5)}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark.focus,.btn-dark:focus,.btn-dark:hover{color:#fff;background-color:#23272b;border-color:#1d2124}.btn-dark.focus,.btn-dark:focus{box-shadow:0 0 0 .2rem rgba(82,88,93,.5)}.btn-dark.disabled,.btn-dark:disabled{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:not(:disabled):not(.disabled).active,.btn-dark:not(:disabled):not(.disabled):active,.show>.btn-dark.dropdown-toggle{color:#fff;background-color:#1d2124;border-color:#171a1d}.btn-dark:not(:disabled):not(.disabled).active:focus,.btn-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(82,88,93,.5)}.btn-outline-primary{color:#007bff;border-color:#007bff}.btn-outline-primary:hover{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary.focus,.btn-outline-primary:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-primary.disabled,.btn-outline-primary:disabled{color:#007bff;background-color:transparent}.btn-outline-primary:not(:disabled):not(.disabled).active,.btn-outline-primary:not(:disabled):not(.disabled):active,.show>.btn-outline-primary.dropdown-toggle{color:#fff;background-color:#007bff;border-color:#007bff}.btn-outline-primary:not(:disabled):not(.disabled).active:focus,.btn-outline-primary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-primary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.btn-outline-secondary{color:#6c757d;border-color:#6c757d}.btn-outline-secondary:hover{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary.focus,.btn-outline-secondary:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-secondary.disabled,.btn-outline-secondary:disabled{color:#6c757d;background-color:transparent}.btn-outline-secondary:not(:disabled):not(.disabled).active,.btn-outline-secondary:not(:disabled):not(.disabled):active,.show>.btn-outline-secondary.dropdown-toggle{color:#fff;background-color:#6c757d;border-color:#6c757d}.btn-outline-secondary:not(:disabled):not(.disabled).active:focus,.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-secondary.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.btn-outline-success{color:#28a745;border-color:#28a745}.btn-outline-success:hover{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success.focus,.btn-outline-success:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-success.disabled,.btn-outline-success:disabled{color:#28a745;background-color:transparent}.btn-outline-success:not(:disabled):not(.disabled).active,.btn-outline-success:not(:disabled):not(.disabled):active,.show>.btn-outline-success.dropdown-toggle{color:#fff;background-color:#28a745;border-color:#28a745}.btn-outline-success:not(:disabled):not(.disabled).active:focus,.btn-outline-success:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-success.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.btn-outline-info{color:#17a2b8;border-color:#17a2b8}.btn-outline-info:hover{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info.focus,.btn-outline-info:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-info.disabled,.btn-outline-info:disabled{color:#17a2b8;background-color:transparent}.btn-outline-info:not(:disabled):not(.disabled).active,.btn-outline-info:not(:disabled):not(.disabled):active,.show>.btn-outline-info.dropdown-toggle{color:#fff;background-color:#17a2b8;border-color:#17a2b8}.btn-outline-info:not(:disabled):not(.disabled).active:focus,.btn-outline-info:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-info.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.btn-outline-warning{color:#ffc107;border-color:#ffc107}.btn-outline-warning:hover{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning.focus,.btn-outline-warning:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-warning.disabled,.btn-outline-warning:disabled{color:#ffc107;background-color:transparent}.btn-outline-warning:not(:disabled):not(.disabled).active,.btn-outline-warning:not(:disabled):not(.disabled):active,.show>.btn-outline-warning.dropdown-toggle{color:#212529;background-color:#ffc107;border-color:#ffc107}.btn-outline-warning:not(:disabled):not(.disabled).active:focus,.btn-outline-warning:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-warning.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.btn-outline-danger{color:#dc3545;border-color:#dc3545}.btn-outline-danger:hover{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger.focus,.btn-outline-danger:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-danger.disabled,.btn-outline-danger:disabled{color:#dc3545;background-color:transparent}.btn-outline-danger:not(:disabled):not(.disabled).active,.btn-outline-danger:not(:disabled):not(.disabled):active,.show>.btn-outline-danger.dropdown-toggle{color:#fff;background-color:#dc3545;border-color:#dc3545}.btn-outline-danger:not(:disabled):not(.disabled).active:focus,.btn-outline-danger:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.btn-outline-light{color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:hover{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light.focus,.btn-outline-light:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-light.disabled,.btn-outline-light:disabled{color:#f8f9fa;background-color:transparent}.btn-outline-light:not(:disabled):not(.disabled).active,.btn-outline-light:not(:disabled):not(.disabled):active,.show>.btn-outline-light.dropdown-toggle{color:#212529;background-color:#f8f9fa;border-color:#f8f9fa}.btn-outline-light:not(:disabled):not(.disabled).active:focus,.btn-outline-light:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-light.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.btn-outline-dark{color:#343a40;border-color:#343a40}.btn-outline-dark:hover{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark.focus,.btn-outline-dark:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-outline-dark.disabled,.btn-outline-dark:disabled{color:#343a40;background-color:transparent}.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active,.show>.btn-outline-dark.dropdown-toggle{color:#fff;background-color:#343a40;border-color:#343a40}.btn-outline-dark:not(:disabled):not(.disabled).active:focus,.btn-outline-dark:not(:disabled):not(.disabled):active:focus,.show>.btn-outline-dark.dropdown-toggle:focus{box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.btn-link{font-weight:400;color:#007bff;text-decoration:none}.btn-link:hover{color:#0056b3}.btn-link.focus,.btn-link:focus,.btn-link:hover{text-decoration:underline}.btn-link.disabled,.btn-link:disabled{color:#6c757d;pointer-events:none}.btn-group-lg>.btn,.btn-lg{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.btn-group-sm>.btn,.btn-sm{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:.5rem}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{transition:opacity .15s linear}@media (prefers-reduced-motion:reduce){.fade{transition:none}}.fade:not(.show){opacity:0}.collapse:not(.show){display:none}.collapsing{position:relative;height:0;overflow:hidden;transition:height .35s ease}@media (prefers-reduced-motion:reduce){.collapsing{transition:none}}.dropdown,.dropleft,.dropright,.dropup{position:relative}.dropdown-toggle{white-space:nowrap}.dropdown-toggle:after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid;border-right:.3em solid transparent;border-bottom:0;border-left:.3em solid transparent}.dropdown-toggle:empty:after{margin-left:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:10rem;padding:.5rem 0;margin:.125rem 0 0;font-size:1rem;color:#212529;text-align:left;list-style:none;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.15);border-radius:.25rem}.dropdown-menu-left{right:auto;left:0}.dropdown-menu-right{right:0;left:auto}@media (min-width:540px){.dropdown-menu-sm-left{right:auto;left:0}.dropdown-menu-sm-right{right:0;left:auto}}@media (min-width:720px){.dropdown-menu-md-left{right:auto;left:0}.dropdown-menu-md-right{right:0;left:auto}}@media (min-width:960px){.dropdown-menu-lg-left{right:auto;left:0}.dropdown-menu-lg-right{right:0;left:auto}}@media (min-width:1200px){.dropdown-menu-xl-left{right:auto;left:0}.dropdown-menu-xl-right{right:0;left:auto}}.dropup .dropdown-menu{top:auto;bottom:100%;margin-top:0;margin-bottom:.125rem}.dropup .dropdown-toggle:after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";border-top:0;border-right:.3em solid transparent;border-bottom:.3em solid;border-left:.3em solid transparent}.dropup .dropdown-toggle:empty:after{margin-left:0}.dropright .dropdown-menu{top:0;right:auto;left:100%;margin-top:0;margin-left:.125rem}.dropright .dropdown-toggle:after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid transparent;border-right:0;border-bottom:.3em solid transparent;border-left:.3em solid}.dropright .dropdown-toggle:empty:after{margin-left:0}.dropright .dropdown-toggle:after{vertical-align:0}.dropleft .dropdown-menu{top:0;right:100%;left:auto;margin-top:0;margin-right:.125rem}.dropleft .dropdown-toggle:after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";display:none}.dropleft .dropdown-toggle:before{display:inline-block;margin-right:.255em;vertical-align:.255em;content:"";border-top:.3em solid transparent;border-right:.3em solid;border-bottom:.3em solid transparent}.dropleft .dropdown-toggle:empty:after{margin-left:0}.dropleft .dropdown-toggle:before{vertical-align:0}.dropdown-menu[x-placement^=bottom],.dropdown-menu[x-placement^=left],.dropdown-menu[x-placement^=right],.dropdown-menu[x-placement^=top]{right:auto;bottom:auto}.dropdown-divider{height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef}.dropdown-item{display:block;width:100%;padding:.25rem 1.5rem;clear:both;font-weight:400;color:#212529;text-align:inherit;white-space:nowrap;background-color:transparent;border:0}.dropdown-item:focus,.dropdown-item:hover{color:#16181b;text-decoration:none;background-color:#e9ecef}.dropdown-item.active,.dropdown-item:active{color:#fff;text-decoration:none;background-color:#007bff}.dropdown-item.disabled,.dropdown-item:disabled{color:#adb5bd;pointer-events:none;background-color:transparent}.dropdown-menu.show{display:block}.dropdown-header{display:block;padding:.5rem 1.5rem;margin-bottom:0;font-size:.875rem;color:#6c757d;white-space:nowrap}.dropdown-item-text{display:block;padding:.25rem 1.5rem;color:#212529}.btn-group,.btn-group-vertical{position:relative;display:inline-flex;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;flex:1 1 auto}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:1}.btn-toolbar{display:flex;flex-wrap:wrap;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group>.btn-group:not(:first-child),.btn-group>.btn:not(:first-child){margin-left:-1px}.btn-group>.btn-group:not(:last-child)>.btn,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:not(:first-child)>.btn,.btn-group>.btn:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:.5625rem;padding-left:.5625rem}.dropdown-toggle-split:after,.dropright .dropdown-toggle-split:after,.dropup .dropdown-toggle-split:after{margin-left:0}.dropleft .dropdown-toggle-split:before{margin-right:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.375rem;padding-left:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-vertical{flex-direction:column;align-items:flex-start;justify-content:center}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group{width:100%}.btn-group-vertical>.btn-group:not(:first-child),.btn-group-vertical>.btn:not(:first-child){margin-top:-1px}.btn-group-vertical>.btn-group:not(:last-child)>.btn,.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child)>.btn,.btn-group-vertical>.btn:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.btn-group-toggle>.btn,.btn-group-toggle>.btn-group>.btn{margin-bottom:0}.btn-group-toggle>.btn-group>.btn input[type=checkbox],.btn-group-toggle>.btn-group>.btn input[type=radio],.btn-group-toggle>.btn input[type=checkbox],.btn-group-toggle>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:flex;flex-wrap:wrap;align-items:stretch;width:100%}.input-group>.custom-file,.input-group>.custom-select,.input-group>.form-control,.input-group>.form-control-plaintext{position:relative;flex:1 1 auto;width:1%;min-width:0;margin-bottom:0}.input-group>.custom-file+.custom-file,.input-group>.custom-file+.custom-select,.input-group>.custom-file+.form-control,.input-group>.custom-select+.custom-file,.input-group>.custom-select+.custom-select,.input-group>.custom-select+.form-control,.input-group>.form-control+.custom-file,.input-group>.form-control+.custom-select,.input-group>.form-control+.form-control,.input-group>.form-control-plaintext+.custom-file,.input-group>.form-control-plaintext+.custom-select,.input-group>.form-control-plaintext+.form-control{margin-left:-1px}.input-group>.custom-file .custom-file-input:focus~.custom-file-label,.input-group>.custom-select:focus,.input-group>.form-control:focus{z-index:3}.input-group>.custom-file .custom-file-input:focus{z-index:4}.input-group>.custom-select:not(:first-child),.input-group>.form-control:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.custom-file{display:flex;align-items:center}.input-group>.custom-file:not(:first-child) .custom-file-label,.input-group>.custom-file:not(:last-child) .custom-file-label{border-top-left-radius:0;border-bottom-left-radius:0}.input-group.has-validation>.custom-file:nth-last-child(n+3) .custom-file-label:after,.input-group.has-validation>.custom-select:nth-last-child(n+3),.input-group.has-validation>.form-control:nth-last-child(n+3),.input-group:not(.has-validation)>.custom-file:not(:last-child) .custom-file-label:after,.input-group:not(.has-validation)>.custom-select:not(:last-child),.input-group:not(.has-validation)>.form-control:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-append,.input-group-prepend{display:flex}.input-group-append .btn,.input-group-prepend .btn{position:relative;z-index:2}.input-group-append .btn:focus,.input-group-prepend .btn:focus{z-index:3}.input-group-append .btn+.btn,.input-group-append .btn+.input-group-text,.input-group-append .input-group-text+.btn,.input-group-append .input-group-text+.input-group-text,.input-group-prepend .btn+.btn,.input-group-prepend .btn+.input-group-text,.input-group-prepend .input-group-text+.btn,.input-group-prepend .input-group-text+.input-group-text{margin-left:-1px}.input-group-prepend{margin-right:-1px}.input-group-append{margin-left:-1px}.input-group-text{display:flex;align-items:center;padding:.375rem .75rem;margin-bottom:0;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;text-align:center;white-space:nowrap;background-color:#e9ecef;border:1px solid #ced4da;border-radius:.25rem}.input-group-text input[type=checkbox],.input-group-text input[type=radio]{margin-top:0}.input-group-lg>.custom-select,.input-group-lg>.form-control:not(textarea){height:calc(1.5em + 1rem + 2px)}.input-group-lg>.custom-select,.input-group-lg>.form-control,.input-group-lg>.input-group-append>.btn,.input-group-lg>.input-group-append>.input-group-text,.input-group-lg>.input-group-prepend>.btn,.input-group-lg>.input-group-prepend>.input-group-text{padding:.5rem 1rem;font-size:1.25rem;line-height:1.5;border-radius:.3rem}.input-group-sm>.custom-select,.input-group-sm>.form-control:not(textarea){height:calc(1.5em + .5rem + 2px)}.input-group-sm>.custom-select,.input-group-sm>.form-control,.input-group-sm>.input-group-append>.btn,.input-group-sm>.input-group-append>.input-group-text,.input-group-sm>.input-group-prepend>.btn,.input-group-sm>.input-group-prepend>.input-group-text{padding:.25rem .5rem;font-size:.875rem;line-height:1.5;border-radius:.2rem}.input-group-lg>.custom-select,.input-group-sm>.custom-select{padding-right:1.75rem}.input-group.has-validation>.input-group-append:nth-last-child(n+3)>.btn,.input-group.has-validation>.input-group-append:nth-last-child(n+3)>.input-group-text,.input-group:not(.has-validation)>.input-group-append:not(:last-child)>.btn,.input-group:not(.has-validation)>.input-group-append:not(:last-child)>.input-group-text,.input-group>.input-group-append:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group>.input-group-append:last-child>.input-group-text:not(:last-child),.input-group>.input-group-prepend>.btn,.input-group>.input-group-prepend>.input-group-text{border-top-right-radius:0;border-bottom-right-radius:0}.input-group>.input-group-append>.btn,.input-group>.input-group-append>.input-group-text,.input-group>.input-group-prepend:first-child>.btn:not(:first-child),.input-group>.input-group-prepend:first-child>.input-group-text:not(:first-child),.input-group>.input-group-prepend:not(:first-child)>.btn,.input-group>.input-group-prepend:not(:first-child)>.input-group-text{border-top-left-radius:0;border-bottom-left-radius:0}.custom-control{position:relative;z-index:1;display:block;min-height:1.5rem;padding-left:1.5rem;color-adjust:exact}.custom-control-inline{display:inline-flex;margin-right:1rem}.custom-control-input{position:absolute;left:0;z-index:-1;width:1rem;height:1.25rem;opacity:0}.custom-control-input:checked~.custom-control-label:before{color:#fff;border-color:#007bff;background-color:#007bff}.custom-control-input:focus~.custom-control-label:before{box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-control-input:focus:not(:checked)~.custom-control-label:before{border-color:#80bdff}.custom-control-input:not(:disabled):active~.custom-control-label:before{color:#fff;background-color:#b3d7ff;border-color:#b3d7ff}.custom-control-input:disabled~.custom-control-label,.custom-control-input[disabled]~.custom-control-label{color:#6c757d}.custom-control-input:disabled~.custom-control-label:before,.custom-control-input[disabled]~.custom-control-label:before{background-color:#e9ecef}.custom-control-label{position:relative;margin-bottom:0;vertical-align:top}.custom-control-label:before{pointer-events:none;background-color:#fff;border:1px solid #adb5bd}.custom-control-label:after,.custom-control-label:before{position:absolute;top:.25rem;left:-1.5rem;display:block;width:1rem;height:1rem;content:""}.custom-control-label:after{background:50%/50% 50% no-repeat}.custom-checkbox .custom-control-label:before{border-radius:.25rem}.custom-checkbox .custom-control-input:checked~.custom-control-label:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label:before{border-color:#007bff;background-color:#007bff}.custom-checkbox .custom-control-input:indeterminate~.custom-control-label:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Cpath stroke='%23fff' d='M0 2h4'/%3E%3C/svg%3E")}.custom-checkbox .custom-control-input:disabled:checked~.custom-control-label:before{background-color:rgba(0,123,255,.5)}.custom-checkbox .custom-control-input:disabled:indeterminate~.custom-control-label:before{background-color:rgba(0,123,255,.5)}.custom-radio .custom-control-label:before{border-radius:50%}.custom-radio .custom-control-input:checked~.custom-control-label:after{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E")}.custom-radio .custom-control-input:disabled:checked~.custom-control-label:before{background-color:rgba(0,123,255,.5)}.custom-switch{padding-left:2.25rem}.custom-switch .custom-control-label:before{left:-2.25rem;width:1.75rem;pointer-events:all;border-radius:.5rem}.custom-switch .custom-control-label:after{top:calc(.25rem + 2px);left:calc(-2.25rem + 2px);width:calc(1rem - 4px);height:calc(1rem - 4px);background-color:#adb5bd;border-radius:.5rem;transition:transform .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.custom-switch .custom-control-label:after{transition:none}}.custom-switch .custom-control-input:checked~.custom-control-label:after{background-color:#fff;transform:translateX(.75rem)}.custom-switch .custom-control-input:disabled:checked~.custom-control-label:before{background-color:rgba(0,123,255,.5)}.custom-select{display:inline-block;width:100%;height:calc(1.5em + .75rem + 2px);padding:.375rem 1.75rem .375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#495057;vertical-align:middle;background:#fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") right .75rem center/8px 10px no-repeat;border:1px solid #ced4da;border-radius:.25rem;appearance:none}.custom-select:focus{border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-select:focus::-ms-value{color:#495057;background-color:#fff}.custom-select[multiple],.custom-select[size]:not([size="1"]){height:auto;padding-right:.75rem;background-image:none}.custom-select:disabled{color:#6c757d;background-color:#e9ecef}.custom-select::-ms-expand{display:none}.custom-select:-moz-focusring{color:transparent;text-shadow:0 0 0 #495057}.custom-select-sm{height:calc(1.5em + .5rem + 2px);padding-top:.25rem;padding-bottom:.25rem;padding-left:.5rem;font-size:.875rem}.custom-select-lg{height:calc(1.5em + 1rem + 2px);padding-top:.5rem;padding-bottom:.5rem;padding-left:1rem;font-size:1.25rem}.custom-file{display:inline-block;margin-bottom:0}.custom-file,.custom-file-input{position:relative;width:100%;height:calc(1.5em + .75rem + 2px)}.custom-file-input{z-index:2;margin:0;overflow:hidden;opacity:0}.custom-file-input:focus~.custom-file-label{border-color:#80bdff;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.custom-file-input:disabled~.custom-file-label,.custom-file-input[disabled]~.custom-file-label{background-color:#e9ecef}.custom-file-input:lang(en)~.custom-file-label:after{content:"Browse"}.custom-file-input~.custom-file-label[data-browse]:after{content:attr(data-browse)}.custom-file-label{left:0;z-index:1;height:calc(1.5em + .75rem + 2px);overflow:hidden;font-weight:400;background-color:#fff;border:1px solid #ced4da;border-radius:.25rem}.custom-file-label,.custom-file-label:after{position:absolute;top:0;right:0;padding:.375rem .75rem;line-height:1.5;color:#495057}.custom-file-label:after{bottom:0;z-index:3;display:block;height:calc(1.5em + .75rem);content:"Browse";background-color:#e9ecef;border-left:inherit;border-radius:0 .25rem .25rem 0}.custom-range{width:100%;height:1.4rem;padding:0;background-color:transparent;appearance:none}.custom-range:focus{outline:0}.custom-range:focus::-webkit-slider-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range:focus::-ms-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .2rem rgba(0,123,255,.25)}.custom-range::-moz-focus-outer{border:0}.custom-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-.25rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media (prefers-reduced-motion:reduce){.custom-range::-webkit-slider-thumb{transition:none}}.custom-range::-webkit-slider-thumb:active{background-color:#b3d7ff}.custom-range::-webkit-slider-runnable-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media (prefers-reduced-motion:reduce){.custom-range::-moz-range-thumb{transition:none}}.custom-range::-moz-range-thumb:active{background-color:#b3d7ff}.custom-range::-moz-range-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.custom-range::-ms-thumb{width:1rem;height:1rem;margin-top:0;margin-right:.2rem;margin-left:.2rem;background-color:#007bff;border:0;border-radius:1rem;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media (prefers-reduced-motion:reduce){.custom-range::-ms-thumb{transition:none}}.custom-range::-ms-thumb:active{background-color:#b3d7ff}.custom-range::-ms-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:transparent;border-color:transparent;border-width:.5rem}.custom-range::-ms-fill-lower,.custom-range::-ms-fill-upper{background-color:#dee2e6;border-radius:1rem}.custom-range::-ms-fill-upper{margin-right:15px}.custom-range:disabled::-webkit-slider-thumb{background-color:#adb5bd}.custom-range:disabled::-webkit-slider-runnable-track{cursor:default}.custom-range:disabled::-moz-range-thumb{background-color:#adb5bd}.custom-range:disabled::-moz-range-track{cursor:default}.custom-range:disabled::-ms-thumb{background-color:#adb5bd}.custom-control-label:before,.custom-file-label,.custom-select{transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.custom-control-label:before,.custom-file-label,.custom-select{transition:none}}.nav{display:flex;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.nav-link{display:block;padding:.5rem 1rem}.nav-link:focus,.nav-link:hover{text-decoration:none}.nav-link.disabled{color:#6c757d;pointer-events:none;cursor:default}.nav-tabs{border-bottom:1px solid #dee2e6}.nav-tabs .nav-link{margin-bottom:-1px;border:1px solid transparent;border-top-left-radius:.25rem;border-top-right-radius:.25rem}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{border-color:#e9ecef #e9ecef #dee2e6}.nav-tabs .nav-link.disabled{color:#6c757d;background-color:transparent;border-color:transparent}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:#495057;background-color:#fff;border-color:#dee2e6 #dee2e6 #fff}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.nav-pills .nav-link{border-radius:.25rem}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:#fff;background-color:#007bff}.nav-fill .nav-item,.nav-fill>.nav-link{flex:1 1 auto;text-align:center}.nav-justified .nav-item,.nav-justified>.nav-link{flex-basis:0;flex-grow:1;text-align:center}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.navbar{position:relative;padding:.5rem 1rem}.navbar,.navbar .container,.navbar .container-fluid,.navbar .container-lg,.navbar .container-md,.navbar .container-sm,.navbar .container-xl{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between}.navbar-brand{display:inline-block;padding-top:.3125rem;padding-bottom:.3125rem;margin-right:1rem;font-size:1.25rem;line-height:inherit;white-space:nowrap}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-nav{display:flex;flex-direction:column;padding-left:0;margin-bottom:0;list-style:none}.navbar-nav .nav-link{padding-right:0;padding-left:0}.navbar-nav .dropdown-menu{position:static;float:none}.navbar-text{display:inline-block;padding-top:.5rem;padding-bottom:.5rem}.navbar-collapse{flex-basis:100%;flex-grow:1;align-items:center}.navbar-toggler{padding:.25rem .75rem;font-size:1.25rem;line-height:1;background-color:transparent;border:1px solid transparent;border-radius:.25rem}.navbar-toggler:focus,.navbar-toggler:hover{text-decoration:none}.navbar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;content:"";background:50%/100% 100% no-repeat}.navbar-nav-scroll{max-height:75vh;overflow-y:auto}@media (max-width:539.98px){.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid,.navbar-expand-sm>.container-lg,.navbar-expand-sm>.container-md,.navbar-expand-sm>.container-sm,.navbar-expand-sm>.container-xl{padding-right:0;padding-left:0}}@media (min-width:540px){.navbar-expand-sm{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-sm .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-sm>.container,.navbar-expand-sm>.container-fluid,.navbar-expand-sm>.container-lg,.navbar-expand-sm>.container-md,.navbar-expand-sm>.container-sm,.navbar-expand-sm>.container-xl{flex-wrap:nowrap}.navbar-expand-sm .navbar-nav-scroll{overflow:visible}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (max-width:719.98px){.navbar-expand-md>.container,.navbar-expand-md>.container-fluid,.navbar-expand-md>.container-lg,.navbar-expand-md>.container-md,.navbar-expand-md>.container-sm,.navbar-expand-md>.container-xl{padding-right:0;padding-left:0}}@media (min-width:720px){.navbar-expand-md{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-md .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-md>.container,.navbar-expand-md>.container-fluid,.navbar-expand-md>.container-lg,.navbar-expand-md>.container-md,.navbar-expand-md>.container-sm,.navbar-expand-md>.container-xl{flex-wrap:nowrap}.navbar-expand-md .navbar-nav-scroll{overflow:visible}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (max-width:959.98px){.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid,.navbar-expand-lg>.container-lg,.navbar-expand-lg>.container-md,.navbar-expand-lg>.container-sm,.navbar-expand-lg>.container-xl{padding-right:0;padding-left:0}}@media (min-width:960px){.navbar-expand-lg{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-lg .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-lg>.container,.navbar-expand-lg>.container-fluid,.navbar-expand-lg>.container-lg,.navbar-expand-lg>.container-md,.navbar-expand-lg>.container-sm,.navbar-expand-lg>.container-xl{flex-wrap:nowrap}.navbar-expand-lg .navbar-nav-scroll{overflow:visible}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (max-width:1199.98px){.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid,.navbar-expand-xl>.container-lg,.navbar-expand-xl>.container-md,.navbar-expand-xl>.container-sm,.navbar-expand-xl>.container-xl{padding-right:0;padding-left:0}}@media (min-width:1200px){.navbar-expand-xl{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand-xl .navbar-nav{flex-direction:row}.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xl .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand-xl>.container,.navbar-expand-xl>.container-fluid,.navbar-expand-xl>.container-lg,.navbar-expand-xl>.container-md,.navbar-expand-xl>.container-sm,.navbar-expand-xl>.container-xl{flex-wrap:nowrap}.navbar-expand-xl .navbar-nav-scroll{overflow:visible}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}.navbar-expand{flex-flow:row nowrap;justify-content:flex-start}.navbar-expand>.container,.navbar-expand>.container-fluid,.navbar-expand>.container-lg,.navbar-expand>.container-md,.navbar-expand>.container-sm,.navbar-expand>.container-xl{padding-right:0;padding-left:0}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.navbar-expand .navbar-nav .nav-link{padding-right:.5rem;padding-left:.5rem}.navbar-expand>.container,.navbar-expand>.container-fluid,.navbar-expand>.container-lg,.navbar-expand>.container-md,.navbar-expand>.container-sm,.navbar-expand>.container-xl{flex-wrap:nowrap}.navbar-expand .navbar-nav-scroll{overflow:visible}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-light .navbar-brand,.navbar-light .navbar-brand:focus,.navbar-light .navbar-brand:hover{color:rgba(0,0,0,.9)}.navbar-light .navbar-nav .nav-link{color:rgba(0,0,0,.5)}.navbar-light .navbar-nav .nav-link:focus,.navbar-light .navbar-nav .nav-link:hover{color:rgba(0,0,0,.7)}.navbar-light .navbar-nav .nav-link.disabled{color:rgba(0,0,0,.3)}.navbar-light .navbar-nav .active>.nav-link,.navbar-light .navbar-nav .nav-link.active,.navbar-light .navbar-nav .nav-link.show,.navbar-light .navbar-nav .show>.nav-link{color:rgba(0,0,0,.9)}.navbar-light .navbar-toggler{color:rgba(0,0,0,.5);border-color:rgba(0,0,0,.1)}.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath stroke='rgba(0,0,0,0.5)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-light .navbar-text{color:rgba(0,0,0,.5)}.navbar-light .navbar-text a,.navbar-light .navbar-text a:focus,.navbar-light .navbar-text a:hover{color:rgba(0,0,0,.9)}.navbar-dark .navbar-brand,.navbar-dark .navbar-brand:focus,.navbar-dark .navbar-brand:hover{color:#fff}.navbar-dark .navbar-nav .nav-link{color:hsla(0,0%,100%,.5)}.navbar-dark .navbar-nav .nav-link:focus,.navbar-dark .navbar-nav .nav-link:hover{color:hsla(0,0%,100%,.75)}.navbar-dark .navbar-nav .nav-link.disabled{color:hsla(0,0%,100%,.25)}.navbar-dark .navbar-nav .active>.nav-link,.navbar-dark .navbar-nav .nav-link.active,.navbar-dark .navbar-nav .nav-link.show,.navbar-dark .navbar-nav .show>.nav-link{color:#fff}.navbar-dark .navbar-toggler{color:hsla(0,0%,100%,.5);border-color:hsla(0,0%,100%,.1)}.navbar-dark .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath stroke='rgba(255,255,255,0.5)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E")}.navbar-dark .navbar-text{color:hsla(0,0%,100%,.5)}.navbar-dark .navbar-text a,.navbar-dark .navbar-text a:focus,.navbar-dark .navbar-text a:hover{color:#fff}.card{position:relative;display:flex;flex-direction:column;min-width:0;word-wrap:break-word;background-color:#fff;background-clip:border-box;border:1px solid rgba(0,0,0,.125);border-radius:.25rem}.card>hr{margin-right:0;margin-left:0}.card>.list-group{border-top:inherit;border-bottom:inherit}.card>.list-group:first-child{border-top-width:0;border-top-left-radius:calc(.25rem - 1px);border-top-right-radius:calc(.25rem - 1px)}.card>.list-group:last-child{border-bottom-width:0;border-bottom-right-radius:calc(.25rem - 1px);border-bottom-left-radius:calc(.25rem - 1px)}.card>.card-header+.list-group,.card>.list-group+.card-footer{border-top:0}.card-body{flex:1 1 auto;min-height:1px;padding:1.25rem}.card-title{margin-bottom:.75rem}.card-subtitle{margin-top:-.375rem}.card-subtitle,.card-text:last-child{margin-bottom:0}.card-link:hover{text-decoration:none}.card-link+.card-link{margin-left:1.25rem}.card-header{padding:.75rem 1.25rem;margin-bottom:0;background-color:rgba(0,0,0,.03);border-bottom:1px solid rgba(0,0,0,.125)}.card-header:first-child{border-radius:calc(.25rem - 1px) calc(.25rem - 1px) 0 0}.card-footer{padding:.75rem 1.25rem;background-color:rgba(0,0,0,.03);border-top:1px solid rgba(0,0,0,.125)}.card-footer:last-child{border-radius:0 0 calc(.25rem - 1px) calc(.25rem - 1px)}.card-header-tabs{margin-bottom:-.75rem;border-bottom:0}.card-header-pills,.card-header-tabs{margin-right:-.625rem;margin-left:-.625rem}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:1.25rem;border-radius:calc(.25rem - 1px)}.card-img,.card-img-bottom,.card-img-top{flex-shrink:0;width:100%}.card-img,.card-img-top{border-top-left-radius:calc(.25rem - 1px);border-top-right-radius:calc(.25rem - 1px)}.card-img,.card-img-bottom{border-bottom-right-radius:calc(.25rem - 1px);border-bottom-left-radius:calc(.25rem - 1px)}.card-deck .card{margin-bottom:15px}@media (min-width:540px){.card-deck{display:flex;flex-flow:row wrap;margin-right:-15px;margin-left:-15px}.card-deck .card{flex:1 0 0%;margin-right:15px;margin-bottom:0;margin-left:15px}}.card-group>.card{margin-bottom:15px}@media (min-width:540px){.card-group{display:flex;flex-flow:row wrap}.card-group>.card{flex:1 0 0%;margin-bottom:0}.card-group>.card+.card{margin-left:0;border-left:0}.card-group>.card:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:not(:last-child) .card-header,.card-group>.card:not(:last-child) .card-img-top{border-top-right-radius:0}.card-group>.card:not(:last-child) .card-footer,.card-group>.card:not(:last-child) .card-img-bottom{border-bottom-right-radius:0}.card-group>.card:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:not(:first-child) .card-header,.card-group>.card:not(:first-child) .card-img-top{border-top-left-radius:0}.card-group>.card:not(:first-child) .card-footer,.card-group>.card:not(:first-child) .card-img-bottom{border-bottom-left-radius:0}}.card-columns .card{margin-bottom:.75rem}@media (min-width:540px){.card-columns{column-count:3;column-gap:1.25rem;orphans:1;widows:1}.card-columns .card{display:inline-block;width:100%}}.accordion{overflow-anchor:none}.accordion>.card{overflow:hidden}.accordion>.card:not(:last-of-type){border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.accordion>.card:not(:first-of-type){border-top-left-radius:0;border-top-right-radius:0}.accordion>.card>.card-header{border-radius:0;margin-bottom:-1px}.breadcrumb{display:flex;flex-wrap:wrap;padding:.75rem 1rem;margin-bottom:1rem;list-style:none;background-color:#e9ecef;border-radius:.25rem}.breadcrumb-item+.breadcrumb-item{padding-left:.5rem}.breadcrumb-item+.breadcrumb-item:before{float:left;padding-right:.5rem;color:#6c757d;content:"/"}.breadcrumb-item+.breadcrumb-item:hover:before{text-decoration:underline;text-decoration:none}.breadcrumb-item.active{color:#6c757d}.pagination{display:flex;padding-left:0;list-style:none;border-radius:.25rem}.page-link{position:relative;display:block;padding:.5rem .75rem;margin-left:-1px;line-height:1.25;color:#007bff;background-color:#fff;border:1px solid #dee2e6}.page-link:hover{z-index:2;color:#0056b3;text-decoration:none;background-color:#e9ecef;border-color:#dee2e6}.page-link:focus{z-index:3;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.page-item:first-child .page-link{margin-left:0;border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.page-item:last-child .page-link{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.page-item.active .page-link{z-index:3;color:#fff;background-color:#007bff;border-color:#007bff}.page-item.disabled .page-link{color:#6c757d;pointer-events:none;cursor:auto;background-color:#fff;border-color:#dee2e6}.pagination-lg .page-link{padding:.75rem 1.5rem;font-size:1.25rem;line-height:1.5}.pagination-lg .page-item:first-child .page-link{border-top-left-radius:.3rem;border-bottom-left-radius:.3rem}.pagination-lg .page-item:last-child .page-link{border-top-right-radius:.3rem;border-bottom-right-radius:.3rem}.pagination-sm .page-link{padding:.25rem .5rem;font-size:.875rem;line-height:1.5}.pagination-sm .page-item:first-child .page-link{border-top-left-radius:.2rem;border-bottom-left-radius:.2rem}.pagination-sm .page-item:last-child .page-link{border-top-right-radius:.2rem;border-bottom-right-radius:.2rem}.badge{display:inline-block;padding:.25em .4em;font-size:75%;font-weight:700;line-height:1;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.badge{transition:none}}a.badge:focus,a.badge:hover{text-decoration:none}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.badge-pill{padding-right:.6em;padding-left:.6em;border-radius:10rem}.badge-primary{color:#fff;background-color:#007bff}a.badge-primary:focus,a.badge-primary:hover{color:#fff;background-color:#0062cc}a.badge-primary.focus,a.badge-primary:focus{outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.5)}.badge-secondary{color:#fff;background-color:#6c757d}a.badge-secondary:focus,a.badge-secondary:hover{color:#fff;background-color:#545b62}a.badge-secondary.focus,a.badge-secondary:focus{outline:0;box-shadow:0 0 0 .2rem rgba(108,117,125,.5)}.badge-success{color:#fff;background-color:#28a745}a.badge-success:focus,a.badge-success:hover{color:#fff;background-color:#1e7e34}a.badge-success.focus,a.badge-success:focus{outline:0;box-shadow:0 0 0 .2rem rgba(40,167,69,.5)}.badge-info{color:#fff;background-color:#17a2b8}a.badge-info:focus,a.badge-info:hover{color:#fff;background-color:#117a8b}a.badge-info.focus,a.badge-info:focus{outline:0;box-shadow:0 0 0 .2rem rgba(23,162,184,.5)}.badge-warning{color:#212529;background-color:#ffc107}a.badge-warning:focus,a.badge-warning:hover{color:#212529;background-color:#d39e00}a.badge-warning.focus,a.badge-warning:focus{outline:0;box-shadow:0 0 0 .2rem rgba(255,193,7,.5)}.badge-danger{color:#fff;background-color:#dc3545}a.badge-danger:focus,a.badge-danger:hover{color:#fff;background-color:#bd2130}a.badge-danger.focus,a.badge-danger:focus{outline:0;box-shadow:0 0 0 .2rem rgba(220,53,69,.5)}.badge-light{color:#212529;background-color:#f8f9fa}a.badge-light:focus,a.badge-light:hover{color:#212529;background-color:#dae0e5}a.badge-light.focus,a.badge-light:focus{outline:0;box-shadow:0 0 0 .2rem rgba(248,249,250,.5)}.badge-dark{color:#fff;background-color:#343a40}a.badge-dark:focus,a.badge-dark:hover{color:#fff;background-color:#1d2124}a.badge-dark.focus,a.badge-dark:focus{outline:0;box-shadow:0 0 0 .2rem rgba(52,58,64,.5)}.jumbotron{padding:2rem 1rem;margin-bottom:2rem;background-color:#e9ecef;border-radius:.3rem}@media (min-width:540px){.jumbotron{padding:4rem 2rem}}.jumbotron-fluid{padding-right:0;padding-left:0;border-radius:0}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:.25rem}.alert-heading{color:inherit}.alert-link{font-weight:700}.alert-dismissible{padding-right:4rem}.alert-dismissible .close{position:absolute;top:0;right:0;z-index:2;padding:.75rem 1.25rem;color:inherit}.alert-primary{color:#004085;background-color:#cce5ff;border-color:#b8daff}.alert-primary hr{border-top-color:#9fcdff}.alert-primary .alert-link{color:#002752}.alert-secondary{color:#383d41;background-color:#e2e3e5;border-color:#d6d8db}.alert-secondary hr{border-top-color:#c8cbcf}.alert-secondary .alert-link{color:#202326}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert-success hr{border-top-color:#b1dfbb}.alert-success .alert-link{color:#0b2e13}.alert-info{color:#0c5460;background-color:#d1ecf1;border-color:#bee5eb}.alert-info hr{border-top-color:#abdde5}.alert-info .alert-link{color:#062c33}.alert-warning{color:#856404;background-color:#fff3cd;border-color:#ffeeba}.alert-warning hr{border-top-color:#ffe8a1}.alert-warning .alert-link{color:#533f03}.alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-danger hr{border-top-color:#f1b0b7}.alert-danger .alert-link{color:#491217}.alert-light{color:#818182;background-color:#fefefe;border-color:#fdfdfe}.alert-light hr{border-top-color:#ececf6}.alert-light .alert-link{color:#686868}.alert-dark{color:#1b1e21;background-color:#d6d8d9;border-color:#c6c8ca}.alert-dark hr{border-top-color:#b9bbbe}.alert-dark .alert-link{color:#040505}@keyframes progress-bar-stripes{0%{background-position:1rem 0}to{background-position:0 0}}.progress{height:1rem;line-height:0;font-size:.75rem;background-color:#e9ecef;border-radius:.25rem}.progress,.progress-bar{display:flex;overflow:hidden}.progress-bar{flex-direction:column;justify-content:center;color:#fff;text-align:center;white-space:nowrap;background-color:#007bff;transition:width .6s ease}@media (prefers-reduced-motion:reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg,hsla(0,0%,100%,.15) 25%,transparent 0,transparent 50%,hsla(0,0%,100%,.15) 0,hsla(0,0%,100%,.15) 75%,transparent 0,transparent);background-size:1rem 1rem}.progress-bar-animated{animation:progress-bar-stripes 1s linear infinite}@media (prefers-reduced-motion:reduce){.progress-bar-animated{animation:none}}.media{display:flex;align-items:flex-start}.media-body{flex:1}.list-group{display:flex;flex-direction:column;padding-left:0;margin-bottom:0;border-radius:.25rem}.list-group-item-action{width:100%;color:#495057;text-align:inherit}.list-group-item-action:focus,.list-group-item-action:hover{z-index:1;color:#495057;text-decoration:none;background-color:#f8f9fa}.list-group-item-action:active{color:#212529;background-color:#e9ecef}.list-group-item{position:relative;display:block;padding:.75rem 1.25rem;background-color:#fff;border:1px solid rgba(0,0,0,.125)}.list-group-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.list-group-item:last-child{border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.list-group-item.disabled,.list-group-item:disabled{color:#6c757d;pointer-events:none;background-color:#fff}.list-group-item.active{z-index:2;color:#fff;background-color:#007bff;border-color:#007bff}.list-group-item+.list-group-item{border-top-width:0}.list-group-item+.list-group-item.active{margin-top:-1px;border-top-width:1px}.list-group-horizontal{flex-direction:row}.list-group-horizontal>.list-group-item:first-child{border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal>.list-group-item:last-child{border-top-right-radius:.25rem;border-bottom-left-radius:0}.list-group-horizontal>.list-group-item.active{margin-top:0}.list-group-horizontal>.list-group-item+.list-group-item{border-top-width:1px;border-left-width:0}.list-group-horizontal>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}@media (min-width:540px){.list-group-horizontal-sm{flex-direction:row}.list-group-horizontal-sm>.list-group-item:first-child{border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-sm>.list-group-item:last-child{border-top-right-radius:.25rem;border-bottom-left-radius:0}.list-group-horizontal-sm>.list-group-item.active{margin-top:0}.list-group-horizontal-sm>.list-group-item+.list-group-item{border-top-width:1px;border-left-width:0}.list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}}@media (min-width:720px){.list-group-horizontal-md{flex-direction:row}.list-group-horizontal-md>.list-group-item:first-child{border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-md>.list-group-item:last-child{border-top-right-radius:.25rem;border-bottom-left-radius:0}.list-group-horizontal-md>.list-group-item.active{margin-top:0}.list-group-horizontal-md>.list-group-item+.list-group-item{border-top-width:1px;border-left-width:0}.list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}}@media (min-width:960px){.list-group-horizontal-lg{flex-direction:row}.list-group-horizontal-lg>.list-group-item:first-child{border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-lg>.list-group-item:last-child{border-top-right-radius:.25rem;border-bottom-left-radius:0}.list-group-horizontal-lg>.list-group-item.active{margin-top:0}.list-group-horizontal-lg>.list-group-item+.list-group-item{border-top-width:1px;border-left-width:0}.list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}}@media (min-width:1200px){.list-group-horizontal-xl{flex-direction:row}.list-group-horizontal-xl>.list-group-item:first-child{border-bottom-left-radius:.25rem;border-top-right-radius:0}.list-group-horizontal-xl>.list-group-item:last-child{border-top-right-radius:.25rem;border-bottom-left-radius:0}.list-group-horizontal-xl>.list-group-item.active{margin-top:0}.list-group-horizontal-xl>.list-group-item+.list-group-item{border-top-width:1px;border-left-width:0}.list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-left:-1px;border-left-width:1px}}.list-group-flush{border-radius:0}.list-group-flush>.list-group-item{border-width:0 0 1px}.list-group-flush>.list-group-item:last-child{border-bottom-width:0}.list-group-item-primary{color:#004085;background-color:#b8daff}.list-group-item-primary.list-group-item-action:focus,.list-group-item-primary.list-group-item-action:hover{color:#004085;background-color:#9fcdff}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#004085;border-color:#004085}.list-group-item-secondary{color:#383d41;background-color:#d6d8db}.list-group-item-secondary.list-group-item-action:focus,.list-group-item-secondary.list-group-item-action:hover{color:#383d41;background-color:#c8cbcf}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#383d41;border-color:#383d41}.list-group-item-success{color:#155724;background-color:#c3e6cb}.list-group-item-success.list-group-item-action:focus,.list-group-item-success.list-group-item-action:hover{color:#155724;background-color:#b1dfbb}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#155724;border-color:#155724}.list-group-item-info{color:#0c5460;background-color:#bee5eb}.list-group-item-info.list-group-item-action:focus,.list-group-item-info.list-group-item-action:hover{color:#0c5460;background-color:#abdde5}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#0c5460;border-color:#0c5460}.list-group-item-warning{color:#856404;background-color:#ffeeba}.list-group-item-warning.list-group-item-action:focus,.list-group-item-warning.list-group-item-action:hover{color:#856404;background-color:#ffe8a1}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#856404;border-color:#856404}.list-group-item-danger{color:#721c24;background-color:#f5c6cb}.list-group-item-danger.list-group-item-action:focus,.list-group-item-danger.list-group-item-action:hover{color:#721c24;background-color:#f1b0b7}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#721c24;border-color:#721c24}.list-group-item-light{color:#818182;background-color:#fdfdfe}.list-group-item-light.list-group-item-action:focus,.list-group-item-light.list-group-item-action:hover{color:#818182;background-color:#ececf6}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#818182;border-color:#818182}.list-group-item-dark{color:#1b1e21;background-color:#c6c8ca}.list-group-item-dark.list-group-item-action:focus,.list-group-item-dark.list-group-item-action:hover{color:#1b1e21;background-color:#b9bbbe}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#1b1e21;border-color:#1b1e21}.close{float:right;font-size:1.5rem;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.5}.close:hover{color:#000;text-decoration:none}.close:not(:disabled):not(.disabled):focus,.close:not(:disabled):not(.disabled):hover{opacity:.75}button.close{padding:0;background-color:transparent;border:0}a.close.disabled{pointer-events:none}.toast{flex-basis:350px;max-width:350px;font-size:.875rem;background-color:hsla(0,0%,100%,.85);background-clip:padding-box;border:1px solid rgba(0,0,0,.1);box-shadow:0 .25rem .75rem rgba(0,0,0,.1);opacity:0;border-radius:.25rem}.toast:not(:last-child){margin-bottom:.75rem}.toast.showing{opacity:1}.toast.show{display:block;opacity:1}.toast.hide{display:none}.toast-header{display:flex;align-items:center;padding:.25rem .75rem;color:#6c757d;background-color:hsla(0,0%,100%,.85);background-clip:padding-box;border-bottom:1px solid rgba(0,0,0,.05);border-top-left-radius:calc(.25rem - 1px);border-top-right-radius:calc(.25rem - 1px)}.toast-body{padding:.75rem}.modal-open{overflow:hidden}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal{position:fixed;top:0;left:0;z-index:1050;display:none;width:100%;height:100%;overflow:hidden;outline:0}.modal-dialog{position:relative;width:auto;margin:.5rem;pointer-events:none}.modal.fade .modal-dialog{transition:transform .3s ease-out;transform:translateY(-50px)}@media (prefers-reduced-motion:reduce){.modal.fade .modal-dialog{transition:none}}.modal.show .modal-dialog{transform:none}.modal.modal-static .modal-dialog{transform:scale(1.02)}.modal-dialog-scrollable{display:flex;max-height:calc(100% - 1rem)}.modal-dialog-scrollable .modal-content{max-height:calc(100vh - 1rem);overflow:hidden}.modal-dialog-scrollable .modal-footer,.modal-dialog-scrollable .modal-header{flex-shrink:0}.modal-dialog-scrollable .modal-body{overflow-y:auto}.modal-dialog-centered{display:flex;align-items:center;min-height:calc(100% - 1rem)}.modal-dialog-centered:before{display:block;height:calc(100vh - 1rem);height:min-content;content:""}.modal-dialog-centered.modal-dialog-scrollable{flex-direction:column;justify-content:center;height:100%}.modal-dialog-centered.modal-dialog-scrollable .modal-content{max-height:none}.modal-dialog-centered.modal-dialog-scrollable:before{content:none}.modal-content{position:relative;display:flex;flex-direction:column;width:100%;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0}.modal-backdrop{position:fixed;top:0;left:0;z-index:1040;width:100vw;height:100vh;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop.show{opacity:.5}.modal-header{display:flex;align-items:flex-start;justify-content:space-between;padding:1rem;border-bottom:1px solid #dee2e6;border-top-left-radius:calc(.3rem - 1px);border-top-right-radius:calc(.3rem - 1px)}.modal-header .close{padding:1rem;margin:-1rem -1rem -1rem auto}.modal-title{margin-bottom:0;line-height:1.5}.modal-body{position:relative;flex:1 1 auto;padding:1rem}.modal-footer{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;padding:.75rem;border-top:1px solid #dee2e6;border-bottom-right-radius:calc(.3rem - 1px);border-bottom-left-radius:calc(.3rem - 1px)}.modal-footer>*{margin:.25rem}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:540px){.modal-dialog{max-width:500px;margin:1.75rem auto}.modal-dialog-scrollable{max-height:calc(100% - 3.5rem)}.modal-dialog-scrollable .modal-content{max-height:calc(100vh - 3.5rem)}.modal-dialog-centered{min-height:calc(100% - 3.5rem)}.modal-dialog-centered:before{height:calc(100vh - 3.5rem);height:min-content}.modal-sm{max-width:300px}}@media (min-width:960px){.modal-lg,.modal-xl{max-width:800px}}@media (min-width:1200px){.modal-xl{max-width:1140px}}.tooltip{position:absolute;z-index:1070;display:block;margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Liberation Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;opacity:0}.tooltip.show{opacity:.9}.tooltip .arrow{position:absolute;display:block;width:.8rem;height:.4rem}.tooltip .arrow:before{position:absolute;content:"";border-color:transparent;border-style:solid}.bs-tooltip-auto[x-placement^=top],.bs-tooltip-top{padding:.4rem 0}.bs-tooltip-auto[x-placement^=top] .arrow,.bs-tooltip-top .arrow{bottom:0}.bs-tooltip-auto[x-placement^=top] .arrow:before,.bs-tooltip-top .arrow:before{top:0;border-width:.4rem .4rem 0;border-top-color:#000}.bs-tooltip-auto[x-placement^=right],.bs-tooltip-right{padding:0 .4rem}.bs-tooltip-auto[x-placement^=right] .arrow,.bs-tooltip-right .arrow{left:0;width:.4rem;height:.8rem}.bs-tooltip-auto[x-placement^=right] .arrow:before,.bs-tooltip-right .arrow:before{right:0;border-width:.4rem .4rem .4rem 0;border-right-color:#000}.bs-tooltip-auto[x-placement^=bottom],.bs-tooltip-bottom{padding:.4rem 0}.bs-tooltip-auto[x-placement^=bottom] .arrow,.bs-tooltip-bottom .arrow{top:0}.bs-tooltip-auto[x-placement^=bottom] .arrow:before,.bs-tooltip-bottom .arrow:before{bottom:0;border-width:0 .4rem .4rem;border-bottom-color:#000}.bs-tooltip-auto[x-placement^=left],.bs-tooltip-left{padding:0 .4rem}.bs-tooltip-auto[x-placement^=left] .arrow,.bs-tooltip-left .arrow{right:0;width:.4rem;height:.8rem}.bs-tooltip-auto[x-placement^=left] .arrow:before,.bs-tooltip-left .arrow:before{left:0;border-width:.4rem 0 .4rem .4rem;border-left-color:#000}.tooltip-inner{max-width:200px;padding:.25rem .5rem;color:#fff;text-align:center;background-color:#000;border-radius:.25rem}.popover{top:0;left:0;z-index:1060;max-width:276px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,Liberation Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;white-space:normal;line-break:auto;font-size:.875rem;word-wrap:break-word;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem}.popover,.popover .arrow{position:absolute;display:block}.popover .arrow{width:1rem;height:.5rem;margin:0 .3rem}.popover .arrow:after,.popover .arrow:before{position:absolute;display:block;content:"";border-color:transparent;border-style:solid}.bs-popover-auto[x-placement^=top],.bs-popover-top{margin-bottom:.5rem}.bs-popover-auto[x-placement^=top]>.arrow,.bs-popover-top>.arrow{bottom:calc(-.5rem - 1px)}.bs-popover-auto[x-placement^=top]>.arrow:before,.bs-popover-top>.arrow:before{bottom:0;border-width:.5rem .5rem 0;border-top-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=top]>.arrow:after,.bs-popover-top>.arrow:after{bottom:1px;border-width:.5rem .5rem 0;border-top-color:#fff}.bs-popover-auto[x-placement^=right],.bs-popover-right{margin-left:.5rem}.bs-popover-auto[x-placement^=right]>.arrow,.bs-popover-right>.arrow{left:calc(-.5rem - 1px);width:.5rem;height:1rem;margin:.3rem 0}.bs-popover-auto[x-placement^=right]>.arrow:before,.bs-popover-right>.arrow:before{left:0;border-width:.5rem .5rem .5rem 0;border-right-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=right]>.arrow:after,.bs-popover-right>.arrow:after{left:1px;border-width:.5rem .5rem .5rem 0;border-right-color:#fff}.bs-popover-auto[x-placement^=bottom],.bs-popover-bottom{margin-top:.5rem}.bs-popover-auto[x-placement^=bottom]>.arrow,.bs-popover-bottom>.arrow{top:calc(-.5rem - 1px)}.bs-popover-auto[x-placement^=bottom]>.arrow:before,.bs-popover-bottom>.arrow:before{top:0;border-width:0 .5rem .5rem;border-bottom-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=bottom]>.arrow:after,.bs-popover-bottom>.arrow:after{top:1px;border-width:0 .5rem .5rem;border-bottom-color:#fff}.bs-popover-auto[x-placement^=bottom] .popover-header:before,.bs-popover-bottom .popover-header:before{position:absolute;top:0;left:50%;display:block;width:1rem;margin-left:-.5rem;content:"";border-bottom:1px solid #f7f7f7}.bs-popover-auto[x-placement^=left],.bs-popover-left{margin-right:.5rem}.bs-popover-auto[x-placement^=left]>.arrow,.bs-popover-left>.arrow{right:calc(-.5rem - 1px);width:.5rem;height:1rem;margin:.3rem 0}.bs-popover-auto[x-placement^=left]>.arrow:before,.bs-popover-left>.arrow:before{right:0;border-width:.5rem 0 .5rem .5rem;border-left-color:rgba(0,0,0,.25)}.bs-popover-auto[x-placement^=left]>.arrow:after,.bs-popover-left>.arrow:after{right:1px;border-width:.5rem 0 .5rem .5rem;border-left-color:#fff}.popover-header{padding:.5rem .75rem;margin-bottom:0;font-size:1rem;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-top-left-radius:calc(.3rem - 1px);border-top-right-radius:calc(.3rem - 1px)}.popover-header:empty{display:none}.popover-body{padding:.5rem .75rem;color:#212529}.carousel{position:relative}.carousel.pointer-event{touch-action:pan-y}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner:after{display:block;clear:both;content:""}.carousel-item{position:relative;display:none;float:left;width:100%;margin-right:-100%;backface-visibility:hidden;transition:transform .6s ease-in-out}@media (prefers-reduced-motion:reduce){.carousel-item{transition:none}}.carousel-item-next,.carousel-item-prev,.carousel-item.active{display:block}.active.carousel-item-right,.carousel-item-next:not(.carousel-item-left){transform:translateX(100%)}.active.carousel-item-left,.carousel-item-prev:not(.carousel-item-right){transform:translateX(-100%)}.carousel-fade .carousel-item{opacity:0;transition-property:opacity;transform:none}.carousel-fade .carousel-item-next.carousel-item-left,.carousel-fade .carousel-item-prev.carousel-item-right,.carousel-fade .carousel-item.active{z-index:1;opacity:1}.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-right{z-index:0;opacity:0;transition:opacity 0s .6s}@media (prefers-reduced-motion:reduce){.carousel-fade .active.carousel-item-left,.carousel-fade .active.carousel-item-right{transition:none}}.carousel-control-next,.carousel-control-prev{position:absolute;top:0;bottom:0;z-index:1;display:flex;align-items:center;justify-content:center;width:15%;color:#fff;text-align:center;opacity:.5;transition:opacity .15s ease}@media (prefers-reduced-motion:reduce){.carousel-control-next,.carousel-control-prev{transition:none}}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff;text-decoration:none;outline:0;opacity:.9}.carousel-control-prev{left:0}.carousel-control-next{right:0}.carousel-control-next-icon,.carousel-control-prev-icon{display:inline-block;width:20px;height:20px;background:50%/100% 100% no-repeat}.carousel-control-prev-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' width='8' height='8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5L4.25 4l2.5-2.5L5.25 0z'/%3E%3C/svg%3E")}.carousel-control-next-icon{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' width='8' height='8'%3E%3Cpath d='M2.75 0l-1.5 1.5L3.75 4l-2.5 2.5L2.75 8l4-4-4-4z'/%3E%3C/svg%3E")}.carousel-indicators{position:absolute;right:0;bottom:0;left:0;z-index:15;display:flex;justify-content:center;padding-left:0;margin-right:15%;margin-left:15%;list-style:none}.carousel-indicators li{box-sizing:content-box;flex:0 1 auto;width:30px;height:3px;margin-right:3px;margin-left:3px;text-indent:-999px;cursor:pointer;background-color:#fff;background-clip:padding-box;border-top:10px solid transparent;border-bottom:10px solid transparent;opacity:.5;transition:opacity .6s ease}@media (prefers-reduced-motion:reduce){.carousel-indicators li{transition:none}}.carousel-indicators .active{opacity:1}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center}@keyframes spinner-border{to{transform:rotate(1turn)}}.spinner-border{display:inline-block;width:2rem;height:2rem;vertical-align:text-bottom;border:.25em solid;border-right:.25em solid transparent;border-radius:50%;animation:spinner-border .75s linear infinite}.spinner-border-sm{width:1rem;height:1rem;border-width:.2em}@keyframes spinner-grow{0%{transform:scale(0)}50%{opacity:1;transform:none}}.spinner-grow{display:inline-block;width:2rem;height:2rem;vertical-align:text-bottom;background-color:currentColor;border-radius:50%;opacity:0;animation:spinner-grow .75s linear infinite}.spinner-grow-sm{width:1rem;height:1rem}@media (prefers-reduced-motion:reduce){.spinner-border,.spinner-grow{animation-duration:1.5s}}.align-baseline{vertical-align:baseline!important}.align-top{vertical-align:top!important}.align-middle{vertical-align:middle!important}.align-bottom{vertical-align:bottom!important}.align-text-bottom{vertical-align:text-bottom!important}.align-text-top{vertical-align:text-top!important}.bg-primary{background-color:#007bff!important}a.bg-primary:focus,a.bg-primary:hover,button.bg-primary:focus,button.bg-primary:hover{background-color:#0062cc!important}.bg-secondary{background-color:#6c757d!important}a.bg-secondary:focus,a.bg-secondary:hover,button.bg-secondary:focus,button.bg-secondary:hover{background-color:#545b62!important}.bg-success{background-color:#28a745!important}a.bg-success:focus,a.bg-success:hover,button.bg-success:focus,button.bg-success:hover{background-color:#1e7e34!important}.bg-info{background-color:#17a2b8!important}a.bg-info:focus,a.bg-info:hover,button.bg-info:focus,button.bg-info:hover{background-color:#117a8b!important}.bg-warning{background-color:#ffc107!important}a.bg-warning:focus,a.bg-warning:hover,button.bg-warning:focus,button.bg-warning:hover{background-color:#d39e00!important}.bg-danger{background-color:#dc3545!important}a.bg-danger:focus,a.bg-danger:hover,button.bg-danger:focus,button.bg-danger:hover{background-color:#bd2130!important}.bg-light{background-color:#f8f9fa!important}a.bg-light:focus,a.bg-light:hover,button.bg-light:focus,button.bg-light:hover{background-color:#dae0e5!important}.bg-dark{background-color:#343a40!important}a.bg-dark:focus,a.bg-dark:hover,button.bg-dark:focus,button.bg-dark:hover{background-color:#1d2124!important}.bg-white{background-color:#fff!important}.bg-transparent{background-color:transparent!important}.border{border:1px solid #dee2e6!important}.border-top{border-top:1px solid #dee2e6!important}.border-right{border-right:1px solid #dee2e6!important}.border-bottom{border-bottom:1px solid #dee2e6!important}.border-left{border-left:1px solid #dee2e6!important}.border-0{border:0!important}.border-top-0{border-top:0!important}.border-right-0{border-right:0!important}.border-bottom-0{border-bottom:0!important}.border-left-0{border-left:0!important}.border-primary{border-color:#007bff!important}.border-secondary{border-color:#6c757d!important}.border-success{border-color:#28a745!important}.border-info{border-color:#17a2b8!important}.border-warning{border-color:#ffc107!important}.border-danger{border-color:#dc3545!important}.border-light{border-color:#f8f9fa!important}.border-dark{border-color:#343a40!important}.border-white{border-color:#fff!important}.rounded-sm{border-radius:.2rem!important}.rounded{border-radius:.25rem!important}.rounded-top{border-top-left-radius:.25rem!important}.rounded-right,.rounded-top{border-top-right-radius:.25rem!important}.rounded-bottom,.rounded-right{border-bottom-right-radius:.25rem!important}.rounded-bottom,.rounded-left{border-bottom-left-radius:.25rem!important}.rounded-left{border-top-left-radius:.25rem!important}.rounded-lg{border-radius:.3rem!important}.rounded-circle{border-radius:50%!important}.rounded-pill{border-radius:50rem!important}.rounded-0{border-radius:0!important}.clearfix:after{display:block;clear:both;content:""}.d-none{display:none!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:flex!important}.d-inline-flex{display:inline-flex!important}@media (min-width:540px){.d-sm-none{display:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:flex!important}.d-sm-inline-flex{display:inline-flex!important}}@media (min-width:720px){.d-md-none{display:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:flex!important}.d-md-inline-flex{display:inline-flex!important}}@media (min-width:960px){.d-lg-none{display:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:flex!important}.d-lg-inline-flex{display:inline-flex!important}}@media (min-width:1200px){.d-xl-none{display:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:flex!important}.d-xl-inline-flex{display:inline-flex!important}}@media print{.d-print-none{display:none!important}.d-print-inline{display:inline!important}.d-print-inline-block{display:inline-block!important}.d-print-block{display:block!important}.d-print-table{display:table!important}.d-print-table-row{display:table-row!important}.d-print-table-cell{display:table-cell!important}.d-print-flex{display:flex!important}.d-print-inline-flex{display:inline-flex!important}}.embed-responsive{position:relative;display:block;width:100%;padding:0;overflow:hidden}.embed-responsive:before{display:block;content:""}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-21by9:before{padding-top:42.85714%}.embed-responsive-16by9:before{padding-top:56.25%}.embed-responsive-4by3:before{padding-top:75%}.embed-responsive-1by1:before{padding-top:100%}.flex-row{flex-direction:row!important}.flex-column{flex-direction:column!important}.flex-row-reverse{flex-direction:row-reverse!important}.flex-column-reverse{flex-direction:column-reverse!important}.flex-wrap{flex-wrap:wrap!important}.flex-nowrap{flex-wrap:nowrap!important}.flex-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-fill{flex:1 1 auto!important}.flex-grow-0{flex-grow:0!important}.flex-grow-1{flex-grow:1!important}.flex-shrink-0{flex-shrink:0!important}.flex-shrink-1{flex-shrink:1!important}.justify-content-start{justify-content:flex-start!important}.justify-content-end{justify-content:flex-end!important}.justify-content-center{justify-content:center!important}.justify-content-between{justify-content:space-between!important}.justify-content-around{justify-content:space-around!important}.align-items-start{align-items:flex-start!important}.align-items-end{align-items:flex-end!important}.align-items-center{align-items:center!important}.align-items-baseline{align-items:baseline!important}.align-items-stretch{align-items:stretch!important}.align-content-start{align-content:flex-start!important}.align-content-end{align-content:flex-end!important}.align-content-center{align-content:center!important}.align-content-between{align-content:space-between!important}.align-content-around{align-content:space-around!important}.align-content-stretch{align-content:stretch!important}.align-self-auto{align-self:auto!important}.align-self-start{align-self:flex-start!important}.align-self-end{align-self:flex-end!important}.align-self-center{align-self:center!important}.align-self-baseline{align-self:baseline!important}.align-self-stretch{align-self:stretch!important}@media (min-width:540px){.flex-sm-row{flex-direction:row!important}.flex-sm-column{flex-direction:column!important}.flex-sm-row-reverse{flex-direction:row-reverse!important}.flex-sm-column-reverse{flex-direction:column-reverse!important}.flex-sm-wrap{flex-wrap:wrap!important}.flex-sm-nowrap{flex-wrap:nowrap!important}.flex-sm-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-sm-fill{flex:1 1 auto!important}.flex-sm-grow-0{flex-grow:0!important}.flex-sm-grow-1{flex-grow:1!important}.flex-sm-shrink-0{flex-shrink:0!important}.flex-sm-shrink-1{flex-shrink:1!important}.justify-content-sm-start{justify-content:flex-start!important}.justify-content-sm-end{justify-content:flex-end!important}.justify-content-sm-center{justify-content:center!important}.justify-content-sm-between{justify-content:space-between!important}.justify-content-sm-around{justify-content:space-around!important}.align-items-sm-start{align-items:flex-start!important}.align-items-sm-end{align-items:flex-end!important}.align-items-sm-center{align-items:center!important}.align-items-sm-baseline{align-items:baseline!important}.align-items-sm-stretch{align-items:stretch!important}.align-content-sm-start{align-content:flex-start!important}.align-content-sm-end{align-content:flex-end!important}.align-content-sm-center{align-content:center!important}.align-content-sm-between{align-content:space-between!important}.align-content-sm-around{align-content:space-around!important}.align-content-sm-stretch{align-content:stretch!important}.align-self-sm-auto{align-self:auto!important}.align-self-sm-start{align-self:flex-start!important}.align-self-sm-end{align-self:flex-end!important}.align-self-sm-center{align-self:center!important}.align-self-sm-baseline{align-self:baseline!important}.align-self-sm-stretch{align-self:stretch!important}}@media (min-width:720px){.flex-md-row{flex-direction:row!important}.flex-md-column{flex-direction:column!important}.flex-md-row-reverse{flex-direction:row-reverse!important}.flex-md-column-reverse{flex-direction:column-reverse!important}.flex-md-wrap{flex-wrap:wrap!important}.flex-md-nowrap{flex-wrap:nowrap!important}.flex-md-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-md-fill{flex:1 1 auto!important}.flex-md-grow-0{flex-grow:0!important}.flex-md-grow-1{flex-grow:1!important}.flex-md-shrink-0{flex-shrink:0!important}.flex-md-shrink-1{flex-shrink:1!important}.justify-content-md-start{justify-content:flex-start!important}.justify-content-md-end{justify-content:flex-end!important}.justify-content-md-center{justify-content:center!important}.justify-content-md-between{justify-content:space-between!important}.justify-content-md-around{justify-content:space-around!important}.align-items-md-start{align-items:flex-start!important}.align-items-md-end{align-items:flex-end!important}.align-items-md-center{align-items:center!important}.align-items-md-baseline{align-items:baseline!important}.align-items-md-stretch{align-items:stretch!important}.align-content-md-start{align-content:flex-start!important}.align-content-md-end{align-content:flex-end!important}.align-content-md-center{align-content:center!important}.align-content-md-between{align-content:space-between!important}.align-content-md-around{align-content:space-around!important}.align-content-md-stretch{align-content:stretch!important}.align-self-md-auto{align-self:auto!important}.align-self-md-start{align-self:flex-start!important}.align-self-md-end{align-self:flex-end!important}.align-self-md-center{align-self:center!important}.align-self-md-baseline{align-self:baseline!important}.align-self-md-stretch{align-self:stretch!important}}@media (min-width:960px){.flex-lg-row{flex-direction:row!important}.flex-lg-column{flex-direction:column!important}.flex-lg-row-reverse{flex-direction:row-reverse!important}.flex-lg-column-reverse{flex-direction:column-reverse!important}.flex-lg-wrap{flex-wrap:wrap!important}.flex-lg-nowrap{flex-wrap:nowrap!important}.flex-lg-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-lg-fill{flex:1 1 auto!important}.flex-lg-grow-0{flex-grow:0!important}.flex-lg-grow-1{flex-grow:1!important}.flex-lg-shrink-0{flex-shrink:0!important}.flex-lg-shrink-1{flex-shrink:1!important}.justify-content-lg-start{justify-content:flex-start!important}.justify-content-lg-end{justify-content:flex-end!important}.justify-content-lg-center{justify-content:center!important}.justify-content-lg-between{justify-content:space-between!important}.justify-content-lg-around{justify-content:space-around!important}.align-items-lg-start{align-items:flex-start!important}.align-items-lg-end{align-items:flex-end!important}.align-items-lg-center{align-items:center!important}.align-items-lg-baseline{align-items:baseline!important}.align-items-lg-stretch{align-items:stretch!important}.align-content-lg-start{align-content:flex-start!important}.align-content-lg-end{align-content:flex-end!important}.align-content-lg-center{align-content:center!important}.align-content-lg-between{align-content:space-between!important}.align-content-lg-around{align-content:space-around!important}.align-content-lg-stretch{align-content:stretch!important}.align-self-lg-auto{align-self:auto!important}.align-self-lg-start{align-self:flex-start!important}.align-self-lg-end{align-self:flex-end!important}.align-self-lg-center{align-self:center!important}.align-self-lg-baseline{align-self:baseline!important}.align-self-lg-stretch{align-self:stretch!important}}@media (min-width:1200px){.flex-xl-row{flex-direction:row!important}.flex-xl-column{flex-direction:column!important}.flex-xl-row-reverse{flex-direction:row-reverse!important}.flex-xl-column-reverse{flex-direction:column-reverse!important}.flex-xl-wrap{flex-wrap:wrap!important}.flex-xl-nowrap{flex-wrap:nowrap!important}.flex-xl-wrap-reverse{flex-wrap:wrap-reverse!important}.flex-xl-fill{flex:1 1 auto!important}.flex-xl-grow-0{flex-grow:0!important}.flex-xl-grow-1{flex-grow:1!important}.flex-xl-shrink-0{flex-shrink:0!important}.flex-xl-shrink-1{flex-shrink:1!important}.justify-content-xl-start{justify-content:flex-start!important}.justify-content-xl-end{justify-content:flex-end!important}.justify-content-xl-center{justify-content:center!important}.justify-content-xl-between{justify-content:space-between!important}.justify-content-xl-around{justify-content:space-around!important}.align-items-xl-start{align-items:flex-start!important}.align-items-xl-end{align-items:flex-end!important}.align-items-xl-center{align-items:center!important}.align-items-xl-baseline{align-items:baseline!important}.align-items-xl-stretch{align-items:stretch!important}.align-content-xl-start{align-content:flex-start!important}.align-content-xl-end{align-content:flex-end!important}.align-content-xl-center{align-content:center!important}.align-content-xl-between{align-content:space-between!important}.align-content-xl-around{align-content:space-around!important}.align-content-xl-stretch{align-content:stretch!important}.align-self-xl-auto{align-self:auto!important}.align-self-xl-start{align-self:flex-start!important}.align-self-xl-end{align-self:flex-end!important}.align-self-xl-center{align-self:center!important}.align-self-xl-baseline{align-self:baseline!important}.align-self-xl-stretch{align-self:stretch!important}}.float-left{float:left!important}.float-right{float:right!important}.float-none{float:none!important}@media (min-width:540px){.float-sm-left{float:left!important}.float-sm-right{float:right!important}.float-sm-none{float:none!important}}@media (min-width:720px){.float-md-left{float:left!important}.float-md-right{float:right!important}.float-md-none{float:none!important}}@media (min-width:960px){.float-lg-left{float:left!important}.float-lg-right{float:right!important}.float-lg-none{float:none!important}}@media (min-width:1200px){.float-xl-left{float:left!important}.float-xl-right{float:right!important}.float-xl-none{float:none!important}}.user-select-all{user-select:all!important}.user-select-auto{user-select:auto!important}.user-select-none{user-select:none!important}.overflow-auto{overflow:auto!important}.overflow-hidden{overflow:hidden!important}.position-static{position:static!important}.position-relative{position:relative!important}.position-absolute{position:absolute!important}.position-fixed{position:fixed!important}.position-sticky{position:sticky!important}.fixed-top{top:0}.fixed-bottom,.fixed-top{position:fixed;right:0;left:0;z-index:1030}.fixed-bottom{bottom:0}@supports (position:sticky){.sticky-top{position:sticky;top:0;z-index:1020}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal}.shadow-sm{box-shadow:0 .125rem .25rem rgba(0,0,0,.075)!important}.shadow{box-shadow:0 .5rem 1rem rgba(0,0,0,.15)!important}.shadow-lg{box-shadow:0 1rem 3rem rgba(0,0,0,.175)!important}.shadow-none{box-shadow:none!important}.w-25{width:25%!important}.w-50{width:50%!important}.w-75{width:75%!important}.w-100{width:100%!important}.w-auto{width:auto!important}.h-25{height:25%!important}.h-50{height:50%!important}.h-75{height:75%!important}.h-100{height:100%!important}.h-auto{height:auto!important}.mw-100{max-width:100%!important}.mh-100{max-height:100%!important}.min-vw-100{min-width:100vw!important}.min-vh-100{min-height:100vh!important}.vw-100{width:100vw!important}.vh-100{height:100vh!important}.m-0{margin:0!important}.mt-0,.my-0{margin-top:0!important}.mr-0,.mx-0{margin-right:0!important}.mb-0,.my-0{margin-bottom:0!important}.ml-0,.mx-0{margin-left:0!important}.m-1{margin:.25rem!important}.mt-1,.my-1{margin-top:.25rem!important}.mr-1,.mx-1{margin-right:.25rem!important}.mb-1,.my-1{margin-bottom:.25rem!important}.ml-1,.mx-1{margin-left:.25rem!important}.m-2{margin:.5rem!important}.mt-2,.my-2{margin-top:.5rem!important}.mr-2,.mx-2{margin-right:.5rem!important}.mb-2,.my-2{margin-bottom:.5rem!important}.ml-2,.mx-2{margin-left:.5rem!important}.m-3{margin:1rem!important}.mt-3,.my-3{margin-top:1rem!important}.mr-3,.mx-3{margin-right:1rem!important}.mb-3,.my-3{margin-bottom:1rem!important}.ml-3,.mx-3{margin-left:1rem!important}.m-4{margin:1.5rem!important}.mt-4,.my-4{margin-top:1.5rem!important}.mr-4,.mx-4{margin-right:1.5rem!important}.mb-4,.my-4{margin-bottom:1.5rem!important}.ml-4,.mx-4{margin-left:1.5rem!important}.m-5{margin:3rem!important}.mt-5,.my-5{margin-top:3rem!important}.mr-5,.mx-5{margin-right:3rem!important}.mb-5,.my-5{margin-bottom:3rem!important}.ml-5,.mx-5{margin-left:3rem!important}.p-0{padding:0!important}.pt-0,.py-0{padding-top:0!important}.pr-0,.px-0{padding-right:0!important}.pb-0,.py-0{padding-bottom:0!important}.pl-0,.px-0{padding-left:0!important}.p-1{padding:.25rem!important}.pt-1,.py-1{padding-top:.25rem!important}.pr-1,.px-1{padding-right:.25rem!important}.pb-1,.py-1{padding-bottom:.25rem!important}.pl-1,.px-1{padding-left:.25rem!important}.p-2{padding:.5rem!important}.pt-2,.py-2{padding-top:.5rem!important}.pr-2,.px-2{padding-right:.5rem!important}.pb-2,.py-2{padding-bottom:.5rem!important}.pl-2,.px-2{padding-left:.5rem!important}.p-3{padding:1rem!important}.pt-3,.py-3{padding-top:1rem!important}.pr-3,.px-3{padding-right:1rem!important}.pb-3,.py-3{padding-bottom:1rem!important}.pl-3,.px-3{padding-left:1rem!important}.p-4{padding:1.5rem!important}.pt-4,.py-4{padding-top:1.5rem!important}.pr-4,.px-4{padding-right:1.5rem!important}.pb-4,.py-4{padding-bottom:1.5rem!important}.pl-4,.px-4{padding-left:1.5rem!important}.p-5{padding:3rem!important}.pt-5,.py-5{padding-top:3rem!important}.pr-5,.px-5{padding-right:3rem!important}.pb-5,.py-5{padding-bottom:3rem!important}.pl-5,.px-5{padding-left:3rem!important}.m-n1{margin:-.25rem!important}.mt-n1,.my-n1{margin-top:-.25rem!important}.mr-n1,.mx-n1{margin-right:-.25rem!important}.mb-n1,.my-n1{margin-bottom:-.25rem!important}.ml-n1,.mx-n1{margin-left:-.25rem!important}.m-n2{margin:-.5rem!important}.mt-n2,.my-n2{margin-top:-.5rem!important}.mr-n2,.mx-n2{margin-right:-.5rem!important}.mb-n2,.my-n2{margin-bottom:-.5rem!important}.ml-n2,.mx-n2{margin-left:-.5rem!important}.m-n3{margin:-1rem!important}.mt-n3,.my-n3{margin-top:-1rem!important}.mr-n3,.mx-n3{margin-right:-1rem!important}.mb-n3,.my-n3{margin-bottom:-1rem!important}.ml-n3,.mx-n3{margin-left:-1rem!important}.m-n4{margin:-1.5rem!important}.mt-n4,.my-n4{margin-top:-1.5rem!important}.mr-n4,.mx-n4{margin-right:-1.5rem!important}.mb-n4,.my-n4{margin-bottom:-1.5rem!important}.ml-n4,.mx-n4{margin-left:-1.5rem!important}.m-n5{margin:-3rem!important}.mt-n5,.my-n5{margin-top:-3rem!important}.mr-n5,.mx-n5{margin-right:-3rem!important}.mb-n5,.my-n5{margin-bottom:-3rem!important}.ml-n5,.mx-n5{margin-left:-3rem!important}.m-auto{margin:auto!important}.mt-auto,.my-auto{margin-top:auto!important}.mr-auto,.mx-auto{margin-right:auto!important}.mb-auto,.my-auto{margin-bottom:auto!important}.ml-auto,.mx-auto{margin-left:auto!important}@media (min-width:540px){.m-sm-0{margin:0!important}.mt-sm-0,.my-sm-0{margin-top:0!important}.mr-sm-0,.mx-sm-0{margin-right:0!important}.mb-sm-0,.my-sm-0{margin-bottom:0!important}.ml-sm-0,.mx-sm-0{margin-left:0!important}.m-sm-1{margin:.25rem!important}.mt-sm-1,.my-sm-1{margin-top:.25rem!important}.mr-sm-1,.mx-sm-1{margin-right:.25rem!important}.mb-sm-1,.my-sm-1{margin-bottom:.25rem!important}.ml-sm-1,.mx-sm-1{margin-left:.25rem!important}.m-sm-2{margin:.5rem!important}.mt-sm-2,.my-sm-2{margin-top:.5rem!important}.mr-sm-2,.mx-sm-2{margin-right:.5rem!important}.mb-sm-2,.my-sm-2{margin-bottom:.5rem!important}.ml-sm-2,.mx-sm-2{margin-left:.5rem!important}.m-sm-3{margin:1rem!important}.mt-sm-3,.my-sm-3{margin-top:1rem!important}.mr-sm-3,.mx-sm-3{margin-right:1rem!important}.mb-sm-3,.my-sm-3{margin-bottom:1rem!important}.ml-sm-3,.mx-sm-3{margin-left:1rem!important}.m-sm-4{margin:1.5rem!important}.mt-sm-4,.my-sm-4{margin-top:1.5rem!important}.mr-sm-4,.mx-sm-4{margin-right:1.5rem!important}.mb-sm-4,.my-sm-4{margin-bottom:1.5rem!important}.ml-sm-4,.mx-sm-4{margin-left:1.5rem!important}.m-sm-5{margin:3rem!important}.mt-sm-5,.my-sm-5{margin-top:3rem!important}.mr-sm-5,.mx-sm-5{margin-right:3rem!important}.mb-sm-5,.my-sm-5{margin-bottom:3rem!important}.ml-sm-5,.mx-sm-5{margin-left:3rem!important}.p-sm-0{padding:0!important}.pt-sm-0,.py-sm-0{padding-top:0!important}.pr-sm-0,.px-sm-0{padding-right:0!important}.pb-sm-0,.py-sm-0{padding-bottom:0!important}.pl-sm-0,.px-sm-0{padding-left:0!important}.p-sm-1{padding:.25rem!important}.pt-sm-1,.py-sm-1{padding-top:.25rem!important}.pr-sm-1,.px-sm-1{padding-right:.25rem!important}.pb-sm-1,.py-sm-1{padding-bottom:.25rem!important}.pl-sm-1,.px-sm-1{padding-left:.25rem!important}.p-sm-2{padding:.5rem!important}.pt-sm-2,.py-sm-2{padding-top:.5rem!important}.pr-sm-2,.px-sm-2{padding-right:.5rem!important}.pb-sm-2,.py-sm-2{padding-bottom:.5rem!important}.pl-sm-2,.px-sm-2{padding-left:.5rem!important}.p-sm-3{padding:1rem!important}.pt-sm-3,.py-sm-3{padding-top:1rem!important}.pr-sm-3,.px-sm-3{padding-right:1rem!important}.pb-sm-3,.py-sm-3{padding-bottom:1rem!important}.pl-sm-3,.px-sm-3{padding-left:1rem!important}.p-sm-4{padding:1.5rem!important}.pt-sm-4,.py-sm-4{padding-top:1.5rem!important}.pr-sm-4,.px-sm-4{padding-right:1.5rem!important}.pb-sm-4,.py-sm-4{padding-bottom:1.5rem!important}.pl-sm-4,.px-sm-4{padding-left:1.5rem!important}.p-sm-5{padding:3rem!important}.pt-sm-5,.py-sm-5{padding-top:3rem!important}.pr-sm-5,.px-sm-5{padding-right:3rem!important}.pb-sm-5,.py-sm-5{padding-bottom:3rem!important}.pl-sm-5,.px-sm-5{padding-left:3rem!important}.m-sm-n1{margin:-.25rem!important}.mt-sm-n1,.my-sm-n1{margin-top:-.25rem!important}.mr-sm-n1,.mx-sm-n1{margin-right:-.25rem!important}.mb-sm-n1,.my-sm-n1{margin-bottom:-.25rem!important}.ml-sm-n1,.mx-sm-n1{margin-left:-.25rem!important}.m-sm-n2{margin:-.5rem!important}.mt-sm-n2,.my-sm-n2{margin-top:-.5rem!important}.mr-sm-n2,.mx-sm-n2{margin-right:-.5rem!important}.mb-sm-n2,.my-sm-n2{margin-bottom:-.5rem!important}.ml-sm-n2,.mx-sm-n2{margin-left:-.5rem!important}.m-sm-n3{margin:-1rem!important}.mt-sm-n3,.my-sm-n3{margin-top:-1rem!important}.mr-sm-n3,.mx-sm-n3{margin-right:-1rem!important}.mb-sm-n3,.my-sm-n3{margin-bottom:-1rem!important}.ml-sm-n3,.mx-sm-n3{margin-left:-1rem!important}.m-sm-n4{margin:-1.5rem!important}.mt-sm-n4,.my-sm-n4{margin-top:-1.5rem!important}.mr-sm-n4,.mx-sm-n4{margin-right:-1.5rem!important}.mb-sm-n4,.my-sm-n4{margin-bottom:-1.5rem!important}.ml-sm-n4,.mx-sm-n4{margin-left:-1.5rem!important}.m-sm-n5{margin:-3rem!important}.mt-sm-n5,.my-sm-n5{margin-top:-3rem!important}.mr-sm-n5,.mx-sm-n5{margin-right:-3rem!important}.mb-sm-n5,.my-sm-n5{margin-bottom:-3rem!important}.ml-sm-n5,.mx-sm-n5{margin-left:-3rem!important}.m-sm-auto{margin:auto!important}.mt-sm-auto,.my-sm-auto{margin-top:auto!important}.mr-sm-auto,.mx-sm-auto{margin-right:auto!important}.mb-sm-auto,.my-sm-auto{margin-bottom:auto!important}.ml-sm-auto,.mx-sm-auto{margin-left:auto!important}}@media (min-width:720px){.m-md-0{margin:0!important}.mt-md-0,.my-md-0{margin-top:0!important}.mr-md-0,.mx-md-0{margin-right:0!important}.mb-md-0,.my-md-0{margin-bottom:0!important}.ml-md-0,.mx-md-0{margin-left:0!important}.m-md-1{margin:.25rem!important}.mt-md-1,.my-md-1{margin-top:.25rem!important}.mr-md-1,.mx-md-1{margin-right:.25rem!important}.mb-md-1,.my-md-1{margin-bottom:.25rem!important}.ml-md-1,.mx-md-1{margin-left:.25rem!important}.m-md-2{margin:.5rem!important}.mt-md-2,.my-md-2{margin-top:.5rem!important}.mr-md-2,.mx-md-2{margin-right:.5rem!important}.mb-md-2,.my-md-2{margin-bottom:.5rem!important}.ml-md-2,.mx-md-2{margin-left:.5rem!important}.m-md-3{margin:1rem!important}.mt-md-3,.my-md-3{margin-top:1rem!important}.mr-md-3,.mx-md-3{margin-right:1rem!important}.mb-md-3,.my-md-3{margin-bottom:1rem!important}.ml-md-3,.mx-md-3{margin-left:1rem!important}.m-md-4{margin:1.5rem!important}.mt-md-4,.my-md-4{margin-top:1.5rem!important}.mr-md-4,.mx-md-4{margin-right:1.5rem!important}.mb-md-4,.my-md-4{margin-bottom:1.5rem!important}.ml-md-4,.mx-md-4{margin-left:1.5rem!important}.m-md-5{margin:3rem!important}.mt-md-5,.my-md-5{margin-top:3rem!important}.mr-md-5,.mx-md-5{margin-right:3rem!important}.mb-md-5,.my-md-5{margin-bottom:3rem!important}.ml-md-5,.mx-md-5{margin-left:3rem!important}.p-md-0{padding:0!important}.pt-md-0,.py-md-0{padding-top:0!important}.pr-md-0,.px-md-0{padding-right:0!important}.pb-md-0,.py-md-0{padding-bottom:0!important}.pl-md-0,.px-md-0{padding-left:0!important}.p-md-1{padding:.25rem!important}.pt-md-1,.py-md-1{padding-top:.25rem!important}.pr-md-1,.px-md-1{padding-right:.25rem!important}.pb-md-1,.py-md-1{padding-bottom:.25rem!important}.pl-md-1,.px-md-1{padding-left:.25rem!important}.p-md-2{padding:.5rem!important}.pt-md-2,.py-md-2{padding-top:.5rem!important}.pr-md-2,.px-md-2{padding-right:.5rem!important}.pb-md-2,.py-md-2{padding-bottom:.5rem!important}.pl-md-2,.px-md-2{padding-left:.5rem!important}.p-md-3{padding:1rem!important}.pt-md-3,.py-md-3{padding-top:1rem!important}.pr-md-3,.px-md-3{padding-right:1rem!important}.pb-md-3,.py-md-3{padding-bottom:1rem!important}.pl-md-3,.px-md-3{padding-left:1rem!important}.p-md-4{padding:1.5rem!important}.pt-md-4,.py-md-4{padding-top:1.5rem!important}.pr-md-4,.px-md-4{padding-right:1.5rem!important}.pb-md-4,.py-md-4{padding-bottom:1.5rem!important}.pl-md-4,.px-md-4{padding-left:1.5rem!important}.p-md-5{padding:3rem!important}.pt-md-5,.py-md-5{padding-top:3rem!important}.pr-md-5,.px-md-5{padding-right:3rem!important}.pb-md-5,.py-md-5{padding-bottom:3rem!important}.pl-md-5,.px-md-5{padding-left:3rem!important}.m-md-n1{margin:-.25rem!important}.mt-md-n1,.my-md-n1{margin-top:-.25rem!important}.mr-md-n1,.mx-md-n1{margin-right:-.25rem!important}.mb-md-n1,.my-md-n1{margin-bottom:-.25rem!important}.ml-md-n1,.mx-md-n1{margin-left:-.25rem!important}.m-md-n2{margin:-.5rem!important}.mt-md-n2,.my-md-n2{margin-top:-.5rem!important}.mr-md-n2,.mx-md-n2{margin-right:-.5rem!important}.mb-md-n2,.my-md-n2{margin-bottom:-.5rem!important}.ml-md-n2,.mx-md-n2{margin-left:-.5rem!important}.m-md-n3{margin:-1rem!important}.mt-md-n3,.my-md-n3{margin-top:-1rem!important}.mr-md-n3,.mx-md-n3{margin-right:-1rem!important}.mb-md-n3,.my-md-n3{margin-bottom:-1rem!important}.ml-md-n3,.mx-md-n3{margin-left:-1rem!important}.m-md-n4{margin:-1.5rem!important}.mt-md-n4,.my-md-n4{margin-top:-1.5rem!important}.mr-md-n4,.mx-md-n4{margin-right:-1.5rem!important}.mb-md-n4,.my-md-n4{margin-bottom:-1.5rem!important}.ml-md-n4,.mx-md-n4{margin-left:-1.5rem!important}.m-md-n5{margin:-3rem!important}.mt-md-n5,.my-md-n5{margin-top:-3rem!important}.mr-md-n5,.mx-md-n5{margin-right:-3rem!important}.mb-md-n5,.my-md-n5{margin-bottom:-3rem!important}.ml-md-n5,.mx-md-n5{margin-left:-3rem!important}.m-md-auto{margin:auto!important}.mt-md-auto,.my-md-auto{margin-top:auto!important}.mr-md-auto,.mx-md-auto{margin-right:auto!important}.mb-md-auto,.my-md-auto{margin-bottom:auto!important}.ml-md-auto,.mx-md-auto{margin-left:auto!important}}@media (min-width:960px){.m-lg-0{margin:0!important}.mt-lg-0,.my-lg-0{margin-top:0!important}.mr-lg-0,.mx-lg-0{margin-right:0!important}.mb-lg-0,.my-lg-0{margin-bottom:0!important}.ml-lg-0,.mx-lg-0{margin-left:0!important}.m-lg-1{margin:.25rem!important}.mt-lg-1,.my-lg-1{margin-top:.25rem!important}.mr-lg-1,.mx-lg-1{margin-right:.25rem!important}.mb-lg-1,.my-lg-1{margin-bottom:.25rem!important}.ml-lg-1,.mx-lg-1{margin-left:.25rem!important}.m-lg-2{margin:.5rem!important}.mt-lg-2,.my-lg-2{margin-top:.5rem!important}.mr-lg-2,.mx-lg-2{margin-right:.5rem!important}.mb-lg-2,.my-lg-2{margin-bottom:.5rem!important}.ml-lg-2,.mx-lg-2{margin-left:.5rem!important}.m-lg-3{margin:1rem!important}.mt-lg-3,.my-lg-3{margin-top:1rem!important}.mr-lg-3,.mx-lg-3{margin-right:1rem!important}.mb-lg-3,.my-lg-3{margin-bottom:1rem!important}.ml-lg-3,.mx-lg-3{margin-left:1rem!important}.m-lg-4{margin:1.5rem!important}.mt-lg-4,.my-lg-4{margin-top:1.5rem!important}.mr-lg-4,.mx-lg-4{margin-right:1.5rem!important}.mb-lg-4,.my-lg-4{margin-bottom:1.5rem!important}.ml-lg-4,.mx-lg-4{margin-left:1.5rem!important}.m-lg-5{margin:3rem!important}.mt-lg-5,.my-lg-5{margin-top:3rem!important}.mr-lg-5,.mx-lg-5{margin-right:3rem!important}.mb-lg-5,.my-lg-5{margin-bottom:3rem!important}.ml-lg-5,.mx-lg-5{margin-left:3rem!important}.p-lg-0{padding:0!important}.pt-lg-0,.py-lg-0{padding-top:0!important}.pr-lg-0,.px-lg-0{padding-right:0!important}.pb-lg-0,.py-lg-0{padding-bottom:0!important}.pl-lg-0,.px-lg-0{padding-left:0!important}.p-lg-1{padding:.25rem!important}.pt-lg-1,.py-lg-1{padding-top:.25rem!important}.pr-lg-1,.px-lg-1{padding-right:.25rem!important}.pb-lg-1,.py-lg-1{padding-bottom:.25rem!important}.pl-lg-1,.px-lg-1{padding-left:.25rem!important}.p-lg-2{padding:.5rem!important}.pt-lg-2,.py-lg-2{padding-top:.5rem!important}.pr-lg-2,.px-lg-2{padding-right:.5rem!important}.pb-lg-2,.py-lg-2{padding-bottom:.5rem!important}.pl-lg-2,.px-lg-2{padding-left:.5rem!important}.p-lg-3{padding:1rem!important}.pt-lg-3,.py-lg-3{padding-top:1rem!important}.pr-lg-3,.px-lg-3{padding-right:1rem!important}.pb-lg-3,.py-lg-3{padding-bottom:1rem!important}.pl-lg-3,.px-lg-3{padding-left:1rem!important}.p-lg-4{padding:1.5rem!important}.pt-lg-4,.py-lg-4{padding-top:1.5rem!important}.pr-lg-4,.px-lg-4{padding-right:1.5rem!important}.pb-lg-4,.py-lg-4{padding-bottom:1.5rem!important}.pl-lg-4,.px-lg-4{padding-left:1.5rem!important}.p-lg-5{padding:3rem!important}.pt-lg-5,.py-lg-5{padding-top:3rem!important}.pr-lg-5,.px-lg-5{padding-right:3rem!important}.pb-lg-5,.py-lg-5{padding-bottom:3rem!important}.pl-lg-5,.px-lg-5{padding-left:3rem!important}.m-lg-n1{margin:-.25rem!important}.mt-lg-n1,.my-lg-n1{margin-top:-.25rem!important}.mr-lg-n1,.mx-lg-n1{margin-right:-.25rem!important}.mb-lg-n1,.my-lg-n1{margin-bottom:-.25rem!important}.ml-lg-n1,.mx-lg-n1{margin-left:-.25rem!important}.m-lg-n2{margin:-.5rem!important}.mt-lg-n2,.my-lg-n2{margin-top:-.5rem!important}.mr-lg-n2,.mx-lg-n2{margin-right:-.5rem!important}.mb-lg-n2,.my-lg-n2{margin-bottom:-.5rem!important}.ml-lg-n2,.mx-lg-n2{margin-left:-.5rem!important}.m-lg-n3{margin:-1rem!important}.mt-lg-n3,.my-lg-n3{margin-top:-1rem!important}.mr-lg-n3,.mx-lg-n3{margin-right:-1rem!important}.mb-lg-n3,.my-lg-n3{margin-bottom:-1rem!important}.ml-lg-n3,.mx-lg-n3{margin-left:-1rem!important}.m-lg-n4{margin:-1.5rem!important}.mt-lg-n4,.my-lg-n4{margin-top:-1.5rem!important}.mr-lg-n4,.mx-lg-n4{margin-right:-1.5rem!important}.mb-lg-n4,.my-lg-n4{margin-bottom:-1.5rem!important}.ml-lg-n4,.mx-lg-n4{margin-left:-1.5rem!important}.m-lg-n5{margin:-3rem!important}.mt-lg-n5,.my-lg-n5{margin-top:-3rem!important}.mr-lg-n5,.mx-lg-n5{margin-right:-3rem!important}.mb-lg-n5,.my-lg-n5{margin-bottom:-3rem!important}.ml-lg-n5,.mx-lg-n5{margin-left:-3rem!important}.m-lg-auto{margin:auto!important}.mt-lg-auto,.my-lg-auto{margin-top:auto!important}.mr-lg-auto,.mx-lg-auto{margin-right:auto!important}.mb-lg-auto,.my-lg-auto{margin-bottom:auto!important}.ml-lg-auto,.mx-lg-auto{margin-left:auto!important}}@media (min-width:1200px){.m-xl-0{margin:0!important}.mt-xl-0,.my-xl-0{margin-top:0!important}.mr-xl-0,.mx-xl-0{margin-right:0!important}.mb-xl-0,.my-xl-0{margin-bottom:0!important}.ml-xl-0,.mx-xl-0{margin-left:0!important}.m-xl-1{margin:.25rem!important}.mt-xl-1,.my-xl-1{margin-top:.25rem!important}.mr-xl-1,.mx-xl-1{margin-right:.25rem!important}.mb-xl-1,.my-xl-1{margin-bottom:.25rem!important}.ml-xl-1,.mx-xl-1{margin-left:.25rem!important}.m-xl-2{margin:.5rem!important}.mt-xl-2,.my-xl-2{margin-top:.5rem!important}.mr-xl-2,.mx-xl-2{margin-right:.5rem!important}.mb-xl-2,.my-xl-2{margin-bottom:.5rem!important}.ml-xl-2,.mx-xl-2{margin-left:.5rem!important}.m-xl-3{margin:1rem!important}.mt-xl-3,.my-xl-3{margin-top:1rem!important}.mr-xl-3,.mx-xl-3{margin-right:1rem!important}.mb-xl-3,.my-xl-3{margin-bottom:1rem!important}.ml-xl-3,.mx-xl-3{margin-left:1rem!important}.m-xl-4{margin:1.5rem!important}.mt-xl-4,.my-xl-4{margin-top:1.5rem!important}.mr-xl-4,.mx-xl-4{margin-right:1.5rem!important}.mb-xl-4,.my-xl-4{margin-bottom:1.5rem!important}.ml-xl-4,.mx-xl-4{margin-left:1.5rem!important}.m-xl-5{margin:3rem!important}.mt-xl-5,.my-xl-5{margin-top:3rem!important}.mr-xl-5,.mx-xl-5{margin-right:3rem!important}.mb-xl-5,.my-xl-5{margin-bottom:3rem!important}.ml-xl-5,.mx-xl-5{margin-left:3rem!important}.p-xl-0{padding:0!important}.pt-xl-0,.py-xl-0{padding-top:0!important}.pr-xl-0,.px-xl-0{padding-right:0!important}.pb-xl-0,.py-xl-0{padding-bottom:0!important}.pl-xl-0,.px-xl-0{padding-left:0!important}.p-xl-1{padding:.25rem!important}.pt-xl-1,.py-xl-1{padding-top:.25rem!important}.pr-xl-1,.px-xl-1{padding-right:.25rem!important}.pb-xl-1,.py-xl-1{padding-bottom:.25rem!important}.pl-xl-1,.px-xl-1{padding-left:.25rem!important}.p-xl-2{padding:.5rem!important}.pt-xl-2,.py-xl-2{padding-top:.5rem!important}.pr-xl-2,.px-xl-2{padding-right:.5rem!important}.pb-xl-2,.py-xl-2{padding-bottom:.5rem!important}.pl-xl-2,.px-xl-2{padding-left:.5rem!important}.p-xl-3{padding:1rem!important}.pt-xl-3,.py-xl-3{padding-top:1rem!important}.pr-xl-3,.px-xl-3{padding-right:1rem!important}.pb-xl-3,.py-xl-3{padding-bottom:1rem!important}.pl-xl-3,.px-xl-3{padding-left:1rem!important}.p-xl-4{padding:1.5rem!important}.pt-xl-4,.py-xl-4{padding-top:1.5rem!important}.pr-xl-4,.px-xl-4{padding-right:1.5rem!important}.pb-xl-4,.py-xl-4{padding-bottom:1.5rem!important}.pl-xl-4,.px-xl-4{padding-left:1.5rem!important}.p-xl-5{padding:3rem!important}.pt-xl-5,.py-xl-5{padding-top:3rem!important}.pr-xl-5,.px-xl-5{padding-right:3rem!important}.pb-xl-5,.py-xl-5{padding-bottom:3rem!important}.pl-xl-5,.px-xl-5{padding-left:3rem!important}.m-xl-n1{margin:-.25rem!important}.mt-xl-n1,.my-xl-n1{margin-top:-.25rem!important}.mr-xl-n1,.mx-xl-n1{margin-right:-.25rem!important}.mb-xl-n1,.my-xl-n1{margin-bottom:-.25rem!important}.ml-xl-n1,.mx-xl-n1{margin-left:-.25rem!important}.m-xl-n2{margin:-.5rem!important}.mt-xl-n2,.my-xl-n2{margin-top:-.5rem!important}.mr-xl-n2,.mx-xl-n2{margin-right:-.5rem!important}.mb-xl-n2,.my-xl-n2{margin-bottom:-.5rem!important}.ml-xl-n2,.mx-xl-n2{margin-left:-.5rem!important}.m-xl-n3{margin:-1rem!important}.mt-xl-n3,.my-xl-n3{margin-top:-1rem!important}.mr-xl-n3,.mx-xl-n3{margin-right:-1rem!important}.mb-xl-n3,.my-xl-n3{margin-bottom:-1rem!important}.ml-xl-n3,.mx-xl-n3{margin-left:-1rem!important}.m-xl-n4{margin:-1.5rem!important}.mt-xl-n4,.my-xl-n4{margin-top:-1.5rem!important}.mr-xl-n4,.mx-xl-n4{margin-right:-1.5rem!important}.mb-xl-n4,.my-xl-n4{margin-bottom:-1.5rem!important}.ml-xl-n4,.mx-xl-n4{margin-left:-1.5rem!important}.m-xl-n5{margin:-3rem!important}.mt-xl-n5,.my-xl-n5{margin-top:-3rem!important}.mr-xl-n5,.mx-xl-n5{margin-right:-3rem!important}.mb-xl-n5,.my-xl-n5{margin-bottom:-3rem!important}.ml-xl-n5,.mx-xl-n5{margin-left:-3rem!important}.m-xl-auto{margin:auto!important}.mt-xl-auto,.my-xl-auto{margin-top:auto!important}.mr-xl-auto,.mx-xl-auto{margin-right:auto!important}.mb-xl-auto,.my-xl-auto{margin-bottom:auto!important}.ml-xl-auto,.mx-xl-auto{margin-left:auto!important}}.stretched-link:after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:auto;content:"";background-color:transparent}.text-monospace{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace!important}.text-justify{text-align:justify!important}.text-wrap{white-space:normal!important}.text-nowrap{white-space:nowrap!important}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-left{text-align:left!important}.text-right{text-align:right!important}.text-center{text-align:center!important}@media (min-width:540px){.text-sm-left{text-align:left!important}.text-sm-right{text-align:right!important}.text-sm-center{text-align:center!important}}@media (min-width:720px){.text-md-left{text-align:left!important}.text-md-right{text-align:right!important}.text-md-center{text-align:center!important}}@media (min-width:960px){.text-lg-left{text-align:left!important}.text-lg-right{text-align:right!important}.text-lg-center{text-align:center!important}}@media (min-width:1200px){.text-xl-left{text-align:left!important}.text-xl-right{text-align:right!important}.text-xl-center{text-align:center!important}}.text-lowercase{text-transform:lowercase!important}.text-uppercase{text-transform:uppercase!important}.text-capitalize{text-transform:capitalize!important}.font-weight-light{font-weight:300!important}.font-weight-lighter{font-weight:lighter!important}.font-weight-normal{font-weight:400!important}.font-weight-bold{font-weight:700!important}.font-weight-bolder{font-weight:bolder!important}.font-italic{font-style:italic!important}.text-white{color:#fff!important}.text-primary{color:#007bff!important}a.text-primary:focus,a.text-primary:hover{color:#0056b3!important}.text-secondary{color:#6c757d!important}a.text-secondary:focus,a.text-secondary:hover{color:#494f54!important}.text-success{color:#28a745!important}a.text-success:focus,a.text-success:hover{color:#19692c!important}.text-info{color:#17a2b8!important}a.text-info:focus,a.text-info:hover{color:#0f6674!important}.text-warning{color:#ffc107!important}a.text-warning:focus,a.text-warning:hover{color:#ba8b00!important}.text-danger{color:#dc3545!important}a.text-danger:focus,a.text-danger:hover{color:#a71d2a!important}.text-light{color:#f8f9fa!important}a.text-light:focus,a.text-light:hover{color:#cbd3da!important}.text-dark{color:#343a40!important}a.text-dark:focus,a.text-dark:hover{color:#121416!important}.text-body{color:#212529!important}.text-muted{color:#6c757d!important}.text-black-50{color:rgba(0,0,0,.5)!important}.text-white-50{color:hsla(0,0%,100%,.5)!important}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.text-decoration-none{text-decoration:none!important}.text-break{word-break:break-word!important;word-wrap:break-word!important}.text-reset{color:inherit!important}.visible{visibility:visible!important}.invisible{visibility:hidden!important}@media print{*,:after,:before{text-shadow:none!important;box-shadow:none!important}a:not(.btn){text-decoration:underline}abbr[title]:after{content:" (" attr(title) ")"}pre{white-space:pre-wrap!important}blockquote,pre{border:1px solid #adb5bd;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}@page{size:a3}.container,body{min-width:960px!important}.navbar{display:none}.badge{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #dee2e6!important}.table-dark{color:inherit}.table-dark tbody+tbody,.table-dark td,.table-dark th,.table-dark thead th{border-color:#dee2e6}.table .thead-dark th{color:inherit;border-color:#dee2e6}}html{font-size:var(--pst-font-size-base);scroll-padding-top:calc(var(--pst-header-height) + 12px)}body{padding-top:calc(var(--pst-header-height) + 20px);background-color:#fff;font-family:var(--pst-font-family-base);font-weight:400;line-height:1.65;color:rgba(var(--pst-color-text-base),1)}p{margin-bottom:1.15rem;font-size:1em;color:rgba(var(--pst-color-paragraph),1)}p.rubric{border-bottom:1px solid #c9c9c9}a{color:rgba(var(--pst-color-link),1);text-decoration:none}a:hover{color:rgba(var(--pst-color-link-hover),1);text-decoration:underline}a.headerlink{color:rgba(var(--pst-color-headerlink),1);font-size:.8em;padding:0 4px;text-decoration:none}a.headerlink:hover{background-color:rgba(var(--pst-color-headerlink),1);color:rgba(var(--pst-color-headerlink-hover),1)}.heading-style,h1,h2,h3,h4,h5,h6{margin:2.75rem 0 1.05rem;font-family:var(--pst-font-family-heading);font-weight:400;line-height:1.15}h1{margin-top:0;font-size:var(--pst-font-size-h1);color:rgba(var(--pst-color-h1),1)}h2{font-size:var(--pst-font-size-h2);color:rgba(var(--pst-color-h2),1)}h3{font-size:var(--pst-font-size-h3);color:rgba(var(--pst-color-h3),1)}h4{font-size:var(--pst-font-size-h4);color:rgba(var(--pst-color-h4),1)}h5{font-size:var(--pst-font-size-h5);color:rgba(var(--pst-color-h5),1)}h6{font-size:var(--pst-font-size-h6);color:rgba(var(--pst-color-h6),1)}.text_small,small{font-size:var(--pst-font-size-milli)}hr{border:0;border-top:1px solid #e5e5e5}code,kbd,pre,samp{font-family:var(--pst-font-family-monospace)}code{color:rgba(var(--pst-color-inline-code),1)}pre{margin:1.5em 0;padding:10px;background-color:rgba(var(--pst-color-preformatted-background),1);color:rgba(var(--pst-color-preformatted-text),1);line-height:1.2em;border:1px solid #c9c9c9;border-radius:.2rem;box-shadow:1px 1px 1px #d8d8d8}dd{margin-top:3px;margin-bottom:10px;margin-left:30px}.navbar{position:fixed;min-height:var(--pst-header-height);width:100%;padding:0}.navbar .container-xl{height:100%}@media (min-width:960px){.navbar #navbar-end>.navbar-end-item{display:inline-block}}.navbar-brand{position:relative;height:var(--pst-header-height);width:auto;padding:.5rem 0}.navbar-brand img{max-width:100%;height:100%;width:auto}.navbar-light{background:#fff!important;box-shadow:0 .125rem .25rem 0 rgba(0,0,0,.11)}.navbar-light .navbar-nav li a.nav-link{padding:0 .5rem;color:rgba(var(--pst-color-navbar-link),1)}.navbar-light .navbar-nav li a.nav-link:hover{color:rgba(var(--pst-color-navbar-link-hover),1)}.navbar-light .navbar-nav>.active>.nav-link{font-weight:600;color:rgba(var(--pst-color-navbar-link-active),1)}.navbar-header a{padding:0 15px}.admonition,div.admonition{margin:1.5625em auto;padding:0 .6rem .8rem;overflow:hidden;page-break-inside:avoid;border-left:.2rem solid;border-left-color:rgba(var(--pst-color-admonition-default),1);border-bottom-color:rgba(var(--pst-color-admonition-default),1);border-right-color:rgba(var(--pst-color-admonition-default),1);border-top-color:rgba(var(--pst-color-admonition-default),1);border-radius:.2rem;box-shadow:0 .2rem .5rem rgba(0,0,0,.05),0 0 .0625rem rgba(0,0,0,.1);transition:color .25s,background-color .25s,border-color .25s}.admonition :last-child,div.admonition :last-child{margin-bottom:0}.admonition p.admonition-title~*,div.admonition p.admonition-title~*{padding:0 1.4rem}.admonition>ol,.admonition>ul,div.admonition>ol,div.admonition>ul{margin-left:1em}.admonition>.admonition-title,div.admonition>.admonition-title{position:relative;margin:0 -.6rem;padding:.4rem .6rem .4rem 2rem;font-weight:700;background-color:rgba(var(--pst-color-admonition-default),.1)}.admonition>.admonition-title:before,div.admonition>.admonition-title:before{position:absolute;left:.6rem;width:1rem;height:1rem;color:rgba(var(--pst-color-admonition-default),1);font-family:Font Awesome\ 5 Free;font-weight:900;content:var(--pst-icon-admonition-default)}.admonition>.admonition-title+*,div.admonition>.admonition-title+*{margin-top:.4em}.admonition.attention,div.admonition.attention{border-color:rgba(var(--pst-color-admonition-attention),1)}.admonition.attention>.admonition-title,div.admonition.attention>.admonition-title{background-color:rgba(var(--pst-color-admonition-attention),.1)}.admonition.attention>.admonition-title:before,div.admonition.attention>.admonition-title:before{color:rgba(var(--pst-color-admonition-attention),1);content:var(--pst-icon-admonition-attention)}.admonition.caution,div.admonition.caution{border-color:rgba(var(--pst-color-admonition-caution),1)}.admonition.caution>.admonition-title,div.admonition.caution>.admonition-title{background-color:rgba(var(--pst-color-admonition-caution),.1)}.admonition.caution>.admonition-title:before,div.admonition.caution>.admonition-title:before{color:rgba(var(--pst-color-admonition-caution),1);content:var(--pst-icon-admonition-caution)}.admonition.warning,div.admonition.warning{border-color:rgba(var(--pst-color-admonition-warning),1)}.admonition.warning>.admonition-title,div.admonition.warning>.admonition-title{background-color:rgba(var(--pst-color-admonition-warning),.1)}.admonition.warning>.admonition-title:before,div.admonition.warning>.admonition-title:before{color:rgba(var(--pst-color-admonition-warning),1);content:var(--pst-icon-admonition-warning)}.admonition.danger,div.admonition.danger{border-color:rgba(var(--pst-color-admonition-danger),1)}.admonition.danger>.admonition-title,div.admonition.danger>.admonition-title{background-color:rgba(var(--pst-color-admonition-danger),.1)}.admonition.danger>.admonition-title:before,div.admonition.danger>.admonition-title:before{color:rgba(var(--pst-color-admonition-danger),1);content:var(--pst-icon-admonition-danger)}.admonition.error,div.admonition.error{border-color:rgba(var(--pst-color-admonition-error),1)}.admonition.error>.admonition-title,div.admonition.error>.admonition-title{background-color:rgba(var(--pst-color-admonition-error),.1)}.admonition.error>.admonition-title:before,div.admonition.error>.admonition-title:before{color:rgba(var(--pst-color-admonition-error),1);content:var(--pst-icon-admonition-error)}.admonition.hint,div.admonition.hint{border-color:rgba(var(--pst-color-admonition-hint),1)}.admonition.hint>.admonition-title,div.admonition.hint>.admonition-title{background-color:rgba(var(--pst-color-admonition-hint),.1)}.admonition.hint>.admonition-title:before,div.admonition.hint>.admonition-title:before{color:rgba(var(--pst-color-admonition-hint),1);content:var(--pst-icon-admonition-hint)}.admonition.tip,div.admonition.tip{border-color:rgba(var(--pst-color-admonition-tip),1)}.admonition.tip>.admonition-title,div.admonition.tip>.admonition-title{background-color:rgba(var(--pst-color-admonition-tip),.1)}.admonition.tip>.admonition-title:before,div.admonition.tip>.admonition-title:before{color:rgba(var(--pst-color-admonition-tip),1);content:var(--pst-icon-admonition-tip)}.admonition.important,div.admonition.important{border-color:rgba(var(--pst-color-admonition-important),1)}.admonition.important>.admonition-title,div.admonition.important>.admonition-title{background-color:rgba(var(--pst-color-admonition-important),.1)}.admonition.important>.admonition-title:before,div.admonition.important>.admonition-title:before{color:rgba(var(--pst-color-admonition-important),1);content:var(--pst-icon-admonition-important)}.admonition.note,div.admonition.note{border-color:rgba(var(--pst-color-admonition-note),1)}.admonition.note>.admonition-title,div.admonition.note>.admonition-title{background-color:rgba(var(--pst-color-admonition-note),.1)}.admonition.note>.admonition-title:before,div.admonition.note>.admonition-title:before{color:rgba(var(--pst-color-admonition-note),1);content:var(--pst-icon-admonition-note)}table.field-list{border-collapse:separate;border-spacing:10px;margin-left:1px}table.field-list th.field-name{padding:1px 8px 1px 5px;white-space:nowrap;background-color:#eee}table.field-list td.field-body p{font-style:italic}table.field-list td.field-body p>strong{font-style:normal}table.field-list td.field-body blockquote{border-left:none;margin:0 0 .3em;padding-left:30px}.table.autosummary td:first-child{white-space:nowrap}.sig{font-family:var(--pst-font-family-monospace)}.sig-inline.c-texpr,.sig-inline.cpp-texpr{font-family:unset}.sig.c .k,.sig.c .kt,.sig.c .m,.sig.c .s,.sig.c .sc,.sig.cpp .k,.sig.cpp .kt,.sig.cpp .m,.sig.cpp .s,.sig.cpp .sc{color:rgba(var(--pst-color-text-base),1)}.sig-name{color:rgba(var(--pst-color-inline-code),1)}blockquote{padding:0 1em;color:#6a737d;border-left:.25em solid #dfe2e5}dt.label>span.brackets:not(:only-child):before{content:"["}dt.label>span.brackets:not(:only-child):after{content:"]"}a.footnote-reference{vertical-align:super;font-size:small}div.deprecated{margin-bottom:10px;margin-top:10px;padding:7px;background-color:#f3e5e5;border:1px solid #eed3d7;border-radius:.5rem}div.deprecated p{color:#b94a48;display:inline}.topic{background-color:#eee}.seealso dd{margin-top:0;margin-bottom:0}.viewcode-back{font-family:var(--pst-font-family-base)}.viewcode-block:target{background-color:#f4debf;border-top:1px solid #ac9;border-bottom:1px solid #ac9}span.guilabel{border:1px solid #7fbbe3;background:#e7f2fa;font-size:80%;font-weight:700;border-radius:4px;padding:2.4px 6px;margin:auto 2px}footer{width:100%;border-top:1px solid #ccc;padding:10px}footer .footer-item p{margin-bottom:0}.bd-search{position:relative;padding:1rem 15px;margin-right:-15px;margin-left:-15px}.bd-search .icon{position:absolute;color:#a4a6a7;left:25px;top:25px}.bd-search input{border-radius:0;border:0;border-bottom:1px solid #e5e5e5;padding-left:35px}.bd-toc{-ms-flex-order:2;order:2;height:calc(100vh - 2rem);overflow-y:auto}@supports (position:-webkit-sticky) or (position:sticky){.bd-toc{position:-webkit-sticky;position:sticky;top:calc(var(--pst-header-height) + 20px);height:calc(100vh - 5rem);overflow-y:auto}}.bd-toc .onthispage{color:#a4a6a7}.section-nav{padding-left:0;border-left:1px solid #eee;border-bottom:none}.section-nav ul{padding-left:1rem}.toc-entry,.toc-entry a{display:block}.toc-entry a{padding:.125rem 1.5rem;color:rgba(var(--pst-color-toc-link),1)}@media (min-width:1200px){.toc-entry a{padding-right:0}}.toc-entry a:hover{color:rgba(var(--pst-color-toc-link-hover),1);text-decoration:none}.bd-sidebar{padding-top:1em}@media (min-width:720px){.bd-sidebar{border-right:1px solid rgba(0,0,0,.1)}@supports (position:-webkit-sticky) or (position:sticky){.bd-sidebar{position:-webkit-sticky;position:sticky;top:calc(var(--pst-header-height) + 20px);z-index:1000;height:calc(100vh - var(--pst-header-height) - 20px)}}}.bd-sidebar.no-sidebar{border-right:0}.bd-links{padding-top:1rem;padding-bottom:1rem;margin-right:-15px;margin-left:-15px}@media (min-width:720px){.bd-links{display:block}@supports (position:-webkit-sticky) or (position:sticky){.bd-links{max-height:calc(100vh - 11rem);overflow-y:auto}}}.bd-sidenav{display:none}.bd-content{padding-top:20px}.bd-content .section{max-width:100%}.bd-content .section table{display:block;overflow:auto}.bd-toc-link{display:block;padding:.25rem 1.5rem;font-weight:600;color:rgba(0,0,0,.65)}.bd-toc-link:hover{color:rgba(0,0,0,.85);text-decoration:none}.bd-toc-item.active{margin-bottom:1rem}.bd-toc-item.active:not(:first-child){margin-top:1rem}.bd-toc-item.active>.bd-toc-link{color:rgba(0,0,0,.85)}.bd-toc-item.active>.bd-toc-link:hover{background-color:transparent}.bd-toc-item.active>.bd-sidenav{display:block}nav.bd-links p.caption{font-size:var(--pst-sidebar-caption-font-size);text-transform:uppercase;font-weight:700;position:relative;margin-top:1.25em;margin-bottom:.5em;padding:0 1.5rem;color:rgba(var(--pst-color-sidebar-caption),1)}nav.bd-links p.caption:first-child{margin-top:0}.bd-sidebar .nav{font-size:var(--pst-sidebar-font-size)}.bd-sidebar .nav ul{list-style:none;padding:0 0 0 1.5rem}.bd-sidebar .nav li>a{display:block;padding:.25rem 1.5rem;color:rgba(var(--pst-color-sidebar-link),1)}.bd-sidebar .nav li>a:hover{color:rgba(var(--pst-color-sidebar-link-hover),1);text-decoration:none;background-color:transparent}.bd-sidebar .nav li>a.reference.external:after{font-family:Font Awesome\ 5 Free;font-weight:900;content:"\f35d";font-size:.75em;margin-left:.3em}.bd-sidebar .nav .active:hover>a,.bd-sidebar .nav .active>a{font-weight:600;color:rgba(var(--pst-color-sidebar-link-active),1)}.toc-h2{font-size:.85rem}.toc-h3{font-size:.75rem}.toc-h4{font-size:.65rem}.toc-entry>.nav-link.active{font-weight:600;color:#130654;color:rgba(var(--pst-color-toc-link-active),1);background-color:transparent;border-left:2px solid rgba(var(--pst-color-toc-link-active),1)}.nav-link:hover{border-style:none}#navbar-main-elements li.nav-item i{font-size:.7rem;padding-left:2px;vertical-align:middle}.bd-toc .nav .nav{display:none}.bd-toc .nav .nav.visible,.bd-toc .nav>.active>ul{display:block}.prev-next-area{margin:20px 0}.prev-next-area p{margin:0 .3em;line-height:1.3em}.prev-next-area i{font-size:1.2em}.prev-next-area a{display:flex;align-items:center;border:none;padding:10px;max-width:45%;overflow-x:hidden;color:rgba(0,0,0,.65);text-decoration:none}.prev-next-area a p.prev-next-title{color:rgba(var(--pst-color-link),1);font-weight:600;font-size:1.1em}.prev-next-area a:hover p.prev-next-title{text-decoration:underline}.prev-next-area a .prev-next-info{flex-direction:column;margin:0 .5em}.prev-next-area a .prev-next-info .prev-next-subtitle{text-transform:capitalize}.prev-next-area a.left-prev{float:left}.prev-next-area a.right-next{float:right}.prev-next-area a.right-next div.prev-next-info{text-align:right}.alert{padding-bottom:0}.alert-info a{color:#e83e8c}#navbar-icon-links i.fa,#navbar-icon-links i.fab,#navbar-icon-links i.far,#navbar-icon-links i.fas{vertical-align:middle;font-style:normal;font-size:1.5rem;line-height:1.25}#navbar-icon-links i.fa-github-square:before{color:#333}#navbar-icon-links i.fa-twitter-square:before{color:#55acee}#navbar-icon-links i.fa-gitlab:before{color:#548}#navbar-icon-links i.fa-bitbucket:before{color:#0052cc}.tocsection{border-left:1px solid #eee;padding:.3rem 1.5rem}.tocsection i{padding-right:.5rem}.editthispage{padding-top:2rem}.editthispage a{color:var(--pst-color-sidebar-link-active)}.xr-wrap[hidden]{display:block!important}.toctree-checkbox{position:absolute;display:none}.toctree-checkbox~ul{display:none}.toctree-checkbox~label i{transform:rotate(0deg)}.toctree-checkbox:checked~ul{display:block}.toctree-checkbox:checked~label i{transform:rotate(180deg)}.bd-sidebar li{position:relative}.bd-sidebar label{position:absolute;top:0;right:0;height:30px;width:30px;cursor:pointer;display:flex;justify-content:center;align-items:center}.bd-sidebar label:hover{background:rgba(var(--pst-color-sidebar-expander-background-hover),1)}.bd-sidebar label i{display:inline-block;font-size:.75rem;text-align:center}.bd-sidebar label i:hover{color:rgba(var(--pst-color-sidebar-link-hover),1)}.bd-sidebar li.has-children>.reference{padding-right:30px}div.doctest>div.highlight span.gp,span.linenos,table.highlighttable td.linenos{user-select:none;-webkit-user-select:text;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.docutils.container{padding-left:unset;padding-right:unset} | 159,086 | 26,513.5 | 158,876 | css |
null | CARL-main/docs/themes/smac/static/css/theme.css | /* Provided by the Sphinx base theme template at build time */
@import "../basic.css";
:root {
/*****************************************************************************
* Theme config
**/
--pst-header-height: 60px;
/*****************************************************************************
* Font size
**/
--pst-font-size-base: 15px; /* base font size - applied at body / html level */
/* heading font sizes */
--pst-font-size-h1: 36px;
--pst-font-size-h2: 32px;
--pst-font-size-h3: 26px;
--pst-font-size-h4: 21px;
--pst-font-size-h5: 18px;
--pst-font-size-h6: 16px;
/* smaller then heading font sizes*/
--pst-font-size-milli: 12px;
--pst-sidebar-font-size: .9em;
--pst-sidebar-caption-font-size: .9em;
/*****************************************************************************
* Font family
**/
/* These are adapted from https://systemfontstack.com/ */
--pst-font-family-base-system: -apple-system, BlinkMacSystemFont, Segoe UI, "Helvetica Neue",
Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
--pst-font-family-monospace-system: "SFMono-Regular", Menlo, Consolas, Monaco,
Liberation Mono, Lucida Console, monospace;
--pst-font-family-base: var(--pst-font-family-base-system);
--pst-font-family-heading: var(--pst-font-family-base);
--pst-font-family-monospace: var(--pst-font-family-monospace-system);
/*****************************************************************************
* Color
*
* Colors are defined in rgb string way, "red, green, blue"
**/
--pst-color-primary: 19, 6, 84;
--pst-color-success: 40, 167, 69;
--pst-color-info: 0, 123, 255; /*23, 162, 184;*/
--pst-color-warning: 255, 193, 7;
--pst-color-danger: 220, 53, 69;
--pst-color-text-base: 51, 51, 51;
--pst-color-h1: var(--pst-color-primary);
--pst-color-h2: var(--pst-color-primary);
--pst-color-h3: var(--pst-color-text-base);
--pst-color-h4: var(--pst-color-text-base);
--pst-color-h5: var(--pst-color-text-base);
--pst-color-h6: var(--pst-color-text-base);
--pst-color-paragraph: var(--pst-color-text-base);
--pst-color-link: 0, 91, 129;
--pst-color-link-hover: 227, 46, 0;
--pst-color-headerlink: 198, 15, 15;
--pst-color-headerlink-hover: 255, 255, 255;
--pst-color-preformatted-text: 34, 34, 34;
--pst-color-preformatted-background: 250, 250, 250;
--pst-color-inline-code: 232, 62, 140;
--pst-color-active-navigation: 19, 6, 84;
--pst-color-navbar-link: 77, 77, 77;
--pst-color-navbar-link-hover: var(--pst-color-active-navigation);
--pst-color-navbar-link-active: var(--pst-color-active-navigation);
--pst-color-sidebar-link: 77, 77, 77;
--pst-color-sidebar-link-hover: var(--pst-color-active-navigation);
--pst-color-sidebar-link-active: var(--pst-color-active-navigation);
--pst-color-sidebar-expander-background-hover: 244, 244, 244;
--pst-color-sidebar-caption: 77, 77, 77;
--pst-color-toc-link: 119, 117, 122;
--pst-color-toc-link-hover: var(--pst-color-active-navigation);
--pst-color-toc-link-active: var(--pst-color-active-navigation);
/*****************************************************************************
* Icon
**/
/* font awesome icons*/
--pst-icon-check-circle: '\f058';
--pst-icon-info-circle: '\f05a';
--pst-icon-exclamation-triangle: '\f071';
--pst-icon-exclamation-circle: '\f06a';
--pst-icon-times-circle: '\f057';
--pst-icon-lightbulb: '\f0eb';
/*****************************************************************************
* Admonitions
**/
--pst-color-admonition-default: var(--pst-color-info);
--pst-color-admonition-note: var(--pst-color-info);
--pst-color-admonition-attention: var(--pst-color-warning);
--pst-color-admonition-caution: var(--pst-color-warning);
--pst-color-admonition-warning: var(--pst-color-warning);
--pst-color-admonition-danger: var(--pst-color-danger);
--pst-color-admonition-error: var(--pst-color-danger);
--pst-color-admonition-hint: var(--pst-color-success);
--pst-color-admonition-tip: var(--pst-color-success);
--pst-color-admonition-important: var(--pst-color-success);
--pst-icon-admonition-default: var(--pst-icon-info-circle);
--pst-icon-admonition-note: var(--pst-icon-info-circle);
--pst-icon-admonition-attention: var(--pst-icon-exclamation-circle);
--pst-icon-admonition-caution: var(--pst-icon-exclamation-triangle);
--pst-icon-admonition-warning: var(--pst-icon-exclamation-triangle);
--pst-icon-admonition-danger: var(--pst-icon-exclamation-triangle);
--pst-icon-admonition-error: var(--pst-icon-times-circle);
--pst-icon-admonition-hint: var(--pst-icon-lightbulb);
--pst-icon-admonition-tip: var(--pst-icon-lightbulb);
--pst-icon-admonition-important: var(--pst-icon-exclamation-circle);
}
| 4,802 | 38.694215 | 95 | css |
null | CARL-main/docs/themes/smac/static/vendor/fontawesome/5.13.0/css/all.min.css | /*!
* Font Awesome Free 5.13.0 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
.fa,.fab,.fad,.fal,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:inline-block;font-style:normal;font-variant:normal;text-rendering:auto;line-height:1}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-.0667em}.fa-xs{font-size:.75em}.fa-sm{font-size:.875em}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:2.5em;padding-left:0}.fa-ul>li{position:relative}.fa-li{left:-2em;position:absolute;text-align:center;width:2em;line-height:inherit}.fa-border{border:.08em solid #eee;border-radius:.1em;padding:.2em .25em .15em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left,.fab.fa-pull-left,.fal.fa-pull-left,.far.fa-pull-left,.fas.fa-pull-left{margin-right:.3em}.fa.fa-pull-right,.fab.fa-pull-right,.fal.fa-pull-right,.far.fa-pull-right,.fas.fa-pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical,.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"}.fa-flip-both,.fa-flip-horizontal.fa-flip-vertical{-webkit-transform:scale(-1);transform:scale(-1)}:root .fa-flip-both,:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{-webkit-filter:none;filter:none}.fa-stack{display:inline-block;height:2em;line-height:2em;position:relative;vertical-align:middle;width:2.5em}.fa-stack-1x,.fa-stack-2x{left:0;position:absolute;text-align:center;width:100%}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-500px:before{content:"\f26e"}.fa-accessible-icon:before{content:"\f368"}.fa-accusoft:before{content:"\f369"}.fa-acquisitions-incorporated:before{content:"\f6af"}.fa-ad:before{content:"\f641"}.fa-address-book:before{content:"\f2b9"}.fa-address-card:before{content:"\f2bb"}.fa-adjust:before{content:"\f042"}.fa-adn:before{content:"\f170"}.fa-adobe:before{content:"\f778"}.fa-adversal:before{content:"\f36a"}.fa-affiliatetheme:before{content:"\f36b"}.fa-air-freshener:before{content:"\f5d0"}.fa-airbnb:before{content:"\f834"}.fa-algolia:before{content:"\f36c"}.fa-align-center:before{content:"\f037"}.fa-align-justify:before{content:"\f039"}.fa-align-left:before{content:"\f036"}.fa-align-right:before{content:"\f038"}.fa-alipay:before{content:"\f642"}.fa-allergies:before{content:"\f461"}.fa-amazon:before{content:"\f270"}.fa-amazon-pay:before{content:"\f42c"}.fa-ambulance:before{content:"\f0f9"}.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-amilia:before{content:"\f36d"}.fa-anchor:before{content:"\f13d"}.fa-android:before{content:"\f17b"}.fa-angellist:before{content:"\f209"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-down:before{content:"\f107"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angry:before{content:"\f556"}.fa-angrycreative:before{content:"\f36e"}.fa-angular:before{content:"\f420"}.fa-ankh:before{content:"\f644"}.fa-app-store:before{content:"\f36f"}.fa-app-store-ios:before{content:"\f370"}.fa-apper:before{content:"\f371"}.fa-apple:before{content:"\f179"}.fa-apple-alt:before{content:"\f5d1"}.fa-apple-pay:before{content:"\f415"}.fa-archive:before{content:"\f187"}.fa-archway:before{content:"\f557"}.fa-arrow-alt-circle-down:before{content:"\f358"}.fa-arrow-alt-circle-left:before{content:"\f359"}.fa-arrow-alt-circle-right:before{content:"\f35a"}.fa-arrow-alt-circle-up:before{content:"\f35b"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-down:before{content:"\f063"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrows-alt:before{content:"\f0b2"}.fa-arrows-alt-h:before{content:"\f337"}.fa-arrows-alt-v:before{content:"\f338"}.fa-artstation:before{content:"\f77a"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asterisk:before{content:"\f069"}.fa-asymmetrik:before{content:"\f372"}.fa-at:before{content:"\f1fa"}.fa-atlas:before{content:"\f558"}.fa-atlassian:before{content:"\f77b"}.fa-atom:before{content:"\f5d2"}.fa-audible:before{content:"\f373"}.fa-audio-description:before{content:"\f29e"}.fa-autoprefixer:before{content:"\f41c"}.fa-avianex:before{content:"\f374"}.fa-aviato:before{content:"\f421"}.fa-award:before{content:"\f559"}.fa-aws:before{content:"\f375"}.fa-baby:before{content:"\f77c"}.fa-baby-carriage:before{content:"\f77d"}.fa-backspace:before{content:"\f55a"}.fa-backward:before{content:"\f04a"}.fa-bacon:before{content:"\f7e5"}.fa-bahai:before{content:"\f666"}.fa-balance-scale:before{content:"\f24e"}.fa-balance-scale-left:before{content:"\f515"}.fa-balance-scale-right:before{content:"\f516"}.fa-ban:before{content:"\f05e"}.fa-band-aid:before{content:"\f462"}.fa-bandcamp:before{content:"\f2d5"}.fa-barcode:before{content:"\f02a"}.fa-bars:before{content:"\f0c9"}.fa-baseball-ball:before{content:"\f433"}.fa-basketball-ball:before{content:"\f434"}.fa-bath:before{content:"\f2cd"}.fa-battery-empty:before{content:"\f244"}.fa-battery-full:before{content:"\f240"}.fa-battery-half:before{content:"\f242"}.fa-battery-quarter:before{content:"\f243"}.fa-battery-three-quarters:before{content:"\f241"}.fa-battle-net:before{content:"\f835"}.fa-bed:before{content:"\f236"}.fa-beer:before{content:"\f0fc"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-bell:before{content:"\f0f3"}.fa-bell-slash:before{content:"\f1f6"}.fa-bezier-curve:before{content:"\f55b"}.fa-bible:before{content:"\f647"}.fa-bicycle:before{content:"\f206"}.fa-biking:before{content:"\f84a"}.fa-bimobject:before{content:"\f378"}.fa-binoculars:before{content:"\f1e5"}.fa-biohazard:before{content:"\f780"}.fa-birthday-cake:before{content:"\f1fd"}.fa-bitbucket:before{content:"\f171"}.fa-bitcoin:before{content:"\f379"}.fa-bity:before{content:"\f37a"}.fa-black-tie:before{content:"\f27e"}.fa-blackberry:before{content:"\f37b"}.fa-blender:before{content:"\f517"}.fa-blender-phone:before{content:"\f6b6"}.fa-blind:before{content:"\f29d"}.fa-blog:before{content:"\f781"}.fa-blogger:before{content:"\f37c"}.fa-blogger-b:before{content:"\f37d"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-bold:before{content:"\f032"}.fa-bolt:before{content:"\f0e7"}.fa-bomb:before{content:"\f1e2"}.fa-bone:before{content:"\f5d7"}.fa-bong:before{content:"\f55c"}.fa-book:before{content:"\f02d"}.fa-book-dead:before{content:"\f6b7"}.fa-book-medical:before{content:"\f7e6"}.fa-book-open:before{content:"\f518"}.fa-book-reader:before{content:"\f5da"}.fa-bookmark:before{content:"\f02e"}.fa-bootstrap:before{content:"\f836"}.fa-border-all:before{content:"\f84c"}.fa-border-none:before{content:"\f850"}.fa-border-style:before{content:"\f853"}.fa-bowling-ball:before{content:"\f436"}.fa-box:before{content:"\f466"}.fa-box-open:before{content:"\f49e"}.fa-box-tissue:before{content:"\f95b"}.fa-boxes:before{content:"\f468"}.fa-braille:before{content:"\f2a1"}.fa-brain:before{content:"\f5dc"}.fa-bread-slice:before{content:"\f7ec"}.fa-briefcase:before{content:"\f0b1"}.fa-briefcase-medical:before{content:"\f469"}.fa-broadcast-tower:before{content:"\f519"}.fa-broom:before{content:"\f51a"}.fa-brush:before{content:"\f55d"}.fa-btc:before{content:"\f15a"}.fa-buffer:before{content:"\f837"}.fa-bug:before{content:"\f188"}.fa-building:before{content:"\f1ad"}.fa-bullhorn:before{content:"\f0a1"}.fa-bullseye:before{content:"\f140"}.fa-burn:before{content:"\f46a"}.fa-buromobelexperte:before{content:"\f37f"}.fa-bus:before{content:"\f207"}.fa-bus-alt:before{content:"\f55e"}.fa-business-time:before{content:"\f64a"}.fa-buy-n-large:before{content:"\f8a6"}.fa-buysellads:before{content:"\f20d"}.fa-calculator:before{content:"\f1ec"}.fa-calendar:before{content:"\f133"}.fa-calendar-alt:before{content:"\f073"}.fa-calendar-check:before{content:"\f274"}.fa-calendar-day:before{content:"\f783"}.fa-calendar-minus:before{content:"\f272"}.fa-calendar-plus:before{content:"\f271"}.fa-calendar-times:before{content:"\f273"}.fa-calendar-week:before{content:"\f784"}.fa-camera:before{content:"\f030"}.fa-camera-retro:before{content:"\f083"}.fa-campground:before{content:"\f6bb"}.fa-canadian-maple-leaf:before{content:"\f785"}.fa-candy-cane:before{content:"\f786"}.fa-cannabis:before{content:"\f55f"}.fa-capsules:before{content:"\f46b"}.fa-car:before{content:"\f1b9"}.fa-car-alt:before{content:"\f5de"}.fa-car-battery:before{content:"\f5df"}.fa-car-crash:before{content:"\f5e1"}.fa-car-side:before{content:"\f5e4"}.fa-caravan:before{content:"\f8ff"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-caret-square-down:before{content:"\f150"}.fa-caret-square-left:before{content:"\f191"}.fa-caret-square-right:before{content:"\f152"}.fa-caret-square-up:before{content:"\f151"}.fa-caret-up:before{content:"\f0d8"}.fa-carrot:before{content:"\f787"}.fa-cart-arrow-down:before{content:"\f218"}.fa-cart-plus:before{content:"\f217"}.fa-cash-register:before{content:"\f788"}.fa-cat:before{content:"\f6be"}.fa-cc-amazon-pay:before{content:"\f42d"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-apple-pay:before{content:"\f416"}.fa-cc-diners-club:before{content:"\f24c"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-cc-visa:before{content:"\f1f0"}.fa-centercode:before{content:"\f380"}.fa-centos:before{content:"\f789"}.fa-certificate:before{content:"\f0a3"}.fa-chair:before{content:"\f6c0"}.fa-chalkboard:before{content:"\f51b"}.fa-chalkboard-teacher:before{content:"\f51c"}.fa-charging-station:before{content:"\f5e7"}.fa-chart-area:before{content:"\f1fe"}.fa-chart-bar:before{content:"\f080"}.fa-chart-line:before{content:"\f201"}.fa-chart-pie:before{content:"\f200"}.fa-check:before{content:"\f00c"}.fa-check-circle:before{content:"\f058"}.fa-check-double:before{content:"\f560"}.fa-check-square:before{content:"\f14a"}.fa-cheese:before{content:"\f7ef"}.fa-chess:before{content:"\f439"}.fa-chess-bishop:before{content:"\f43a"}.fa-chess-board:before{content:"\f43c"}.fa-chess-king:before{content:"\f43f"}.fa-chess-knight:before{content:"\f441"}.fa-chess-pawn:before{content:"\f443"}.fa-chess-queen:before{content:"\f445"}.fa-chess-rook:before{content:"\f447"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-down:before{content:"\f078"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-chevron-up:before{content:"\f077"}.fa-child:before{content:"\f1ae"}.fa-chrome:before{content:"\f268"}.fa-chromecast:before{content:"\f838"}.fa-church:before{content:"\f51d"}.fa-circle:before{content:"\f111"}.fa-circle-notch:before{content:"\f1ce"}.fa-city:before{content:"\f64f"}.fa-clinic-medical:before{content:"\f7f2"}.fa-clipboard:before{content:"\f328"}.fa-clipboard-check:before{content:"\f46c"}.fa-clipboard-list:before{content:"\f46d"}.fa-clock:before{content:"\f017"}.fa-clone:before{content:"\f24d"}.fa-closed-captioning:before{content:"\f20a"}.fa-cloud:before{content:"\f0c2"}.fa-cloud-download-alt:before{content:"\f381"}.fa-cloud-meatball:before{content:"\f73b"}.fa-cloud-moon:before{content:"\f6c3"}.fa-cloud-moon-rain:before{content:"\f73c"}.fa-cloud-rain:before{content:"\f73d"}.fa-cloud-showers-heavy:before{content:"\f740"}.fa-cloud-sun:before{content:"\f6c4"}.fa-cloud-sun-rain:before{content:"\f743"}.fa-cloud-upload-alt:before{content:"\f382"}.fa-cloudscale:before{content:"\f383"}.fa-cloudsmith:before{content:"\f384"}.fa-cloudversify:before{content:"\f385"}.fa-cocktail:before{content:"\f561"}.fa-code:before{content:"\f121"}.fa-code-branch:before{content:"\f126"}.fa-codepen:before{content:"\f1cb"}.fa-codiepie:before{content:"\f284"}.fa-coffee:before{content:"\f0f4"}.fa-cog:before{content:"\f013"}.fa-cogs:before{content:"\f085"}.fa-coins:before{content:"\f51e"}.fa-columns:before{content:"\f0db"}.fa-comment:before{content:"\f075"}.fa-comment-alt:before{content:"\f27a"}.fa-comment-dollar:before{content:"\f651"}.fa-comment-dots:before{content:"\f4ad"}.fa-comment-medical:before{content:"\f7f5"}.fa-comment-slash:before{content:"\f4b3"}.fa-comments:before{content:"\f086"}.fa-comments-dollar:before{content:"\f653"}.fa-compact-disc:before{content:"\f51f"}.fa-compass:before{content:"\f14e"}.fa-compress:before{content:"\f066"}.fa-compress-alt:before{content:"\f422"}.fa-compress-arrows-alt:before{content:"\f78c"}.fa-concierge-bell:before{content:"\f562"}.fa-confluence:before{content:"\f78d"}.fa-connectdevelop:before{content:"\f20e"}.fa-contao:before{content:"\f26d"}.fa-cookie:before{content:"\f563"}.fa-cookie-bite:before{content:"\f564"}.fa-copy:before{content:"\f0c5"}.fa-copyright:before{content:"\f1f9"}.fa-cotton-bureau:before{content:"\f89e"}.fa-couch:before{content:"\f4b8"}.fa-cpanel:before{content:"\f388"}.fa-creative-commons:before{content:"\f25e"}.fa-creative-commons-by:before{content:"\f4e7"}.fa-creative-commons-nc:before{content:"\f4e8"}.fa-creative-commons-nc-eu:before{content:"\f4e9"}.fa-creative-commons-nc-jp:before{content:"\f4ea"}.fa-creative-commons-nd:before{content:"\f4eb"}.fa-creative-commons-pd:before{content:"\f4ec"}.fa-creative-commons-pd-alt:before{content:"\f4ed"}.fa-creative-commons-remix:before{content:"\f4ee"}.fa-creative-commons-sa:before{content:"\f4ef"}.fa-creative-commons-sampling:before{content:"\f4f0"}.fa-creative-commons-sampling-plus:before{content:"\f4f1"}.fa-creative-commons-share:before{content:"\f4f2"}.fa-creative-commons-zero:before{content:"\f4f3"}.fa-credit-card:before{content:"\f09d"}.fa-critical-role:before{content:"\f6c9"}.fa-crop:before{content:"\f125"}.fa-crop-alt:before{content:"\f565"}.fa-cross:before{content:"\f654"}.fa-crosshairs:before{content:"\f05b"}.fa-crow:before{content:"\f520"}.fa-crown:before{content:"\f521"}.fa-crutch:before{content:"\f7f7"}.fa-css3:before{content:"\f13c"}.fa-css3-alt:before{content:"\f38b"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-cut:before{content:"\f0c4"}.fa-cuttlefish:before{content:"\f38c"}.fa-d-and-d:before{content:"\f38d"}.fa-d-and-d-beyond:before{content:"\f6ca"}.fa-dailymotion:before{content:"\f952"}.fa-dashcube:before{content:"\f210"}.fa-database:before{content:"\f1c0"}.fa-deaf:before{content:"\f2a4"}.fa-delicious:before{content:"\f1a5"}.fa-democrat:before{content:"\f747"}.fa-deploydog:before{content:"\f38e"}.fa-deskpro:before{content:"\f38f"}.fa-desktop:before{content:"\f108"}.fa-dev:before{content:"\f6cc"}.fa-deviantart:before{content:"\f1bd"}.fa-dharmachakra:before{content:"\f655"}.fa-dhl:before{content:"\f790"}.fa-diagnoses:before{content:"\f470"}.fa-diaspora:before{content:"\f791"}.fa-dice:before{content:"\f522"}.fa-dice-d20:before{content:"\f6cf"}.fa-dice-d6:before{content:"\f6d1"}.fa-dice-five:before{content:"\f523"}.fa-dice-four:before{content:"\f524"}.fa-dice-one:before{content:"\f525"}.fa-dice-six:before{content:"\f526"}.fa-dice-three:before{content:"\f527"}.fa-dice-two:before{content:"\f528"}.fa-digg:before{content:"\f1a6"}.fa-digital-ocean:before{content:"\f391"}.fa-digital-tachograph:before{content:"\f566"}.fa-directions:before{content:"\f5eb"}.fa-discord:before{content:"\f392"}.fa-discourse:before{content:"\f393"}.fa-disease:before{content:"\f7fa"}.fa-divide:before{content:"\f529"}.fa-dizzy:before{content:"\f567"}.fa-dna:before{content:"\f471"}.fa-dochub:before{content:"\f394"}.fa-docker:before{content:"\f395"}.fa-dog:before{content:"\f6d3"}.fa-dollar-sign:before{content:"\f155"}.fa-dolly:before{content:"\f472"}.fa-dolly-flatbed:before{content:"\f474"}.fa-donate:before{content:"\f4b9"}.fa-door-closed:before{content:"\f52a"}.fa-door-open:before{content:"\f52b"}.fa-dot-circle:before{content:"\f192"}.fa-dove:before{content:"\f4ba"}.fa-download:before{content:"\f019"}.fa-draft2digital:before{content:"\f396"}.fa-drafting-compass:before{content:"\f568"}.fa-dragon:before{content:"\f6d5"}.fa-draw-polygon:before{content:"\f5ee"}.fa-dribbble:before{content:"\f17d"}.fa-dribbble-square:before{content:"\f397"}.fa-dropbox:before{content:"\f16b"}.fa-drum:before{content:"\f569"}.fa-drum-steelpan:before{content:"\f56a"}.fa-drumstick-bite:before{content:"\f6d7"}.fa-drupal:before{content:"\f1a9"}.fa-dumbbell:before{content:"\f44b"}.fa-dumpster:before{content:"\f793"}.fa-dumpster-fire:before{content:"\f794"}.fa-dungeon:before{content:"\f6d9"}.fa-dyalog:before{content:"\f399"}.fa-earlybirds:before{content:"\f39a"}.fa-ebay:before{content:"\f4f4"}.fa-edge:before{content:"\f282"}.fa-edit:before{content:"\f044"}.fa-egg:before{content:"\f7fb"}.fa-eject:before{content:"\f052"}.fa-elementor:before{content:"\f430"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-ello:before{content:"\f5f1"}.fa-ember:before{content:"\f423"}.fa-empire:before{content:"\f1d1"}.fa-envelope:before{content:"\f0e0"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-text:before{content:"\f658"}.fa-envelope-square:before{content:"\f199"}.fa-envira:before{content:"\f299"}.fa-equals:before{content:"\f52c"}.fa-eraser:before{content:"\f12d"}.fa-erlang:before{content:"\f39d"}.fa-ethereum:before{content:"\f42e"}.fa-ethernet:before{content:"\f796"}.fa-etsy:before{content:"\f2d7"}.fa-euro-sign:before{content:"\f153"}.fa-evernote:before{content:"\f839"}.fa-exchange-alt:before{content:"\f362"}.fa-exclamation:before{content:"\f12a"}.fa-exclamation-circle:before{content:"\f06a"}.fa-exclamation-triangle:before{content:"\f071"}.fa-expand:before{content:"\f065"}.fa-expand-alt:before{content:"\f424"}.fa-expand-arrows-alt:before{content:"\f31e"}.fa-expeditedssl:before{content:"\f23e"}.fa-external-link-alt:before{content:"\f35d"}.fa-external-link-square-alt:before{content:"\f360"}.fa-eye:before{content:"\f06e"}.fa-eye-dropper:before{content:"\f1fb"}.fa-eye-slash:before{content:"\f070"}.fa-facebook:before{content:"\f09a"}.fa-facebook-f:before{content:"\f39e"}.fa-facebook-messenger:before{content:"\f39f"}.fa-facebook-square:before{content:"\f082"}.fa-fan:before{content:"\f863"}.fa-fantasy-flight-games:before{content:"\f6dc"}.fa-fast-backward:before{content:"\f049"}.fa-fast-forward:before{content:"\f050"}.fa-faucet:before{content:"\f905"}.fa-fax:before{content:"\f1ac"}.fa-feather:before{content:"\f52d"}.fa-feather-alt:before{content:"\f56b"}.fa-fedex:before{content:"\f797"}.fa-fedora:before{content:"\f798"}.fa-female:before{content:"\f182"}.fa-fighter-jet:before{content:"\f0fb"}.fa-figma:before{content:"\f799"}.fa-file:before{content:"\f15b"}.fa-file-alt:before{content:"\f15c"}.fa-file-archive:before{content:"\f1c6"}.fa-file-audio:before{content:"\f1c7"}.fa-file-code:before{content:"\f1c9"}.fa-file-contract:before{content:"\f56c"}.fa-file-csv:before{content:"\f6dd"}.fa-file-download:before{content:"\f56d"}.fa-file-excel:before{content:"\f1c3"}.fa-file-export:before{content:"\f56e"}.fa-file-image:before{content:"\f1c5"}.fa-file-import:before{content:"\f56f"}.fa-file-invoice:before{content:"\f570"}.fa-file-invoice-dollar:before{content:"\f571"}.fa-file-medical:before{content:"\f477"}.fa-file-medical-alt:before{content:"\f478"}.fa-file-pdf:before{content:"\f1c1"}.fa-file-powerpoint:before{content:"\f1c4"}.fa-file-prescription:before{content:"\f572"}.fa-file-signature:before{content:"\f573"}.fa-file-upload:before{content:"\f574"}.fa-file-video:before{content:"\f1c8"}.fa-file-word:before{content:"\f1c2"}.fa-fill:before{content:"\f575"}.fa-fill-drip:before{content:"\f576"}.fa-film:before{content:"\f008"}.fa-filter:before{content:"\f0b0"}.fa-fingerprint:before{content:"\f577"}.fa-fire:before{content:"\f06d"}.fa-fire-alt:before{content:"\f7e4"}.fa-fire-extinguisher:before{content:"\f134"}.fa-firefox:before{content:"\f269"}.fa-firefox-browser:before{content:"\f907"}.fa-first-aid:before{content:"\f479"}.fa-first-order:before{content:"\f2b0"}.fa-first-order-alt:before{content:"\f50a"}.fa-firstdraft:before{content:"\f3a1"}.fa-fish:before{content:"\f578"}.fa-fist-raised:before{content:"\f6de"}.fa-flag:before{content:"\f024"}.fa-flag-checkered:before{content:"\f11e"}.fa-flag-usa:before{content:"\f74d"}.fa-flask:before{content:"\f0c3"}.fa-flickr:before{content:"\f16e"}.fa-flipboard:before{content:"\f44d"}.fa-flushed:before{content:"\f579"}.fa-fly:before{content:"\f417"}.fa-folder:before{content:"\f07b"}.fa-folder-minus:before{content:"\f65d"}.fa-folder-open:before{content:"\f07c"}.fa-folder-plus:before{content:"\f65e"}.fa-font:before{content:"\f031"}.fa-font-awesome:before{content:"\f2b4"}.fa-font-awesome-alt:before{content:"\f35c"}.fa-font-awesome-flag:before{content:"\f425"}.fa-font-awesome-logo-full:before{content:"\f4e6"}.fa-fonticons:before{content:"\f280"}.fa-fonticons-fi:before{content:"\f3a2"}.fa-football-ball:before{content:"\f44e"}.fa-fort-awesome:before{content:"\f286"}.fa-fort-awesome-alt:before{content:"\f3a3"}.fa-forumbee:before{content:"\f211"}.fa-forward:before{content:"\f04e"}.fa-foursquare:before{content:"\f180"}.fa-free-code-camp:before{content:"\f2c5"}.fa-freebsd:before{content:"\f3a4"}.fa-frog:before{content:"\f52e"}.fa-frown:before{content:"\f119"}.fa-frown-open:before{content:"\f57a"}.fa-fulcrum:before{content:"\f50b"}.fa-funnel-dollar:before{content:"\f662"}.fa-futbol:before{content:"\f1e3"}.fa-galactic-republic:before{content:"\f50c"}.fa-galactic-senate:before{content:"\f50d"}.fa-gamepad:before{content:"\f11b"}.fa-gas-pump:before{content:"\f52f"}.fa-gavel:before{content:"\f0e3"}.fa-gem:before{content:"\f3a5"}.fa-genderless:before{content:"\f22d"}.fa-get-pocket:before{content:"\f265"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-ghost:before{content:"\f6e2"}.fa-gift:before{content:"\f06b"}.fa-gifts:before{content:"\f79c"}.fa-git:before{content:"\f1d3"}.fa-git-alt:before{content:"\f841"}.fa-git-square:before{content:"\f1d2"}.fa-github:before{content:"\f09b"}.fa-github-alt:before{content:"\f113"}.fa-github-square:before{content:"\f092"}.fa-gitkraken:before{content:"\f3a6"}.fa-gitlab:before{content:"\f296"}.fa-gitter:before{content:"\f426"}.fa-glass-cheers:before{content:"\f79f"}.fa-glass-martini:before{content:"\f000"}.fa-glass-martini-alt:before{content:"\f57b"}.fa-glass-whiskey:before{content:"\f7a0"}.fa-glasses:before{content:"\f530"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-globe:before{content:"\f0ac"}.fa-globe-africa:before{content:"\f57c"}.fa-globe-americas:before{content:"\f57d"}.fa-globe-asia:before{content:"\f57e"}.fa-globe-europe:before{content:"\f7a2"}.fa-gofore:before{content:"\f3a7"}.fa-golf-ball:before{content:"\f450"}.fa-goodreads:before{content:"\f3a8"}.fa-goodreads-g:before{content:"\f3a9"}.fa-google:before{content:"\f1a0"}.fa-google-drive:before{content:"\f3aa"}.fa-google-play:before{content:"\f3ab"}.fa-google-plus:before{content:"\f2b3"}.fa-google-plus-g:before{content:"\f0d5"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-wallet:before{content:"\f1ee"}.fa-gopuram:before{content:"\f664"}.fa-graduation-cap:before{content:"\f19d"}.fa-gratipay:before{content:"\f184"}.fa-grav:before{content:"\f2d6"}.fa-greater-than:before{content:"\f531"}.fa-greater-than-equal:before{content:"\f532"}.fa-grimace:before{content:"\f57f"}.fa-grin:before{content:"\f580"}.fa-grin-alt:before{content:"\f581"}.fa-grin-beam:before{content:"\f582"}.fa-grin-beam-sweat:before{content:"\f583"}.fa-grin-hearts:before{content:"\f584"}.fa-grin-squint:before{content:"\f585"}.fa-grin-squint-tears:before{content:"\f586"}.fa-grin-stars:before{content:"\f587"}.fa-grin-tears:before{content:"\f588"}.fa-grin-tongue:before{content:"\f589"}.fa-grin-tongue-squint:before{content:"\f58a"}.fa-grin-tongue-wink:before{content:"\f58b"}.fa-grin-wink:before{content:"\f58c"}.fa-grip-horizontal:before{content:"\f58d"}.fa-grip-lines:before{content:"\f7a4"}.fa-grip-lines-vertical:before{content:"\f7a5"}.fa-grip-vertical:before{content:"\f58e"}.fa-gripfire:before{content:"\f3ac"}.fa-grunt:before{content:"\f3ad"}.fa-guitar:before{content:"\f7a6"}.fa-gulp:before{content:"\f3ae"}.fa-h-square:before{content:"\f0fd"}.fa-hacker-news:before{content:"\f1d4"}.fa-hacker-news-square:before{content:"\f3af"}.fa-hackerrank:before{content:"\f5f7"}.fa-hamburger:before{content:"\f805"}.fa-hammer:before{content:"\f6e3"}.fa-hamsa:before{content:"\f665"}.fa-hand-holding:before{content:"\f4bd"}.fa-hand-holding-heart:before{content:"\f4be"}.fa-hand-holding-medical:before{content:"\f95c"}.fa-hand-holding-usd:before{content:"\f4c0"}.fa-hand-holding-water:before{content:"\f4c1"}.fa-hand-lizard:before{content:"\f258"}.fa-hand-middle-finger:before{content:"\f806"}.fa-hand-paper:before{content:"\f256"}.fa-hand-peace:before{content:"\f25b"}.fa-hand-point-down:before{content:"\f0a7"}.fa-hand-point-left:before{content:"\f0a5"}.fa-hand-point-right:before{content:"\f0a4"}.fa-hand-point-up:before{content:"\f0a6"}.fa-hand-pointer:before{content:"\f25a"}.fa-hand-rock:before{content:"\f255"}.fa-hand-scissors:before{content:"\f257"}.fa-hand-sparkles:before{content:"\f95d"}.fa-hand-spock:before{content:"\f259"}.fa-hands:before{content:"\f4c2"}.fa-hands-helping:before{content:"\f4c4"}.fa-hands-wash:before{content:"\f95e"}.fa-handshake:before{content:"\f2b5"}.fa-handshake-alt-slash:before{content:"\f95f"}.fa-handshake-slash:before{content:"\f960"}.fa-hanukiah:before{content:"\f6e6"}.fa-hard-hat:before{content:"\f807"}.fa-hashtag:before{content:"\f292"}.fa-hat-cowboy:before{content:"\f8c0"}.fa-hat-cowboy-side:before{content:"\f8c1"}.fa-hat-wizard:before{content:"\f6e8"}.fa-hdd:before{content:"\f0a0"}.fa-head-side-cough:before{content:"\f961"}.fa-head-side-cough-slash:before{content:"\f962"}.fa-head-side-mask:before{content:"\f963"}.fa-head-side-virus:before{content:"\f964"}.fa-heading:before{content:"\f1dc"}.fa-headphones:before{content:"\f025"}.fa-headphones-alt:before{content:"\f58f"}.fa-headset:before{content:"\f590"}.fa-heart:before{content:"\f004"}.fa-heart-broken:before{content:"\f7a9"}.fa-heartbeat:before{content:"\f21e"}.fa-helicopter:before{content:"\f533"}.fa-highlighter:before{content:"\f591"}.fa-hiking:before{content:"\f6ec"}.fa-hippo:before{content:"\f6ed"}.fa-hips:before{content:"\f452"}.fa-hire-a-helper:before{content:"\f3b0"}.fa-history:before{content:"\f1da"}.fa-hockey-puck:before{content:"\f453"}.fa-holly-berry:before{content:"\f7aa"}.fa-home:before{content:"\f015"}.fa-hooli:before{content:"\f427"}.fa-hornbill:before{content:"\f592"}.fa-horse:before{content:"\f6f0"}.fa-horse-head:before{content:"\f7ab"}.fa-hospital:before{content:"\f0f8"}.fa-hospital-alt:before{content:"\f47d"}.fa-hospital-symbol:before{content:"\f47e"}.fa-hospital-user:before{content:"\f80d"}.fa-hot-tub:before{content:"\f593"}.fa-hotdog:before{content:"\f80f"}.fa-hotel:before{content:"\f594"}.fa-hotjar:before{content:"\f3b1"}.fa-hourglass:before{content:"\f254"}.fa-hourglass-end:before{content:"\f253"}.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-start:before{content:"\f251"}.fa-house-damage:before{content:"\f6f1"}.fa-house-user:before{content:"\f965"}.fa-houzz:before{content:"\f27c"}.fa-hryvnia:before{content:"\f6f2"}.fa-html5:before{content:"\f13b"}.fa-hubspot:before{content:"\f3b2"}.fa-i-cursor:before{content:"\f246"}.fa-ice-cream:before{content:"\f810"}.fa-icicles:before{content:"\f7ad"}.fa-icons:before{content:"\f86d"}.fa-id-badge:before{content:"\f2c1"}.fa-id-card:before{content:"\f2c2"}.fa-id-card-alt:before{content:"\f47f"}.fa-ideal:before{content:"\f913"}.fa-igloo:before{content:"\f7ae"}.fa-image:before{content:"\f03e"}.fa-images:before{content:"\f302"}.fa-imdb:before{content:"\f2d8"}.fa-inbox:before{content:"\f01c"}.fa-indent:before{content:"\f03c"}.fa-industry:before{content:"\f275"}.fa-infinity:before{content:"\f534"}.fa-info:before{content:"\f129"}.fa-info-circle:before{content:"\f05a"}.fa-instagram:before{content:"\f16d"}.fa-instagram-square:before{content:"\f955"}.fa-intercom:before{content:"\f7af"}.fa-internet-explorer:before{content:"\f26b"}.fa-invision:before{content:"\f7b0"}.fa-ioxhost:before{content:"\f208"}.fa-italic:before{content:"\f033"}.fa-itch-io:before{content:"\f83a"}.fa-itunes:before{content:"\f3b4"}.fa-itunes-note:before{content:"\f3b5"}.fa-java:before{content:"\f4e4"}.fa-jedi:before{content:"\f669"}.fa-jedi-order:before{content:"\f50e"}.fa-jenkins:before{content:"\f3b6"}.fa-jira:before{content:"\f7b1"}.fa-joget:before{content:"\f3b7"}.fa-joint:before{content:"\f595"}.fa-joomla:before{content:"\f1aa"}.fa-journal-whills:before{content:"\f66a"}.fa-js:before{content:"\f3b8"}.fa-js-square:before{content:"\f3b9"}.fa-jsfiddle:before{content:"\f1cc"}.fa-kaaba:before{content:"\f66b"}.fa-kaggle:before{content:"\f5fa"}.fa-key:before{content:"\f084"}.fa-keybase:before{content:"\f4f5"}.fa-keyboard:before{content:"\f11c"}.fa-keycdn:before{content:"\f3ba"}.fa-khanda:before{content:"\f66d"}.fa-kickstarter:before{content:"\f3bb"}.fa-kickstarter-k:before{content:"\f3bc"}.fa-kiss:before{content:"\f596"}.fa-kiss-beam:before{content:"\f597"}.fa-kiss-wink-heart:before{content:"\f598"}.fa-kiwi-bird:before{content:"\f535"}.fa-korvue:before{content:"\f42f"}.fa-landmark:before{content:"\f66f"}.fa-language:before{content:"\f1ab"}.fa-laptop:before{content:"\f109"}.fa-laptop-code:before{content:"\f5fc"}.fa-laptop-house:before{content:"\f966"}.fa-laptop-medical:before{content:"\f812"}.fa-laravel:before{content:"\f3bd"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-laugh:before{content:"\f599"}.fa-laugh-beam:before{content:"\f59a"}.fa-laugh-squint:before{content:"\f59b"}.fa-laugh-wink:before{content:"\f59c"}.fa-layer-group:before{content:"\f5fd"}.fa-leaf:before{content:"\f06c"}.fa-leanpub:before{content:"\f212"}.fa-lemon:before{content:"\f094"}.fa-less:before{content:"\f41d"}.fa-less-than:before{content:"\f536"}.fa-less-than-equal:before{content:"\f537"}.fa-level-down-alt:before{content:"\f3be"}.fa-level-up-alt:before{content:"\f3bf"}.fa-life-ring:before{content:"\f1cd"}.fa-lightbulb:before{content:"\f0eb"}.fa-line:before{content:"\f3c0"}.fa-link:before{content:"\f0c1"}.fa-linkedin:before{content:"\f08c"}.fa-linkedin-in:before{content:"\f0e1"}.fa-linode:before{content:"\f2b8"}.fa-linux:before{content:"\f17c"}.fa-lira-sign:before{content:"\f195"}.fa-list:before{content:"\f03a"}.fa-list-alt:before{content:"\f022"}.fa-list-ol:before{content:"\f0cb"}.fa-list-ul:before{content:"\f0ca"}.fa-location-arrow:before{content:"\f124"}.fa-lock:before{content:"\f023"}.fa-lock-open:before{content:"\f3c1"}.fa-long-arrow-alt-down:before{content:"\f309"}.fa-long-arrow-alt-left:before{content:"\f30a"}.fa-long-arrow-alt-right:before{content:"\f30b"}.fa-long-arrow-alt-up:before{content:"\f30c"}.fa-low-vision:before{content:"\f2a8"}.fa-luggage-cart:before{content:"\f59d"}.fa-lungs:before{content:"\f604"}.fa-lungs-virus:before{content:"\f967"}.fa-lyft:before{content:"\f3c3"}.fa-magento:before{content:"\f3c4"}.fa-magic:before{content:"\f0d0"}.fa-magnet:before{content:"\f076"}.fa-mail-bulk:before{content:"\f674"}.fa-mailchimp:before{content:"\f59e"}.fa-male:before{content:"\f183"}.fa-mandalorian:before{content:"\f50f"}.fa-map:before{content:"\f279"}.fa-map-marked:before{content:"\f59f"}.fa-map-marked-alt:before{content:"\f5a0"}.fa-map-marker:before{content:"\f041"}.fa-map-marker-alt:before{content:"\f3c5"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-markdown:before{content:"\f60f"}.fa-marker:before{content:"\f5a1"}.fa-mars:before{content:"\f222"}.fa-mars-double:before{content:"\f227"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mask:before{content:"\f6fa"}.fa-mastodon:before{content:"\f4f6"}.fa-maxcdn:before{content:"\f136"}.fa-mdb:before{content:"\f8ca"}.fa-medal:before{content:"\f5a2"}.fa-medapps:before{content:"\f3c6"}.fa-medium:before{content:"\f23a"}.fa-medium-m:before{content:"\f3c7"}.fa-medkit:before{content:"\f0fa"}.fa-medrt:before{content:"\f3c8"}.fa-meetup:before{content:"\f2e0"}.fa-megaport:before{content:"\f5a3"}.fa-meh:before{content:"\f11a"}.fa-meh-blank:before{content:"\f5a4"}.fa-meh-rolling-eyes:before{content:"\f5a5"}.fa-memory:before{content:"\f538"}.fa-mendeley:before{content:"\f7b3"}.fa-menorah:before{content:"\f676"}.fa-mercury:before{content:"\f223"}.fa-meteor:before{content:"\f753"}.fa-microblog:before{content:"\f91a"}.fa-microchip:before{content:"\f2db"}.fa-microphone:before{content:"\f130"}.fa-microphone-alt:before{content:"\f3c9"}.fa-microphone-alt-slash:before{content:"\f539"}.fa-microphone-slash:before{content:"\f131"}.fa-microscope:before{content:"\f610"}.fa-microsoft:before{content:"\f3ca"}.fa-minus:before{content:"\f068"}.fa-minus-circle:before{content:"\f056"}.fa-minus-square:before{content:"\f146"}.fa-mitten:before{content:"\f7b5"}.fa-mix:before{content:"\f3cb"}.fa-mixcloud:before{content:"\f289"}.fa-mixer:before{content:"\f956"}.fa-mizuni:before{content:"\f3cc"}.fa-mobile:before{content:"\f10b"}.fa-mobile-alt:before{content:"\f3cd"}.fa-modx:before{content:"\f285"}.fa-monero:before{content:"\f3d0"}.fa-money-bill:before{content:"\f0d6"}.fa-money-bill-alt:before{content:"\f3d1"}.fa-money-bill-wave:before{content:"\f53a"}.fa-money-bill-wave-alt:before{content:"\f53b"}.fa-money-check:before{content:"\f53c"}.fa-money-check-alt:before{content:"\f53d"}.fa-monument:before{content:"\f5a6"}.fa-moon:before{content:"\f186"}.fa-mortar-pestle:before{content:"\f5a7"}.fa-mosque:before{content:"\f678"}.fa-motorcycle:before{content:"\f21c"}.fa-mountain:before{content:"\f6fc"}.fa-mouse:before{content:"\f8cc"}.fa-mouse-pointer:before{content:"\f245"}.fa-mug-hot:before{content:"\f7b6"}.fa-music:before{content:"\f001"}.fa-napster:before{content:"\f3d2"}.fa-neos:before{content:"\f612"}.fa-network-wired:before{content:"\f6ff"}.fa-neuter:before{content:"\f22c"}.fa-newspaper:before{content:"\f1ea"}.fa-nimblr:before{content:"\f5a8"}.fa-node:before{content:"\f419"}.fa-node-js:before{content:"\f3d3"}.fa-not-equal:before{content:"\f53e"}.fa-notes-medical:before{content:"\f481"}.fa-npm:before{content:"\f3d4"}.fa-ns8:before{content:"\f3d5"}.fa-nutritionix:before{content:"\f3d6"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-oil-can:before{content:"\f613"}.fa-old-republic:before{content:"\f510"}.fa-om:before{content:"\f679"}.fa-opencart:before{content:"\f23d"}.fa-openid:before{content:"\f19b"}.fa-opera:before{content:"\f26a"}.fa-optin-monster:before{content:"\f23c"}.fa-orcid:before{content:"\f8d2"}.fa-osi:before{content:"\f41a"}.fa-otter:before{content:"\f700"}.fa-outdent:before{content:"\f03b"}.fa-page4:before{content:"\f3d7"}.fa-pagelines:before{content:"\f18c"}.fa-pager:before{content:"\f815"}.fa-paint-brush:before{content:"\f1fc"}.fa-paint-roller:before{content:"\f5aa"}.fa-palette:before{content:"\f53f"}.fa-palfed:before{content:"\f3d8"}.fa-pallet:before{content:"\f482"}.fa-paper-plane:before{content:"\f1d8"}.fa-paperclip:before{content:"\f0c6"}.fa-parachute-box:before{content:"\f4cd"}.fa-paragraph:before{content:"\f1dd"}.fa-parking:before{content:"\f540"}.fa-passport:before{content:"\f5ab"}.fa-pastafarianism:before{content:"\f67b"}.fa-paste:before{content:"\f0ea"}.fa-patreon:before{content:"\f3d9"}.fa-pause:before{content:"\f04c"}.fa-pause-circle:before{content:"\f28b"}.fa-paw:before{content:"\f1b0"}.fa-paypal:before{content:"\f1ed"}.fa-peace:before{content:"\f67c"}.fa-pen:before{content:"\f304"}.fa-pen-alt:before{content:"\f305"}.fa-pen-fancy:before{content:"\f5ac"}.fa-pen-nib:before{content:"\f5ad"}.fa-pen-square:before{content:"\f14b"}.fa-pencil-alt:before{content:"\f303"}.fa-pencil-ruler:before{content:"\f5ae"}.fa-penny-arcade:before{content:"\f704"}.fa-people-arrows:before{content:"\f968"}.fa-people-carry:before{content:"\f4ce"}.fa-pepper-hot:before{content:"\f816"}.fa-percent:before{content:"\f295"}.fa-percentage:before{content:"\f541"}.fa-periscope:before{content:"\f3da"}.fa-person-booth:before{content:"\f756"}.fa-phabricator:before{content:"\f3db"}.fa-phoenix-framework:before{content:"\f3dc"}.fa-phoenix-squadron:before{content:"\f511"}.fa-phone:before{content:"\f095"}.fa-phone-alt:before{content:"\f879"}.fa-phone-slash:before{content:"\f3dd"}.fa-phone-square:before{content:"\f098"}.fa-phone-square-alt:before{content:"\f87b"}.fa-phone-volume:before{content:"\f2a0"}.fa-photo-video:before{content:"\f87c"}.fa-php:before{content:"\f457"}.fa-pied-piper:before{content:"\f2ae"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-pied-piper-hat:before{content:"\f4e5"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-square:before{content:"\f91e"}.fa-piggy-bank:before{content:"\f4d3"}.fa-pills:before{content:"\f484"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-p:before{content:"\f231"}.fa-pinterest-square:before{content:"\f0d3"}.fa-pizza-slice:before{content:"\f818"}.fa-place-of-worship:before{content:"\f67f"}.fa-plane:before{content:"\f072"}.fa-plane-arrival:before{content:"\f5af"}.fa-plane-departure:before{content:"\f5b0"}.fa-plane-slash:before{content:"\f969"}.fa-play:before{content:"\f04b"}.fa-play-circle:before{content:"\f144"}.fa-playstation:before{content:"\f3df"}.fa-plug:before{content:"\f1e6"}.fa-plus:before{content:"\f067"}.fa-plus-circle:before{content:"\f055"}.fa-plus-square:before{content:"\f0fe"}.fa-podcast:before{content:"\f2ce"}.fa-poll:before{content:"\f681"}.fa-poll-h:before{content:"\f682"}.fa-poo:before{content:"\f2fe"}.fa-poo-storm:before{content:"\f75a"}.fa-poop:before{content:"\f619"}.fa-portrait:before{content:"\f3e0"}.fa-pound-sign:before{content:"\f154"}.fa-power-off:before{content:"\f011"}.fa-pray:before{content:"\f683"}.fa-praying-hands:before{content:"\f684"}.fa-prescription:before{content:"\f5b1"}.fa-prescription-bottle:before{content:"\f485"}.fa-prescription-bottle-alt:before{content:"\f486"}.fa-print:before{content:"\f02f"}.fa-procedures:before{content:"\f487"}.fa-product-hunt:before{content:"\f288"}.fa-project-diagram:before{content:"\f542"}.fa-pump-medical:before{content:"\f96a"}.fa-pump-soap:before{content:"\f96b"}.fa-pushed:before{content:"\f3e1"}.fa-puzzle-piece:before{content:"\f12e"}.fa-python:before{content:"\f3e2"}.fa-qq:before{content:"\f1d6"}.fa-qrcode:before{content:"\f029"}.fa-question:before{content:"\f128"}.fa-question-circle:before{content:"\f059"}.fa-quidditch:before{content:"\f458"}.fa-quinscape:before{content:"\f459"}.fa-quora:before{content:"\f2c4"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-quran:before{content:"\f687"}.fa-r-project:before{content:"\f4f7"}.fa-radiation:before{content:"\f7b9"}.fa-radiation-alt:before{content:"\f7ba"}.fa-rainbow:before{content:"\f75b"}.fa-random:before{content:"\f074"}.fa-raspberry-pi:before{content:"\f7bb"}.fa-ravelry:before{content:"\f2d9"}.fa-react:before{content:"\f41b"}.fa-reacteurope:before{content:"\f75d"}.fa-readme:before{content:"\f4d5"}.fa-rebel:before{content:"\f1d0"}.fa-receipt:before{content:"\f543"}.fa-record-vinyl:before{content:"\f8d9"}.fa-recycle:before{content:"\f1b8"}.fa-red-river:before{content:"\f3e3"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-alien:before{content:"\f281"}.fa-reddit-square:before{content:"\f1a2"}.fa-redhat:before{content:"\f7bc"}.fa-redo:before{content:"\f01e"}.fa-redo-alt:before{content:"\f2f9"}.fa-registered:before{content:"\f25d"}.fa-remove-format:before{content:"\f87d"}.fa-renren:before{content:"\f18b"}.fa-reply:before{content:"\f3e5"}.fa-reply-all:before{content:"\f122"}.fa-replyd:before{content:"\f3e6"}.fa-republican:before{content:"\f75e"}.fa-researchgate:before{content:"\f4f8"}.fa-resolving:before{content:"\f3e7"}.fa-restroom:before{content:"\f7bd"}.fa-retweet:before{content:"\f079"}.fa-rev:before{content:"\f5b2"}.fa-ribbon:before{content:"\f4d6"}.fa-ring:before{content:"\f70b"}.fa-road:before{content:"\f018"}.fa-robot:before{content:"\f544"}.fa-rocket:before{content:"\f135"}.fa-rocketchat:before{content:"\f3e8"}.fa-rockrms:before{content:"\f3e9"}.fa-route:before{content:"\f4d7"}.fa-rss:before{content:"\f09e"}.fa-rss-square:before{content:"\f143"}.fa-ruble-sign:before{content:"\f158"}.fa-ruler:before{content:"\f545"}.fa-ruler-combined:before{content:"\f546"}.fa-ruler-horizontal:before{content:"\f547"}.fa-ruler-vertical:before{content:"\f548"}.fa-running:before{content:"\f70c"}.fa-rupee-sign:before{content:"\f156"}.fa-sad-cry:before{content:"\f5b3"}.fa-sad-tear:before{content:"\f5b4"}.fa-safari:before{content:"\f267"}.fa-salesforce:before{content:"\f83b"}.fa-sass:before{content:"\f41e"}.fa-satellite:before{content:"\f7bf"}.fa-satellite-dish:before{content:"\f7c0"}.fa-save:before{content:"\f0c7"}.fa-schlix:before{content:"\f3ea"}.fa-school:before{content:"\f549"}.fa-screwdriver:before{content:"\f54a"}.fa-scribd:before{content:"\f28a"}.fa-scroll:before{content:"\f70e"}.fa-sd-card:before{content:"\f7c2"}.fa-search:before{content:"\f002"}.fa-search-dollar:before{content:"\f688"}.fa-search-location:before{content:"\f689"}.fa-search-minus:before{content:"\f010"}.fa-search-plus:before{content:"\f00e"}.fa-searchengin:before{content:"\f3eb"}.fa-seedling:before{content:"\f4d8"}.fa-sellcast:before{content:"\f2da"}.fa-sellsy:before{content:"\f213"}.fa-server:before{content:"\f233"}.fa-servicestack:before{content:"\f3ec"}.fa-shapes:before{content:"\f61f"}.fa-share:before{content:"\f064"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-share-square:before{content:"\f14d"}.fa-shekel-sign:before{content:"\f20b"}.fa-shield-alt:before{content:"\f3ed"}.fa-shield-virus:before{content:"\f96c"}.fa-ship:before{content:"\f21a"}.fa-shipping-fast:before{content:"\f48b"}.fa-shirtsinbulk:before{content:"\f214"}.fa-shoe-prints:before{content:"\f54b"}.fa-shopify:before{content:"\f957"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-shopping-cart:before{content:"\f07a"}.fa-shopware:before{content:"\f5b5"}.fa-shower:before{content:"\f2cc"}.fa-shuttle-van:before{content:"\f5b6"}.fa-sign:before{content:"\f4d9"}.fa-sign-in-alt:before{content:"\f2f6"}.fa-sign-language:before{content:"\f2a7"}.fa-sign-out-alt:before{content:"\f2f5"}.fa-signal:before{content:"\f012"}.fa-signature:before{content:"\f5b7"}.fa-sim-card:before{content:"\f7c4"}.fa-simplybuilt:before{content:"\f215"}.fa-sistrix:before{content:"\f3ee"}.fa-sitemap:before{content:"\f0e8"}.fa-sith:before{content:"\f512"}.fa-skating:before{content:"\f7c5"}.fa-sketch:before{content:"\f7c6"}.fa-skiing:before{content:"\f7c9"}.fa-skiing-nordic:before{content:"\f7ca"}.fa-skull:before{content:"\f54c"}.fa-skull-crossbones:before{content:"\f714"}.fa-skyatlas:before{content:"\f216"}.fa-skype:before{content:"\f17e"}.fa-slack:before{content:"\f198"}.fa-slack-hash:before{content:"\f3ef"}.fa-slash:before{content:"\f715"}.fa-sleigh:before{content:"\f7cc"}.fa-sliders-h:before{content:"\f1de"}.fa-slideshare:before{content:"\f1e7"}.fa-smile:before{content:"\f118"}.fa-smile-beam:before{content:"\f5b8"}.fa-smile-wink:before{content:"\f4da"}.fa-smog:before{content:"\f75f"}.fa-smoking:before{content:"\f48d"}.fa-smoking-ban:before{content:"\f54d"}.fa-sms:before{content:"\f7cd"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-snowboarding:before{content:"\f7ce"}.fa-snowflake:before{content:"\f2dc"}.fa-snowman:before{content:"\f7d0"}.fa-snowplow:before{content:"\f7d2"}.fa-soap:before{content:"\f96e"}.fa-socks:before{content:"\f696"}.fa-solar-panel:before{content:"\f5ba"}.fa-sort:before{content:"\f0dc"}.fa-sort-alpha-down:before{content:"\f15d"}.fa-sort-alpha-down-alt:before{content:"\f881"}.fa-sort-alpha-up:before{content:"\f15e"}.fa-sort-alpha-up-alt:before{content:"\f882"}.fa-sort-amount-down:before{content:"\f160"}.fa-sort-amount-down-alt:before{content:"\f884"}.fa-sort-amount-up:before{content:"\f161"}.fa-sort-amount-up-alt:before{content:"\f885"}.fa-sort-down:before{content:"\f0dd"}.fa-sort-numeric-down:before{content:"\f162"}.fa-sort-numeric-down-alt:before{content:"\f886"}.fa-sort-numeric-up:before{content:"\f163"}.fa-sort-numeric-up-alt:before{content:"\f887"}.fa-sort-up:before{content:"\f0de"}.fa-soundcloud:before{content:"\f1be"}.fa-sourcetree:before{content:"\f7d3"}.fa-spa:before{content:"\f5bb"}.fa-space-shuttle:before{content:"\f197"}.fa-speakap:before{content:"\f3f3"}.fa-speaker-deck:before{content:"\f83c"}.fa-spell-check:before{content:"\f891"}.fa-spider:before{content:"\f717"}.fa-spinner:before{content:"\f110"}.fa-splotch:before{content:"\f5bc"}.fa-spotify:before{content:"\f1bc"}.fa-spray-can:before{content:"\f5bd"}.fa-square:before{content:"\f0c8"}.fa-square-full:before{content:"\f45c"}.fa-square-root-alt:before{content:"\f698"}.fa-squarespace:before{content:"\f5be"}.fa-stack-exchange:before{content:"\f18d"}.fa-stack-overflow:before{content:"\f16c"}.fa-stackpath:before{content:"\f842"}.fa-stamp:before{content:"\f5bf"}.fa-star:before{content:"\f005"}.fa-star-and-crescent:before{content:"\f699"}.fa-star-half:before{content:"\f089"}.fa-star-half-alt:before{content:"\f5c0"}.fa-star-of-david:before{content:"\f69a"}.fa-star-of-life:before{content:"\f621"}.fa-staylinked:before{content:"\f3f5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-steam-symbol:before{content:"\f3f6"}.fa-step-backward:before{content:"\f048"}.fa-step-forward:before{content:"\f051"}.fa-stethoscope:before{content:"\f0f1"}.fa-sticker-mule:before{content:"\f3f7"}.fa-sticky-note:before{content:"\f249"}.fa-stop:before{content:"\f04d"}.fa-stop-circle:before{content:"\f28d"}.fa-stopwatch:before{content:"\f2f2"}.fa-stopwatch-20:before{content:"\f96f"}.fa-store:before{content:"\f54e"}.fa-store-alt:before{content:"\f54f"}.fa-store-alt-slash:before{content:"\f970"}.fa-store-slash:before{content:"\f971"}.fa-strava:before{content:"\f428"}.fa-stream:before{content:"\f550"}.fa-street-view:before{content:"\f21d"}.fa-strikethrough:before{content:"\f0cc"}.fa-stripe:before{content:"\f429"}.fa-stripe-s:before{content:"\f42a"}.fa-stroopwafel:before{content:"\f551"}.fa-studiovinari:before{content:"\f3f8"}.fa-stumbleupon:before{content:"\f1a4"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-subscript:before{content:"\f12c"}.fa-subway:before{content:"\f239"}.fa-suitcase:before{content:"\f0f2"}.fa-suitcase-rolling:before{content:"\f5c1"}.fa-sun:before{content:"\f185"}.fa-superpowers:before{content:"\f2dd"}.fa-superscript:before{content:"\f12b"}.fa-supple:before{content:"\f3f9"}.fa-surprise:before{content:"\f5c2"}.fa-suse:before{content:"\f7d6"}.fa-swatchbook:before{content:"\f5c3"}.fa-swift:before{content:"\f8e1"}.fa-swimmer:before{content:"\f5c4"}.fa-swimming-pool:before{content:"\f5c5"}.fa-symfony:before{content:"\f83d"}.fa-synagogue:before{content:"\f69b"}.fa-sync:before{content:"\f021"}.fa-sync-alt:before{content:"\f2f1"}.fa-syringe:before{content:"\f48e"}.fa-table:before{content:"\f0ce"}.fa-table-tennis:before{content:"\f45d"}.fa-tablet:before{content:"\f10a"}.fa-tablet-alt:before{content:"\f3fa"}.fa-tablets:before{content:"\f490"}.fa-tachometer-alt:before{content:"\f3fd"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-tape:before{content:"\f4db"}.fa-tasks:before{content:"\f0ae"}.fa-taxi:before{content:"\f1ba"}.fa-teamspeak:before{content:"\f4f9"}.fa-teeth:before{content:"\f62e"}.fa-teeth-open:before{content:"\f62f"}.fa-telegram:before{content:"\f2c6"}.fa-telegram-plane:before{content:"\f3fe"}.fa-temperature-high:before{content:"\f769"}.fa-temperature-low:before{content:"\f76b"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-tenge:before{content:"\f7d7"}.fa-terminal:before{content:"\f120"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-th:before{content:"\f00a"}.fa-th-large:before{content:"\f009"}.fa-th-list:before{content:"\f00b"}.fa-the-red-yeti:before{content:"\f69d"}.fa-theater-masks:before{content:"\f630"}.fa-themeco:before{content:"\f5c6"}.fa-themeisle:before{content:"\f2b2"}.fa-thermometer:before{content:"\f491"}.fa-thermometer-empty:before{content:"\f2cb"}.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-think-peaks:before{content:"\f731"}.fa-thumbs-down:before{content:"\f165"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbtack:before{content:"\f08d"}.fa-ticket-alt:before{content:"\f3ff"}.fa-times:before{content:"\f00d"}.fa-times-circle:before{content:"\f057"}.fa-tint:before{content:"\f043"}.fa-tint-slash:before{content:"\f5c7"}.fa-tired:before{content:"\f5c8"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-toilet:before{content:"\f7d8"}.fa-toilet-paper:before{content:"\f71e"}.fa-toilet-paper-slash:before{content:"\f972"}.fa-toolbox:before{content:"\f552"}.fa-tools:before{content:"\f7d9"}.fa-tooth:before{content:"\f5c9"}.fa-torah:before{content:"\f6a0"}.fa-torii-gate:before{content:"\f6a1"}.fa-tractor:before{content:"\f722"}.fa-trade-federation:before{content:"\f513"}.fa-trademark:before{content:"\f25c"}.fa-traffic-light:before{content:"\f637"}.fa-trailer:before{content:"\f941"}.fa-train:before{content:"\f238"}.fa-tram:before{content:"\f7da"}.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-trash:before{content:"\f1f8"}.fa-trash-alt:before{content:"\f2ed"}.fa-trash-restore:before{content:"\f829"}.fa-trash-restore-alt:before{content:"\f82a"}.fa-tree:before{content:"\f1bb"}.fa-trello:before{content:"\f181"}.fa-tripadvisor:before{content:"\f262"}.fa-trophy:before{content:"\f091"}.fa-truck:before{content:"\f0d1"}.fa-truck-loading:before{content:"\f4de"}.fa-truck-monster:before{content:"\f63b"}.fa-truck-moving:before{content:"\f4df"}.fa-truck-pickup:before{content:"\f63c"}.fa-tshirt:before{content:"\f553"}.fa-tty:before{content:"\f1e4"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-tv:before{content:"\f26c"}.fa-twitch:before{content:"\f1e8"}.fa-twitter:before{content:"\f099"}.fa-twitter-square:before{content:"\f081"}.fa-typo3:before{content:"\f42b"}.fa-uber:before{content:"\f402"}.fa-ubuntu:before{content:"\f7df"}.fa-uikit:before{content:"\f403"}.fa-umbraco:before{content:"\f8e8"}.fa-umbrella:before{content:"\f0e9"}.fa-umbrella-beach:before{content:"\f5ca"}.fa-underline:before{content:"\f0cd"}.fa-undo:before{content:"\f0e2"}.fa-undo-alt:before{content:"\f2ea"}.fa-uniregistry:before{content:"\f404"}.fa-unity:before{content:"\f949"}.fa-universal-access:before{content:"\f29a"}.fa-university:before{content:"\f19c"}.fa-unlink:before{content:"\f127"}.fa-unlock:before{content:"\f09c"}.fa-unlock-alt:before{content:"\f13e"}.fa-untappd:before{content:"\f405"}.fa-upload:before{content:"\f093"}.fa-ups:before{content:"\f7e0"}.fa-usb:before{content:"\f287"}.fa-user:before{content:"\f007"}.fa-user-alt:before{content:"\f406"}.fa-user-alt-slash:before{content:"\f4fa"}.fa-user-astronaut:before{content:"\f4fb"}.fa-user-check:before{content:"\f4fc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-clock:before{content:"\f4fd"}.fa-user-cog:before{content:"\f4fe"}.fa-user-edit:before{content:"\f4ff"}.fa-user-friends:before{content:"\f500"}.fa-user-graduate:before{content:"\f501"}.fa-user-injured:before{content:"\f728"}.fa-user-lock:before{content:"\f502"}.fa-user-md:before{content:"\f0f0"}.fa-user-minus:before{content:"\f503"}.fa-user-ninja:before{content:"\f504"}.fa-user-nurse:before{content:"\f82f"}.fa-user-plus:before{content:"\f234"}.fa-user-secret:before{content:"\f21b"}.fa-user-shield:before{content:"\f505"}.fa-user-slash:before{content:"\f506"}.fa-user-tag:before{content:"\f507"}.fa-user-tie:before{content:"\f508"}.fa-user-times:before{content:"\f235"}.fa-users:before{content:"\f0c0"}.fa-users-cog:before{content:"\f509"}.fa-usps:before{content:"\f7e1"}.fa-ussunnah:before{content:"\f407"}.fa-utensil-spoon:before{content:"\f2e5"}.fa-utensils:before{content:"\f2e7"}.fa-vaadin:before{content:"\f408"}.fa-vector-square:before{content:"\f5cb"}.fa-venus:before{content:"\f221"}.fa-venus-double:before{content:"\f226"}.fa-venus-mars:before{content:"\f228"}.fa-viacoin:before{content:"\f237"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-vial:before{content:"\f492"}.fa-vials:before{content:"\f493"}.fa-viber:before{content:"\f409"}.fa-video:before{content:"\f03d"}.fa-video-slash:before{content:"\f4e2"}.fa-vihara:before{content:"\f6a7"}.fa-vimeo:before{content:"\f40a"}.fa-vimeo-square:before{content:"\f194"}.fa-vimeo-v:before{content:"\f27d"}.fa-vine:before{content:"\f1ca"}.fa-virus:before{content:"\f974"}.fa-virus-slash:before{content:"\f975"}.fa-viruses:before{content:"\f976"}.fa-vk:before{content:"\f189"}.fa-vnv:before{content:"\f40b"}.fa-voicemail:before{content:"\f897"}.fa-volleyball-ball:before{content:"\f45f"}.fa-volume-down:before{content:"\f027"}.fa-volume-mute:before{content:"\f6a9"}.fa-volume-off:before{content:"\f026"}.fa-volume-up:before{content:"\f028"}.fa-vote-yea:before{content:"\f772"}.fa-vr-cardboard:before{content:"\f729"}.fa-vuejs:before{content:"\f41f"}.fa-walking:before{content:"\f554"}.fa-wallet:before{content:"\f555"}.fa-warehouse:before{content:"\f494"}.fa-water:before{content:"\f773"}.fa-wave-square:before{content:"\f83e"}.fa-waze:before{content:"\f83f"}.fa-weebly:before{content:"\f5cc"}.fa-weibo:before{content:"\f18a"}.fa-weight:before{content:"\f496"}.fa-weight-hanging:before{content:"\f5cd"}.fa-weixin:before{content:"\f1d7"}.fa-whatsapp:before{content:"\f232"}.fa-whatsapp-square:before{content:"\f40c"}.fa-wheelchair:before{content:"\f193"}.fa-whmcs:before{content:"\f40d"}.fa-wifi:before{content:"\f1eb"}.fa-wikipedia-w:before{content:"\f266"}.fa-wind:before{content:"\f72e"}.fa-window-close:before{content:"\f410"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-windows:before{content:"\f17a"}.fa-wine-bottle:before{content:"\f72f"}.fa-wine-glass:before{content:"\f4e3"}.fa-wine-glass-alt:before{content:"\f5ce"}.fa-wix:before{content:"\f5cf"}.fa-wizards-of-the-coast:before{content:"\f730"}.fa-wolf-pack-battalion:before{content:"\f514"}.fa-won-sign:before{content:"\f159"}.fa-wordpress:before{content:"\f19a"}.fa-wordpress-simple:before{content:"\f411"}.fa-wpbeginner:before{content:"\f297"}.fa-wpexplorer:before{content:"\f2de"}.fa-wpforms:before{content:"\f298"}.fa-wpressr:before{content:"\f3e4"}.fa-wrench:before{content:"\f0ad"}.fa-x-ray:before{content:"\f497"}.fa-xbox:before{content:"\f412"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-y-combinator:before{content:"\f23b"}.fa-yahoo:before{content:"\f19e"}.fa-yammer:before{content:"\f840"}.fa-yandex:before{content:"\f413"}.fa-yandex-international:before{content:"\f414"}.fa-yarn:before{content:"\f7e3"}.fa-yelp:before{content:"\f1e9"}.fa-yen-sign:before{content:"\f157"}.fa-yin-yang:before{content:"\f6ad"}.fa-yoast:before{content:"\f2b1"}.fa-youtube:before{content:"\f167"}.fa-youtube-square:before{content:"\f431"}.fa-zhihu:before{content:"\f63f"}.sr-only{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.sr-only-focusable:active,.sr-only-focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}@font-face{font-family:"Font Awesome 5 Brands";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-brands-400.eot);src:url(../webfonts/fa-brands-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-brands-400.woff2) format("woff2"),url(../webfonts/fa-brands-400.woff) format("woff"),url(../webfonts/fa-brands-400.ttf) format("truetype"),url(../webfonts/fa-brands-400.svg#fontawesome) format("svg")}.fab{font-family:"Font Awesome 5 Brands"}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:400;font-display:block;src:url(../webfonts/fa-regular-400.eot);src:url(../webfonts/fa-regular-400.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-regular-400.woff2) format("woff2"),url(../webfonts/fa-regular-400.woff) format("woff"),url(../webfonts/fa-regular-400.ttf) format("truetype"),url(../webfonts/fa-regular-400.svg#fontawesome) format("svg")}.fab,.far{font-weight:400}@font-face{font-family:"Font Awesome 5 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.far,.fas{font-family:"Font Awesome 5 Free"}.fa,.fas{font-weight:900} | 58,578 | 11,714.8 | 58,392 | css |
null | CARL-main/docs/themes/smac/templates/copyright.html | <p class="copyright">
{%- if hasdoc('copyright') %}
{% trans path=pathto('copyright'), copyright=copyright|e %}© <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}<br>
{%- else %}
{% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}<br>
{%- endif %}
</p> | 310 | 43.428571 | 139 | html |
null | CARL-main/docs/themes/smac/templates/edit-this-page.html | {% if sourcename is defined and theme_use_edit_page_button==true and page_source_suffix %}
{% set src = sourcename.split('.') %}
<div class="tocsection editthispage">
<a href="{{ get_edit_url() }}">
<i class="fas fa-pencil-alt"></i> {{ _("Edit this page") }}
</a>
</div>
{% endif %}
| 299 | 32.333333 | 90 | html |
null | CARL-main/docs/themes/smac/templates/last-updated.html | <p class="last-updated">
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}<br>
</p> | 122 | 40 | 92 | html |
null | CARL-main/docs/themes/smac/templates/navbar-icon-links.html | {%- block icon_links -%}
{%- include "icon-links.html" with context -%}
{%- endblock %} | 87 | 28.333333 | 46 | html |
null | CARL-main/docs/themes/smac/templates/navbar-logo.html | {% if logo %}
{% if not theme_logo_link %}
<a class="navbar-brand" href="{{ pathto(master_doc) }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% elif theme_logo_link[:4] == 'http' %}
<a class="navbar-brand" href="{{ theme_logo_link }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% else %}
<a class="navbar-brand" href="{{ pathto(theme_logo_link) }}">
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="logo">
</a>
{% endif %}
{% else %}
<a class="navbar-brand" href="{{ pathto(master_doc) }}">
<p class="title">{{ project }}</p>
</a>
{% endif %} | 639 | 32.684211 | 72 | html |
null | CARL-main/docs/themes/smac/templates/navbar-nav.html | <ul id="navbar-main-elements" class="navbar-nav">
{{ generate_nav_html("navbar", maxdepth=1, collapse=True, includehidden=True, titles_only=True) }}
{% for external_link in theme_external_links %}
<li class="nav-item">
<a class="nav-link nav-external" href="{{ external_link.url }}">{{ _(external_link.name) }}<i class="fas fa-external-link-alt"></i></a>
</li>
{% endfor %}
</ul> | 407 | 50 | 143 | html |
null | CARL-main/docs/themes/smac/templates/page-toc.html | {% set page_toc = generate_toc_html() %}
{%- if page_toc | length >= 1 %}
<div class="tocsection onthispage pt-5 pb-3">
<i class="fas fa-list"></i> {{ _("On this page") }}
</div>
{%- endif %}
<nav id="bd-toc-nav">
{{ page_toc }}
</nav> | 245 | 21.363636 | 55 | html |
null | CARL-main/docs/themes/smac/templates/prev-next.html | <!-- Previous / next buttons -->
<div class='prev-next-area'>
{%- if prev %}
<a class='left-prev' id="prev-link" href="{{ prev.link|e }}" title="{{ _('previous') }} {{ _('page') }}">
<i class="fas fa-angle-left"></i>
<div class="prev-next-info">
<p class="prev-next-subtitle">{{ _("previous") }}</p>
<p class="prev-next-title">{{ prev_title or prev.title }}</p>
</div>
</a>
{%- endif %}
{%- if next %}
<a class='right-next' id="next-link" href="{{ next.link|e }}" title="{{ _('next') }} {{ _('page') }}">
<div class="prev-next-info">
<p class="prev-next-subtitle">{{ _("next") }}</p>
<p class="prev-next-title">{{ next_title or next.title }}</p>
</div>
<i class="fas fa-angle-right"></i>
</a>
{%- endif %}
</div> | 821 | 38.142857 | 109 | html |
null | CARL-main/docs/themes/smac/templates/sidebar-ethical-ads.html | {% if READTHEDOCS %}
<div
id="ethical-ad-placement"
class="flat"
data-ea-publisher="readthedocs"
data-ea-type="readthedocs-sidebar"
data-ea-manual="true"
></div>
{% endif %}
| 184 | 17.5 | 36 | html |
null | CARL-main/docs/themes/smac/templates/sidebar-nav-bs.html | <nav class="bd-links" id="bd-docs-nav" aria-label="{{ _('Main navigation') }}">
<div class="bd-toc-item active">
{{ generate_nav_html("sidebar",
maxdepth=theme_navigation_depth|int,
collapse=theme_collapse_navigation|tobool,
includehidden=True,
titles_only=True) }}
</div>
</nav>
| 388 | 37.9 | 79 | html |
null | CARL-main/docs/themes/smac/templates/sphinx-version.html | <p class="sphinx-version">
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx-doc.org/">Sphinx</a>
{{ sphinx_version }}. Template is modified version of <a
href="https://pydata-sphinx-theme.readthedocs.io">PyData Sphinx Theme</a>. {% endtrans %}<br>
</p> | 283 | 55.8 | 100 | html |
null | CARL-main/examples/demo_carracing.py | """
Code adapted from gym.envs.box2d.car_racing.py
"""
from typing import Any
import numpy as np
import gym
import time
import pygame
from carl.envs.box2d.carl_vehicle_racing import CARLVehicleRacingEnv, VEHICLE_NAMES
if __name__ == "__main__":
from pyglet.window import key
a = np.array([0.0, 0.0, 0.0])
def register_input():
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
a[0] = -1.0
if event.key == pygame.K_RIGHT:
a[0] = +1.0
if event.key == pygame.K_UP:
a[1] = +1.0
if event.key == pygame.K_DOWN:
a[2] = +0.8 # set 1.0 for wheels to block to zero rotation
if event.key == pygame.K_RETURN:
global restart
restart = True
if event.type == pygame.KEYUP:
if event.key == pygame.K_LEFT:
a[0] = 0
if event.key == pygame.K_RIGHT:
a[0] = 0
if event.key == pygame.K_UP:
a[1] = 0
if event.key == pygame.K_DOWN:
a[2] = 0
contexts = {i: {"VEHICLE": i} for i in range(len(VEHICLE_NAMES))}
env = CARLVehicleRacingEnv(contexts=contexts)
env.render()
record_video = False
if record_video:
from gym.wrappers.record_video import RecordVideo
env = RecordVideo(
env=env, video_folder="/tmp/video-test", name_prefix="CARLVehicleRacing"
)
isopen = True
while isopen:
env.reset()
total_reward = 0.0
steps = 0
restart = False
while True:
register_input()
s, r, done, info = env.step(a)
time.sleep(0.025)
total_reward += r
if steps % 200 == 0 or done:
print("\naction " + str(["{:+0.2f}".format(x) for x in a]))
print("step {} total_reward {:+0.2f}".format(steps, total_reward))
steps += 1
isopen = env.render()
if done or restart or not isopen:
break
env.close()
| 2,242 | 30.152778 | 84 | py |
null | CARL-main/examples/demo_heuristic_lunarlander.py | from typing import Union, Optional
from gym.envs.box2d.lunar_lander import heuristic
import gym.envs.box2d.lunar_lander as lunar_lander
from carl.envs import CARLLunarLanderEnv
def demo_heuristic_lander(
env: Union[
CARLLunarLanderEnv, lunar_lander.LunarLander, lunar_lander.LunarLanderContinuous
],
seed: Optional[int] = None,
render: bool = False,
) -> float:
"""
Copied from LunarLander
"""
env.seed(seed)
total_reward = 0
steps = 0
env.render()
s = env.reset()
while True:
a = heuristic(env, s)
s, r, done, info = env.step(a)
total_reward += r
if render:
still_open = env.render()
if not still_open:
break
if done: # or steps % 20 == 0:
# print("observations:", " ".join(["{:+0.2f}".format(x) for x in s]))
print("step {} total_reward {:+0.2f}".format(steps, total_reward))
steps += 1
if done:
break
return total_reward
if __name__ == "__main__":
env = CARLLunarLanderEnv(
hide_context=False,
add_gaussian_noise_to_context=True,
gaussian_noise_std_percentage=0.1,
)
# env.render() # initialize viewer. otherwise weird bug.
# env = ll.LunarLander()
# env = CustomLunarLanderEnv()
for i in range(5):
demo_heuristic_lander(env, seed=1, render=True)
env.close()
| 1,428 | 24.981818 | 88 | py |
null | CARL-main/examples/try_dm_control.py | # flake8: noqa: F401
# type: ignore
import matplotlib.pyplot as plt
from carl.envs import CARLDmcFishEnv
from carl.envs import CARLDmcFishEnv_defaults as fish_default
from carl.envs import CARLDmcFishEnv_mask as fish_mask
from carl.envs import CARLDmcQuadrupedEnv
from carl.envs import CARLDmcQuadrupedEnv_defaults as quadruped_default
from carl.envs import CARLDmcQuadrupedEnv_mask as quadruped_mask
from carl.envs import CARLDmcWalkerEnv
from carl.envs import CARLDmcWalkerEnv_defaults as walker_default
from carl.envs import CARLDmcWalkerEnv_mask as walker_mask
if __name__ == "__main__":
# Load one task:
stronger_act = walker_default.copy()
stronger_act["actuator_strength"] = walker_default["actuator_strength"] * 2
contexts = {0: stronger_act}
# stronger_act = quadruped_default.copy()
# stronger_act["actuator_strength"] = quadruped_default["actuator_strength"]*2
# contexts = {0: stronger_act}
# carl_env = CARLDmcQuadrupedEnv(task="fetch_context", contexts=contexts, context_mask=quadruped_mask, hide_context=False)
# contexts = {0: fish_default}
# carl_env = CARLDmcFishEnv(task="upright_context", contexts=contexts, context_mask=fish_mask, hide_context=False)
carl_env = CARLDmcWalkerEnv(
task="run_context",
contexts=contexts,
context_mask=walker_mask,
hide_context=False,
dict_observation_space=True,
)
action = carl_env.action_space.sample()
state, reward, done, info = carl_env.step(action=action)
print("state", state, type(state))
render = lambda: plt.imshow(carl_env.render(mode="rgb_array"))
s = carl_env.reset()
render()
# plt.savefig("dm_render.png")
action = carl_env.action_space.sample()
state, reward, done, info = carl_env.step(action=action)
print("state", state, type(state))
# s = carl_env.reset()
# done = False
# i = 0
# while not done:
# action = carl_env.action_space.sample()
# state, reward, done, info = carl_env.step(action=action)
# print(state, action, reward, done)
# i += 1
# print(i)
| 2,117 | 36.821429 | 126 | py |
null | CARL-main/test/test_CARLEnv.py | from typing import Any, Dict
import unittest
import numpy as np
from carl.envs.classic_control.carl_pendulum import CARLPendulumEnv
from carl.utils.types import Context
class TestStateConstruction(unittest.TestCase):
def test_hiddenstate(self):
"""
Test if we set hide_context = True that we get the original, normal state.
"""
env = CARLPendulumEnv(
contexts={},
hide_context=True,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
)
env.reset()
action = [0.01] # torque
state, reward, done, info = env.step(action=action)
env.close()
self.assertEqual(3, len(state))
def test_visiblestate(self):
"""
Test if we set hide_context = False and state_context_features=None that we get the normal state extended by
all context features.
"""
env = CARLPendulumEnv(
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
)
env.reset()
action = [0.01] # torque
state, reward, done, info = env.step(action=action)
env.close()
self.assertEqual(10, len(state))
def test_visiblestate_customnone(self):
"""
Test if we set hide_context = False and state_context_features="changing_context_features" that we get the
normal state, not extended by context features.
"""
env = CARLPendulumEnv(
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=["changing_context_features"],
)
env.reset()
action = [0.01] # torque
state, reward, done, info = env.step(action=action)
env.close()
# Because we don't change any context features the state length should be 3
self.assertEqual(3, len(state))
def test_visiblestate_custom(self):
"""
Test if we set hide_context = False and state_context_features=["g", "m"] that we get the
normal state, extended by the context feature values of g and m.
"""
env = CARLPendulumEnv(
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=["g", "m"],
)
env.reset()
action = [0.01] # torque
state, reward, done, info = env.step(action=action)
env.close()
# state should be of length 5 because we add two context features
self.assertEqual(5, len(state))
def test_visiblestate_changingcontextfeatures_nochange(self):
"""
Test if we set hide_context = False and state_context_features="changing_context_features" that we get the
normal state, extended by the context features which are changing in the set of contexts. Here: None are
changing.
"""
contexts = {
"0": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 1.0},
"1": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 1.0},
"2": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 1.0},
"3": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 1.0},
}
env = CARLPendulumEnv(
contexts=contexts,
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=["changing_context_features"],
)
env.reset()
action = [0.01] # torque
state, reward, done, info = env.step(action=action)
env.close()
# state should be of length 3 because all contexts are the same
self.assertEqual(3, len(state))
def test_visiblestate_changingcontextfeatures_change(self):
"""
Test if we set hide_context = False and state_context_features="changing_context_features" that we get the
normal state, extended by the context features which are changing in the set of contexts.
Here: Two are changing.
"""
contexts = {
"0": {"max_speed": 8.0, "dt": 0.03, "g": 10.0, "m": 1.0, "l": 1.0},
"1": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 0.95},
"2": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 0.3},
"3": {"max_speed": 8.0, "dt": 0.05, "g": 10.0, "m": 1.0, "l": 1.3},
}
env = CARLPendulumEnv(
contexts=contexts,
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=["changing_context_features"],
)
env.reset()
action = [0.01] # torque
state, reward, done, info = env.step(action=action)
env.close()
# state should be of length 5 because two features are changing (dt and l)
self.assertEqual(5, len(state))
def test_dict_observation_space(self):
contexts = {"0": {"max_speed": 8.0, "dt": 0.03, "g": 10.0, "m": 1.0, "l": 1.0}}
env = CARLPendulumEnv(
contexts=contexts,
hide_context=False,
dict_observation_space=True,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=["changing_context_features"],
)
obs = env.reset()
self.assertEqual(type(obs), dict)
self.assertTrue("state" in obs)
self.assertTrue("context" in obs)
action = [0.01] # torque
next_obs, reward, done, info = env.step(action=action)
env.close()
def test_state_context_feature_population(self):
env = ( # noqa: F841 local variable is assigned to but never used
CARLPendulumEnv(
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="no",
)
)
self.assertIsNotNone(env.state_context_features)
class TestEpisodeTermination(unittest.TestCase):
def test_episode_termination(self):
"""
Test if we set hide_context = True that we get the original, normal state.
"""
ep_length = 100
env = CARLPendulumEnv(
contexts={},
hide_context=True,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
max_episode_length=ep_length,
)
env.reset()
action = [0.0] # torque
done = False
counter = 0
while not done:
state, reward, done, info = env.step(action=action)
counter += 1
self.assertTrue(counter <= ep_length)
if counter > ep_length:
break
env.close()
class TestContextFeatureScaling(unittest.TestCase):
def test_context_feature_scaling_no(self):
env = ( # noqa: F841 local variable is assigned to but never used
CARLPendulumEnv(
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="no",
)
)
def test_context_feature_scaling_by_mean(self):
contexts = {
# order is important because context "0" is checked in the test
# because of the reset context "0" must come seond
"1": {"max_speed": 16.0, "dt": 0.06, "g": 20.0, "m": 2.0, "l": 3.6},
"0": {"max_speed": 8.0, "dt": 0.03, "g": 10.0, "m": 1.0, "l": 1.8},
}
env = CARLPendulumEnv(
contexts=contexts,
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="by_mean",
)
env.reset()
action = [0.0]
state, reward, done, info = env.step(action=action)
n_c = len(env.default_context)
scaled_contexts = state[-n_c:]
target = np.array(
[16 / 12, 0.06 / 0.045, 20 / 15, 2 / 1.5, 3.6 / 2.7, 1, 1]
) # for context "1"
self.assertTrue(
np.all(target == scaled_contexts),
f"target {target} != actual {scaled_contexts}",
)
def test_context_feature_scaling_by_default(self):
default_context = {
"max_speed": 8.0,
"dt": 0.05,
"g": 10.0,
"m": 1.0,
"l": 1.0,
"initial_angle_max": np.pi,
"initial_velocity_max": 1,
}
contexts = {
"0": {"max_speed": 8.0, "dt": 0.03, "g": 10.0, "m": 1.0, "l": 1.8},
}
env = CARLPendulumEnv(
contexts=contexts,
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="by_default",
default_context=default_context,
)
env.reset()
action = [0.0]
state, reward, done, info = env.step(action=action)
n_c = len(default_context)
scaled_contexts = state[-n_c:]
self.assertTrue(
np.all(np.array([1.0, 0.6, 1, 1, 1.8, 1, 1]) == scaled_contexts)
)
def test_context_feature_scaling_by_default_nodefcontext(self):
with self.assertRaises(ValueError):
env = CARLPendulumEnv( # noqa: F841 local variable is assigned to but never used
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="by_default",
default_context=None,
)
def test_context_feature_scaling_unknown_init(self):
with self.assertRaises(ValueError):
env = CARLPendulumEnv( # noqa: F841 local variable is assigned to but never used
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="bork",
)
def test_context_feature_scaling_unknown_step(self):
env = ( # noqa: F841 local variable is assigned to but never used
CARLPendulumEnv(
contexts={},
hide_context=False,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="no",
)
)
env.reset()
env.scale_context_features = "bork"
action = [0.01] # torque
with self.assertRaises(ValueError):
next_obs, reward, done, info = env.step(action=action)
def test_context_mask(self):
context_mask = ["dt", "g"]
env = ( # noqa: F841 local variable is assigned to but never used
CARLPendulumEnv(
contexts={},
hide_context=False,
context_mask=context_mask,
dict_observation_space=True,
add_gaussian_noise_to_context=False,
gaussian_noise_std_percentage=0.01,
state_context_features=None,
scale_context_features="no",
)
)
s = env.reset()
s_c = s["context"]
forbidden_in_context = [
f for f in env.state_context_features if f in context_mask
]
self.assertTrue(len(s_c) == len(list(env.default_context.keys())) - 2)
self.assertTrue(len(forbidden_in_context) == 0)
class TestContextSelection(unittest.TestCase):
@staticmethod
def generate_contexts() -> Dict[Any, Context]:
keys = "abc"
context = {"max_speed": 8.0, "dt": 0.03, "g": 10.0, "m": 1.0, "l": 1.8}
contexts = {k: context for k in keys}
return contexts
def test_default_selector(self):
from carl.context.selection import RoundRobinSelector
contexts = self.generate_contexts()
env = CARLPendulumEnv(contexts=contexts)
env.reset()
self.assertEqual(type(env.context_selector), RoundRobinSelector)
self.assertEqual(env.context_selector.n_calls, 1)
env.reset()
self.assertEqual(env.context_key, "b")
def test_roundrobin_selector_init(self):
from carl.context.selection import RoundRobinSelector
contexts = self.generate_contexts()
env = CARLPendulumEnv(
contexts=contexts, context_selector=RoundRobinSelector(contexts=contexts)
)
self.assertEqual(type(env.context_selector), RoundRobinSelector)
def test_random_selector_init(self):
from carl.context.selection import RandomSelector
contexts = self.generate_contexts()
env = CARLPendulumEnv(
contexts=contexts, context_selector=RandomSelector(contexts=contexts)
)
self.assertEqual(type(env.context_selector), RandomSelector)
def test_random_selectorclass_init(self):
from carl.context.selection import RandomSelector
contexts = self.generate_contexts()
env = CARLPendulumEnv(contexts=contexts, context_selector=RandomSelector)
self.assertEqual(type(env.context_selector), RandomSelector)
def test_unknown_selector_init(self):
with self.assertRaises(ValueError):
contexts = self.generate_contexts()
_ = CARLPendulumEnv(contexts=contexts, context_selector="bork")
def test_get_context_key(self):
contexts = self.generate_contexts()
env = CARLPendulumEnv(contexts=contexts)
self.assertEqual(env.context_key, None)
class TestContextSampler(unittest.TestCase):
def test_get_defaults(self):
from carl.context.sampling import get_default_context_and_bounds
defaults, bounds = get_default_context_and_bounds(env_name="CARLPendulumEnv")
DEFAULT_CONTEXT = {
"max_speed": 8.0,
"dt": 0.05,
"g": 10.0,
"m": 1.0,
"l": 1.0,
"initial_angle_max": np.pi,
"initial_velocity_max": 1,
}
self.assertDictEqual(defaults, DEFAULT_CONTEXT)
def test_sample_contexts(self):
from carl.context.sampling import sample_contexts
contexts = sample_contexts(
env_name="CARLPendulumEnv",
context_feature_args=["l"],
num_contexts=1,
default_sample_std_percentage=0.0,
)
self.assertEqual(contexts[0]["l"], 1)
class TestContextAugmentation(unittest.TestCase):
def test_gaussian_noise(self):
from carl.context.augmentation import add_gaussian_noise
c = add_gaussian_noise(default_value=1, percentage_std=0)
self.assertEqual(c, 1)
if __name__ == "__main__":
unittest.main()
| 15,722 | 35.822014 | 116 | py |
null | CARL-main/test/test_all_envs.py | import unittest
import numpy as np
import carl.envs
class TestInitEnvs(unittest.TestCase):
def test_init_all_envs(self):
global_vars = vars(carl.envs)
mustinclude = "CARL"
forbidden = ["defaults", "bounds", "mask"]
for varname, var in global_vars.items():
if mustinclude in varname and not np.any([f in varname for f in forbidden]):
try:
env = ( # noqa: F841 local variable is assigned to but never used
var()
)
except Exception as e:
print(f"Cannot instantiate {var} environment.")
raise e
| 680 | 29.954545 | 88 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.