Source-linked AI summary

OptLayer - Practical Constrained Optimization for Deep Reinforcement Learning in the Real World

Tu-Hoa Pham, Giovanni De Magistris, Ryuki Tachibana

arXiv:1709.07643v2cs.ROcs.AI

TL;DR

Real-world reinforcement learning is difficult because unconstrained trial-and-error can produce unsafe robot behavior, and safe policies are sensitive to reward design. The paper introduces OptLayer to project neural-network actions onto constraint-satisfying actions while penalizing unsafe predictions, demonstrating the approach in simulated and real-world reaching. The authors conclude that constrained optimization can couple efficiently with stochastic control policies, although training from scratch and formalizing constraints remain difficult.

  • Problem

    Safe reinforcement learning for robotics must address unsafe exploration and the sensitivity of learned safety to reward and cost design.

    Source: §III · p. 2, C. Preliminary Results · p. 3
  • Method

    OptLayer adds a fully differentiable constrained optimization layer that enforces arbitrary constraints on predicted robot actions and supports a compatible reward strategy.

    Source: §I · p. 1
  • Results

    The approach demonstrated 3D reaching with collision avoidance on an industrial manipulator in simulation and the real world, while real-world experiments accommodated reasonable environmental and task changes without dedicated training.

    Source: §VII · p. 8
  • Takeaways & Limitations

    Constrained optimization can be coupled with stochastic control policies for real-world reinforcement learning where safety is crucial.

    Source: §VII · p. 8

    Learning control policies from scratch may remain too time-consuming, and formalizing safety constraints can be difficult under dynamic model uncertainties or dependence on perception accuracy.

    Source: §VII · p. 8

Abstract

from arXiv · show

While deep reinforcement learning techniques have recently produced considerable achievements on many decision-making problems, their use in robotics has largely been limited to simulated worlds or restricted motions, since unconstrained trial-and-error interactions in the real world can have undesirable consequences for the robot or its environment. To overcome such limitations, we propose a novel reinforcement learning architecture, OptLayer, that takes as inputs possibly unsafe actions predicted by a neural network and outputs the closest actions that satisfy chosen constraints. While learning control policies often requires carefully crafted rewards and penalties while exploring the range of possible actions, OptLayer ensures that only safe actions are actually executed and unsafe predictions are penalized during training. We demonstrate the effectiveness of our approach on robot reaching tasks, both simulated and in the real world.

I. INTRODUCTION

The paper targets safe real-world reinforcement learning by constraining robot actions during exploration and execution. It introduces OptLayer, a differentiable optimization layer paired with a reward strategy, and evaluates the approach on simulated and real-world reaching with collision avoidance.

  • OptLayer enforces arbitrary safety constraints on neural-network-predicted robot actions through a fully differentiable optimization layer.Source: §I · p. 1
  • The method adds a simple reward strategy compatible with existing policy-optimization techniques.Source: §I · p. 1
  • The approach is demonstrated on 3D reaching with collision avoidance for an industrial manipulator in simulation and the real world.Source: §I · p. 1
  • Robot-control optimization can produce unsatisfactory policies when models are uncertain, constraints are overly conservative, or task dynamics are difficult to model.Source: §II · pp. 1–2
  • Real-world reinforcement learning requires safe exploration during training and safe execution at inference time.Source: §II · p. 2
  • Unconstrained reinforcement learning can involve unsafe actions and is highly sensitive to the reward and cost structure.Source: §I · p. 1, §III · p. 2

A. Reinforcement Learning Nomenclature

The paper formulates reinforcement learning through trajectories, value functions, and parameterized policies, then situates its method within TRPO-based policy optimization. The illustrated reacher setting uses target distance and collision-penalty terms in its reward description.

B. Motivating Example

The 2-DoF reaching task tests how collision penalties affect reinforcement-learning behavior in an obstacle-avoidance setting. Results show that reward design creates a trade-off between collision avoidance and exploration, motivating explicit safety constraints.

Environment

  • The 2-DoF robot must reach randomly sampled targets while avoiding a spherical obstacle in a planar environment.Episodes run for up to 200 steps with 0.01-second intervals, and actions specify joint-position increments.Source: B. Motivating Example · p. 3

Reward structure

  • The environment rewards target proximity and penalizes collisions, with collision penalties parameterized by βcoll ∈ {1, 5, 10, 50}.The implementation monitors both external and self-collisions while neural-network policies interact with the environment.Source: B. Motivating Example · p. 3, C. Preliminary Results · p. 3

