Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bolero/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ def episode(self, meta_parameter_keys=(), meta_parameters=()):

return feedbacks

def episode_with(self, behavior, meta_parameter_keys=[],
meta_parameters=[], record=True):
def episode_with(self, behavior, meta_parameter_keys=(),
meta_parameters=(), record=True):
"""Execute a behavior in the environment.

Parameters
Expand Down Expand Up @@ -319,7 +319,7 @@ class ContextualController(Controller):
* test_contexts (array-like) - the upper-level policy will be evaluated in
these contexts
"""
def __init__(self, config={}, environment=None, behavior_search=None,
def __init__(self, config=None, environment=None, behavior_search=None,
**kwargs):
super(ContextualController, self).__init__(
config, environment, behavior_search, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion bolero/environment/openaigym.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def step_action(self):
self.done = self.done or done

self.step += 1
if self.step >= self.env.spec.timestep_limit:
if self.step >= self.env.spec.max_episode_steps:
self.done = True

if self.log_to_stdout or self.log_to_file:
Expand Down
9 changes: 7 additions & 2 deletions bolero/environment/optimum_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,15 @@ def __init__(self,
self.g = g
self.execution_time = execution_time
self.dt = dt
task_space_dim = len(x0)
if obstacles is None:
self.obstacles = np.empty((0, len(x0)))
self.obstacles = np.empty((0, task_space_dim))
else:
self.obstacles = np.vstack(obstacles)
if len(obstacles[:]) % task_space_dim != 0:
raise ValueError("Obstacles defined by %d values. A multiple of %d (task space dimension) is required."
% (len(obstacles[:]), task_space_dim))
self.obstacles = np.asarray(obstacles).reshape([-1, task_space_dim])
assert self.obstacles.shape[1] == 2
self.obstacle_dist = obstacle_dist
self.penalty_start_dist = penalty_start_dist
self.penalty_goal_dist = penalty_goal_dist
Expand Down
2 changes: 1 addition & 1 deletion bolero/representation/promp_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def get_n_params(self):
if self.learn_covariance:
correlation_coefficients = (
len(self.data.covariance_) - random_variables) / 2
return 2 * random_variables + correlation_coefficients
return int(2 * random_variables + correlation_coefficients)
else:
return random_variables

Expand Down
7 changes: 7 additions & 0 deletions bootstrap_bolero.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ then
echo -e "\e[31mPython '$PYTHON' not found.\e[0m"
exit 1
fi
CYTHON_AVAILABLE=1
`$PYTHON -c "import Cython" 2> /dev/null` || CYTHON_AVAILABLE=0
if [ CYTHON_AVAILABLE == 0 ];
then
echo "Cython for $PYTHON not available, trying to install it with '$PYTHON -m pip install Cython'"
$PYTHON -m pip install Cython
fi
echo -e "\e[31mUsing Python: $PYTHON (located at `which $PYTHON`)\e[0m"

# checking minimal dependencies on Ubuntu systems...
Expand Down
2 changes: 1 addition & 1 deletion examples/optimizer/plot_cmaes.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def plot_ellipse(cov, mean, color):
plt.figure(figsize=(n_generations * 3 / n_rows, 3 * n_rows))
path = []
for it in range(n_generations):
plt.subplot(n_rows, n_generations / n_rows, it + 1)
plt.subplot(n_rows, int(n_generations / n_rows, it + 1))
plot_objective()
last_mean = cmaes.mean.copy()
path.append(last_mean)
Expand Down
2 changes: 1 addition & 1 deletion examples/optimizer/plot_contextual_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def plot_objective():
colors = {"C-CMA-ES": "r", "C-REPS": "g"}
plt.figure(figsize=(n_generations * 3 / n_rows, 3 * n_rows))
for it in range(n_generations):
plt.subplot(n_rows, n_generations / n_rows, it + 1)
plt.subplot(n_rows, int(n_generations / n_rows, it + 1))
plot_objective()

contexts = random_state.rand(n_samples_per_update, 1) * 10.0 - 5.0
Expand Down