Skip to content

Commit

Permalink
initial commit for qlearning_mpc
Browse files Browse the repository at this point in the history
  • Loading branch information
svsawant committed Nov 9, 2023
1 parent 8841562 commit cbb1159
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
28 changes: 14 additions & 14 deletions examples/rlmpc/config_overrides/cartpole/cartpole_stab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ task_config:
# state initialization
init_state:
init_x: 0.1
init_x_dot: -1.5
init_theta: -0.175
init_theta_dot: 0.5
randomized_init: True
init_x_dot: -0.5
init_theta: -0.1
init_theta_dot: 0.0
randomized_init: False
randomized_inertial_prop: False
normalized_rl_action_space: True

Expand Down Expand Up @@ -56,16 +56,16 @@ task_config:
constraints:
- constraint_form: default_constraint
constrained_variable: state
upper_bounds:
- 2
- 2
- 0.18
- 2
lower_bounds:
- -2
- -2
- -0.18
- -2
# upper_bounds:
# - 20
# - 20
# - 0.58
# - 20
# lower_bounds:
# - -20
# - -20
# - -0.58
# - -20
- constraint_form: default_constraint
constrained_variable: input
done_on_out_of_bound: True
Expand Down
4 changes: 2 additions & 2 deletions safe_control_gym/controllers/mpc/qlearning_mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def setup_optimizer(self):
opti.minimize(cost)
# Create solver (IPOPT solver in this version)
# opts = {'ipopt.print_level': 0, 'ipopt.sb': 'yes', 'print_time': 0}
opts = {'expand': True}
opts = {'expand': True, 'ipopt.print_level': 0, 'print_time': 0}
opti.solver('ipopt', opts)
self.opti_dict = {
'opti': opti,
Expand Down Expand Up @@ -298,7 +298,7 @@ def select_action(self,
self.results_dict['horizon_states'].append(deepcopy(self.x_prev))
self.results_dict['horizon_inputs'].append(deepcopy(self.u_prev))
self.results_dict['goal_states'].append(deepcopy(goal_states))
self.results_dict['t_wall'].append(opti.stats()['t_wall_total'])
# self.results_dict['t_wall'].append(opti.stats()['t_wall_total'])
# Take the first action from the solved action sequence.
if u_val.ndim > 1:
action = u_val[:, 0]
Expand Down
2 changes: 1 addition & 1 deletion safe_control_gym/controllers/mpc/qlearning_mpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ r_mpc:
- 0.1
q_mpc:
- 1.
warmstart: True
warmstart: False
soft_constraints: False
constraint_tol: 1.0e-6

Expand Down

0 comments on commit cbb1159

Please sign in to comment.