Results

  • Reward evolution depends strongly on the collision-penalty weight.The comparison averages behavior across the tested penalty settings during training.Source: C. Preliminary Results · p. 3
  • With βcoll = 1, collision avoidance is never learned because the penalty rcoll = −20 is outweighed by reaching and proximity incentives.The resulting strategy may hit the obstacle to restart the episode and obtain proximity reward.Source: C. Preliminary Results · p. 3
  • With βcoll = 50, the penalty rcoll = −1000 reduces collisions but discourages exploration, leading the policy to remain near the start pose.The policy ignores further targets under this large penalty.Source: C. Preliminary Results · p. 3
  • βcoll = 5 and 10 yield comparable rewards, but βcoll = 10 produces half the number of collisions.These results underscore the sensitivity of learned behavior to reward construction and the difficulty of learning safety without violations.Source: C. Preliminary Results · p. 3

IV. CONSTRAINED OPTIMIZATION LAYER

OptLayer formulates action correction as a constrained quadratic program that projects neural-network predictions onto the set of safe actions. Its objective and constraints are made differentiable so the layer can participate in end-to-end training.

Optimization formulation

  • The quadratic program minimizes 1/2 x^T P x + q^T x subject to linear constraints.P and q define the objective, while G, h, A, and b define inequality and equality constraints.Source: A. OptLayer Architecture · p. 3

Pipeline

  • The architecture is presented as a constrained optimization pipeline for enforcing safety constraints on predicted robot actions.The paper also describes the layer as fully differentiable and applicable to arbitrary action constraints.Source: Figure 4 · p. 4

Optimization formulation

  • OptLayer seeks an action closest to the neural network’s prediction while satisfying linear equality and inequality constraints.The optimization uses a quadratic objective over action variables and constraints represented by matrix-vector systems.Source: A. OptLayer Architecture · pp. 3–4

Differentiability

Constraint representation

  • OptLayer accommodates robotic constraints that are constant, affine in state, auxiliary-variable dependent, or conditionally active.The exposition focuses on inequalities, while equality constraints are treated analogously.Source: B. Quadratic Program Initialization · p. 4

1) Objective matrices:

The objective matrix is constructed by expressing the distance between the optimized action and the neural-network prediction as a quadratic program. This yields an identity quadratic matrix and a linear term determined by the prediction.

Objective matrices

  • The optimization objective measures squared L2 distance between variables x and the predicted action eai.The objective keeps the corrected action close to the neural network’s output.Source: 1) Objective matrices · p. 4
  • Because eai does not depend on x, its constant quadratic term does not affect the optimum.The objective can therefore be written in the standard quadratic-program form with P = I_nx and q = −eai.Source: 1) Objective matrices · p. 4

Constraint construction

  • Joint-velocity limits become linear inequalities on the action hypothesis x = Δθi after approximating velocity by Δθi/ΔT.The resulting constraints use manufacturer-specified lower and upper velocity limits.Source: 2) Constant constraint matrices · p. 4
  • For joint-velocity limits, the constant constraint matrices are Gcst = [I_nx, −I_nx]^T and hcst = [ΔT θ̇max, −ΔT θ̇min]^T.These matrices remain constant throughout the robot’s motion.Source: 2) Constant constraint matrices · p. 4

3) Constraint matrices affine in the state vector:

The paper constructs state-dependent constraint matrices for joint positions and torques by expressing action limits through current states and auxiliary dynamics quantities.

5) Conditional constraint matrices:

Conditional constraints are activated only when state-dependent conditions hold, allowing collision avoidance requirements to enter the optimization selectively.

C. Quadratic Program Solving

OptLayer assembles always-active and conditional constraints into quadratic programs, solves them with a differentiable interior-point procedure, and outputs the feasible action closest to the network prediction.

Assembling constraint matrices for batch solving

Quadratic Program Solving

  • The implementation solves quadratic programs with an interior-point method using objective and constraint matrices P, q, G, h, A, and b.Source: 2) Iterative resolution · p. 5

Iterative resolution

Quadratic Program Solving

  • The solver iteratively updates primal, slack, and dual variables, using a constant k_max = 10 for batch solving because typical problems converge in about 5 iterations.Source: 2) Iterative resolution · pp. 5–6
  • The final output is the action a* closest to the initial prediction ea that satisfies all safety constraints.Source: 2) Iterative resolution · p. 6

V. CONSTRAINED REINFORCEMENT LEARNING

The constrained reinforcement-learning procedure executes OptLayer-corrected actions, quantifies violations of raw predictions, and uses those costs during training without executing unsafe actions.

Trajectory Sampling

  • OptLayer produces corrected actions a* for execution while retaining raw predictions ea to measure constraint violations.Source: A. Trajectory Sampling · p. 6
  • Equality and inequality violation costs quantify how much each unconstrained prediction violates the corresponding constraints.Source: A. Trajectory Sampling · p. 6
  • The total violation cost c = c_eq + c_in combines normalized equality and inequality contributions computed within OptLayer.Source: A. Trajectory Sampling · p. 6
  • BUILDTRAJ outputs states, raw predictions, rewards, values, corrected actions, and constraint violation costs for constrained or unconstrained execution modes.Source: A. Trajectory Sampling · p. 6

B. Policy Update Strategies

The paper evaluates four policy-update strategies that differ in whether they train on unconstrained predictions, corrected actions, or both. These strategies are applied to OptLayer-based 3D reaching with a 6-DoF manipulator in simulation and real-world settings.

Policy update strategies

  • The four strategies are Unconstrained Predictions (UP), Constrained-learn Predictions (CP), Constrained-learn Corrections (CC), and Constrained-learn Predictions and Corrections (CPC).CP trains on raw predictions after constrained execution; CC trains on corrected actions; CPC trains on both raw predictions with discounted rewards and corrected actions with original rewards.Source: B. Policy Update Strategies · p. 6
  • CPC first associates raw predictions with discounted rewards and then associates corrected actions with better rewards.This combines learning from the network’s original predictions with learning from the safe actions produced by OptLayer.Source: B. Policy Update Strategies · p. 6
  • CP treats OptLayer as part of the environment from the network’s perspective by updating the policy with raw predicted actions.The network is trained using raw predictions rather than corrected actions.Source: B. Policy Update Strategies · p. 6
  • CC trains directly on corrected actions, which can differ substantially from the neural network’s initial predictions.The paper attributes this distinction to the relationship between corrected actions and the stochastic policy being optimized.Source: B. Policy Update Strategies · p. 6

Experimental setting

B. Evaluating Policy Update Strategies

The evaluation compares unconstrained and constrained policy updates on simulated and real-world 3D reaching. OptLayer prevents collisions, while CPC reaches high reward in fewer simulated episodes and transfers to changing real-world conditions without dedicated training.

Simulation

  • 700 average reward is reached in 5350 episodes by UP, 4950 by CP, and 3250 by CPC.The comparison comes from training over 7000 episodes on the simulated 3D reaching task.Source: B. Evaluating Policy Update Strategies · p. 7
  • OptLayer ensures that collisions never happen for UP, CP, CC, and CPC during constrained training, whereas unconstrained training does not effectively learn collision avoidance.UP can learn to reach but still collides; CP achieves rewards comparable to UP while maintaining safety.Source: B. Evaluating Policy Update Strategies · p. 7, Figure 7 · p. 7
  • CPC reaches performance comparable to UP and CP with fewer episodes than either strategy.The paper attributes CPC’s faster learning to first training on raw predictions with discounted rewards before training on corrected actions.Source: B. Evaluating Policy Update Strategies · p. 7

Real-world experiments

  • On the real robot, CPC reaches a target while avoiding a balloon, unlike the unconstrained UP policy, which reaches the target but knocks the balloon down.The real-world setup also tests moving targets and moving obstacles.Source: C. Real-World Experiments · pp. 7–8
  • A CPC policy trained for a specific task follows a moving target without hitting the obstacle and moves away when a moving obstacle approaches.These tests illustrate behavior under changing target and obstacle conditions without dedicated training for the moving-target task.Source: C. Real-World Experiments · p. 8, Figure 8 · p. 8
  • The authors report that the system accommodates reasonable changes in environment and task conditions without dedicated training.The paper presents this as a result of the real-world robot experiments.Source: §VII · p. 8

Limitations

  • Learning control policies from scratch may remain too time-consuming even for simple tasks.The authors identify this as a current implementation limitation and propose investigating robotics-specific action-space exploration.Source: §VII · p. 8
Loading 1709.07643v2…