Novel Policy Seeking with Constrained Optimization
Abstract
In problem-solving, we humans tend to come up with different novel solutions to the same problem.
However, conventional reinforcement learning algorithms ignore such a feat and only aim at producing a set of monotonous policies that maximize the cumulative reward.
The resulting policies usually lack diversity and novelty.
In this work, we aim at enabling the learning algorithms with the capacity of solving the task with multiple solutions through a practical novel policy generation workflow that can generate a set of diverse and well-performing policies.
Specifically, we begin by introducing a new metric to evaluate the difference between policies.
On top of this well-defined novelty metric, we propose to rethink the novelty-seeking problem through the lens of constrained optimization, to address the dilemma between the task performance and the behavioral novelty in existing multi-objective optimization approaches, we then propose a practical novel policy-seeking algorithm, Interior Policy Differentiation (IPD), which is derived from the interior point method commonly known in the constrained optimization literature.
Experimental comparisons on benchmark environments show IPD can achieve a substantial improvement over previous novelty-seeking methods in terms of both novelties of generated policies and their performances in the primal task.
Introduction
In the sense of learning through interactions with the environment, the scheme of reinforcement learning (RL) is conceptually similar to the emergence of intelligence [1]: an agent explores and exploits information of a given environment, learns to master some certain skills through trials and errors to gain as much reward as possible.
When solving a problem, we humans could be creative to come up with multiple different solutions and gain insights from searching for diverse solutions.
e g., a self-containing example is the various approaches in RL research.
While the state-of-the-art algorithms have achieved superhuman performance in a variety of challenging tasks [2–6] the task of encouraging individualized diversity 3 of learned agents, on the other hand, is relatively under-explored.
Different from conventional RL agents that are only learned through interactions with the external environment, novel policy generation is a task considering the differentiation among individual policies.
The differentiation among policies can be explained as the social influence [7–11] in social science literature.
Although many works have been proposed applying social motivation to Multi-Agent Reinforcement Learning (MARL) settings [12–15], how to motivate a single RL agent to perform differently against existing agents is still an open question.
In previous attempts for novel policy generation, there are three main challenges: (1) heuristically defined metric for novelty estimation is computational expensive [16], (2) defining novelty reward for an entire episode yields additional challenge in credit assignment, and (3) solving the problem under
[Figure]
the formulation of multi-objective optimization leads to the performance decay in the original task.
Fig.
1 compares the policy gradients of three cases, namely the one without novel policy seeking, novelty-seeking with multi-objective optimization, and novelty-seeking with constrained optimization methods, respectively.
In this work we take into consideration not only the novelty of a set of learned policies but also the performance of those novel policies in the primal task, when addressing the problem of novel-policy-generation.
Our contributions can be summarized as follows:
Mathematically, we introduce a lightweight metric to compute the difference between policies with instant feedback at every timestep, to address the first two drawbacks of previous novel policy seeking methods discussed above; 2.
Practically, we propose a constrained optimization formulation for novel policy generation to avoid hindering the primal task performance while seeking cross-policy diversity.
We further design an efficient Novelty-Reward-Scale-Agnostic algorithm dubbed as IPD, resembling the interior point method in constrained optimization literature; 3.
Empirically, we evaluate IPD on several continuous control benchmarks to generate groups of diverse policies, showing the strengths of our constrained optimization solution for novelty-seeking can generate a series of diverse and well-performing policies, compared to previous multi-objective novel policy generation methods.
Related Work
Intrinsic motivation methods.
In previous work, different approaches are proposed to provide intrinsic motivation or intrinsic reward as a supplementary to the primal task reward for better exploration [18–22].
All those approaches use the weighted sum of two rewards, the primal rewards provided by environments and the intrinsic rewards provided by different heuristics.
On the other hand, the work of DIAYN and DADS [23, 24] learn diverse skills without extrinsic reward.
Those approaches focus on decomposing diverse skills of a single policy, while our work focuses on learning diverse behaviors among a batch of policies for the same task.
Diverse policy generation methods.
The work of Such et al.
shows that different RL algorithms may converge to different policies for the same task [25].
On the contrary, we are interested in learning different policies through a single algorithm with the capability of avoiding local optimum.
The work of Pugh et al.
establishes a standard framework for understanding and comparing different approaches to search for quality diversity (QD) [26].
Conti et al.
proposes a solution which avoids local optima as well as achieves higher performance by adding novelty search and QD to evolution strategies [27].
The Task-Novelty Bisector (TNB) [16] aims to solve novel policy generation problem by jointly optimize the extrinsic rewards and novelty rewards defined by an auto-encoder.
In this work, we first adopt TNB in the constrained optimization framework, resulting in Contrained TNB, to demonstrate the dilemma between the task performance and novelty pursuance.
Constrained Markov Decision Process.
The Constrained Markov Decision Process (CMDP) [28] considers the situation where an agent interacts with the environment under certain constraints.
Formally, the CMDP can be defined as a tuple ( S , A , γ, r, c, C, P, s 0 ) , where S and A are the state and action space; γ ∈ [0 , 1) is a discount factor; r : S ×
A × S → R and c : S ×
A × S → R denote the reward function and cost function; C ∈ R + is the upper bound of permitted expected cumulative cost; P ( ·| s, a ) : S ×
A → S denotes the transition dynamics, and s 0 is the initial state.
Denote the Markovian policy class as Π , where Π = { π : S ×
A → [0 , 1] , (cid:80) a π ( a | π ) = 1 } The learning objective of a policy for CMDP is to find a π ∗ ∈ Π , such that
[Equation]
where τ indicates a trajectory ( s 0 , a 0 , s 1 , ... ) and τ ∼ π represents the distribution over trajectories following policy π : a t ∼ π ( ·| s t ) , s t +1 ∼ P ( ·| s t , a t ); t = 0 , 1 , 2 , ... .
Previous literature provide several approaches to solve CMDP [29–32].
Methods
In Sec.3.1, we define a metric space that measures the difference between policies, which is the fundamental element for the proposed methods.
In Sec.3.2, we develop a practical estimation method for this metric.
Sec.3.3 describes the formulation of constrained optimization on novel policy generation.
The implementations of two practical algorithms are further introduced in Sec.3.4.
We denote the policies as { π θ i ; θ i ∈
Θ , i = 1 , 2 , ... } , wherein θ i represents parameters of the i -th policy, Θ denotes the whole parameter space.
In this work, we focus on improving the behavioral diversity of policies from PPO [33], thus we use Θ to represent Θ PPO in this paper.
It is worth noting that the proposed methods can be easily extended to other RL algorithms [34–37].
To simplify the notation, we omit π and denote a policy π θ i as θ i unless stated otherwise.
3.1 Measuring the Difference between Policies
In this work, we use the Wasserstein metric W p [38–40] to measure the distance between policies.
Concretely, in this work we consider the Gaussian-parameterized policies, where the W p over two policies can be written in the closed form W 22 ( N ( m 1 , Σ 1 ) , N ( m 2 , Σ 2 ))
=
||
m 1 − m
|| 2 + tr [Σ 1 + Σ 2 − 2(Σ 1 /
2 1 Σ 2 Σ 1 / 2 1 ) 1 / 2 ] as p
= 2 , where m 1 , Σ 1 , m 2 , Σ 2 are mean and covariance metrics of the two normal distributions.
In the following of this paper, we use D W to denote the W 2 and it is worth noting that when the covariance matrics are identical, the trace term disappears and only the term involving the means remains, i.e., D W = | m 1 − m 2 | for Dirac delta distributions located at points m 1 and m 2 .
This diversity metric satisfies the three properties of a metric, namely identity, symmetry as well as triangle inequality.
Proposition 1 (Metric Space (Θ , D qW ) ) .
The expectation of D W ( · , · ) of two policies over any state distribution q ( s ) :
[Equation]
is a metric on Θ , thus (Θ , D qW ) is a metric space.
The proof of Proposition 1 is straightforward.
It is worth mentioning that Jensen Shannon divergence
D JS or Total Variance Distance D TV [41, 42, 34] can also be applied as alternative metric spaces, we choose D W in our work for that the Wasserstein metric better preserves the continuity [40].
On top of the metric space (Θ , D qW ) , we can then compute the novelty of a policy as follows.
Definition 1 (Novelty of Policy) .
Given a reference policy set Θ ref such that Θ ref = { θ refi , i = 1 , 2 , ... } , Θ ref ⊂ Θ , the novelty U( θ | Θ ref ) of policy θ is the minimal difference between θ and all policies in the reference policy set, i.e.,
[Equation]
Consequently, to encourage the discovery of novel policies discovery, typical novel policy generation methods tend to directly maximize the novelty of a new policy, i.e., max θ U( θ | Θ ref ) , where the Θ ref includes all existing policies.
3.2 Estimation of D qW ( θ i , θ j ) and the Selection of q ( s )
In practice, the calculation of D qW ( θ i , θ j ) is based on Monte Carlo estimation where we need to sample s from q ( s ) .
Although in Eq.(2) q ( s ) can be selected simply as a uniform distribution over the state space, there remains two obstacles: first, in a finite state space we can get precise estimation after establishing ergodicity, but problem arises when facing continuous state spaces due to the difficulty of efficiently obtaining enough samples; second, when s is sampled from a uniform distribution q , we can only get sparse episodic reward instead of dense online reward which is more useful in learning.
Therefore, we make an approximation here based on importance sampling.
Formally, we denote the domain of q ( s ) as S q ⊂ S and assume q ( s ) to be a uniform distribution over
S q , without loss of generality in later analysis.
Notice S q is closely related to the algorithm being used in generating trajectories [43].
As we only care about the reachable regions of a certain algorithm (in this work, PPO), the domain S q can be decomposed by S q = lim N →∞ (cid:83) Ni =1 S
θ i , where
S θ
i denotes all the possible states a policy θ i can visit given a starting state distribution.
In order to get online-reward, we estimate Eq.(2) with
[Equation]
where we use ρ θ ( s ) to denote the stationary state visitation frequency under policy θ , i.e.
, ρ θ ( s ) =
P ( s 0 = s | θ )
+ P ( s 1 = s | θ ) + ...
+ P ( s T = s | θ ) in finite horizon problems.
We propose to use the averaged stationary visitation frequency as q ( s ) , e.g., for PPO, q ( s ) =
ρ ( s ) =
E θ ∼ Θ PPO [ ρ θ ( s )] .
Clearly, choosing q ( s ) =
ρ ( s ) will be much better than choosing a uniform distribution as the importance weight will be closer to 1 .
Such an importance sampling process requires a necessary condition that ρ θ i ( s ) and q ( s ) have the same domain, which can be guaranteed by applying a sufficient exploration noise on θ .
Another difficulty lies in the estimation of ρ ( s ) , which is always intractable given a limited number of trajectories.
However, during training, θ i is a policy to be optimized and θ j ∈ Θ ref is a fixed reference policy.
The error introduced by approximating the importance weight as 1 will get larger when θ i becomes more distinct from normal policies, at least in terms of the state visitation frequency.
We may just regard increasing of the approximation error as the discovery of novel policies.
Proposition 2 (Unbiased Single Trajectory Estimation) .
The estimation of ρ θ ( s ) using a single trajectory τ is unbiased.
The Proposition 2 follows the usual trick in RL that uses a single trajectory to estimate the stationary state visitation frequency.
Given the definition of novelty and a practically unbiased sampling method, the next step is to develop an efficient learning algorithm.
3.3 Constrained Optimization Formulation for Novel Policy Generation
In the traditional RL paradigm, maximizing the expectation of cumulative rewards is commonly used as the objective.
i.e., max θ ∈ Θ E τ ∼ θ [ g ] , where g = (cid:80) t =
γ t r t and τ ∼ θ denotes a trajectory τ sampled from the policy θ .
To improve the diversity of different agents’ behaviors, the learning objective must take both the reward from the primal task and the policy novelty into consideration.
Previous approaches [18–22] often directly use the weighted sum of these two terms as the objective:
[Equation]
where 0 < α < 1 is a weight hyper-parameter, g task is the reward from the primary task, and g int = (cid:80) t =
γ t r int ,t is the cumulative intrinsic reward of the intrinsic reward r int ,t .
In our case, the intrinsic reward is the novelty reward r int = min θ j ∈ Θ ref D ρW
( θ, θ j ) .
These methods can be summarized as Weighted Sum Reward (WSR) methods [17].
Such an objective is sensitive to the
1: Input: (1) a behavior policy θ old , (2) a set of previous poli- cies { θ j } Mj =1 , (3) a novelty metric
U ( θ, { θ j }| ρ ) =
U ( θ, { θ j }| τ ) =
min θ j D τW ( θ, θ j ) , (4) a novelty threshold r 0 and starting point t S . 2: Initialize θ old .
3: for iteration = 1 , 2 , ... do 4: for t = 1 , 2 , ..., T do 5:
Step the environment by tak- ing action a t ∼ θ old and collect transitions.
6: if U ( θ old , { θ j }| τ ) − r 0 < 0 AND t > t S then 7:
Break this episode.
8: end if 9: end for 10:
Update policy parameters based on sampled data.
11: end for
1: Input: (1-4) same as IPD, (5) a value network for cost V c . 2: Initialize θ old .
3: for iteration = 1 , 2 , ... do 4: for t = 1 , 2 , ..., T do 5:
Step the environment by taking action a t ∼ θ old and collect transitions.
6: end for 7:
Compute advantage of reward ˆ A r, 1 , ..., ˆ A r,T .
Compute advantage of cost ˆ A c, 1 , ..., ˆ A c,T .
Optimize objective for reward L CLIP r , with gradient g r = ∇ θ L CLIP r . 10:
Optimize objective for cost L CLIP c , with gradient g c = −∇ θ L CLIP c 11: if U ( θ old , { θ j }| τ ) − r 0 < 0 then 12:
Calculate ⃗p according to Eq.(7) with g r and g c 13: else 14:
Calculate ⃗p with g r 15: end if 16:
Update policy parameters 17: end for selection of α as well as the formulation of r int .
For example, in our case formulating the novelty reward r int as min θ j D ρW
( θ, θ j ) , exp [min θ j D ρW ( θ, θ j )] and − exp [ − min θ
j D ρW
( θ, θ j )] will lead to significantly different results as they determine the trade-offs in the two terms given α .
Besides, dilemma also arises in the selection of α : while a large α may undermine the contribution of intrinsic reward, a small α could ignore the importance of the primal task, leading to the failure of an agent in solving the task.
The crux of tackling such an issue is to deal with the conflict between different objectives.
The work of Zhang et al.
proposes the TNB, where the task reward is regarded as the dominant one while the novelty reward is regarded as subordinate [17].
However, as TNB considers the novelty gradient all the time, it may hinder the learning process.
Intuitively, well-performing policies should be more similar to each other than to random initialized policies.
As a new random initialized policy is different enough from previous policies, considering the novelty gradient at beginning of training will result in a much slower learning process.
In order to tackle the above problems and adjust the extent of novelty in new policies, we propose to solve the novelty-seeking problem under the perspective of constrained optimization.
The intuition is as follows: while the task reward is considered as a learning objective, the novelty reward should be considered as a bonus instead of another objective, thus should not impede the learning of the primal task.
Fig.
1 illustrates how novelty gradients impede the learning of a policy: at the beginning of learning, a random initialized policy should learn to be more similar to a well-performing policy rather than be different.
The seeking of novelty should not be taken into consideration all the time during learning.
With such an insight, we update the multi-objective optimization problem in Eq.(5) into a constrained optimization problem as:
[Equation]
where r 0 is a threshold indicating minimal permitted novelty, and r int ,t denotes a moving average of r int ,t .
as we need not force every single action of a new agent to be different from others.
Instead, we care more about the long-term differences.
Therefore, we use cumulative novelty terms as constraints.
Moreover, the constraints can be flexibly applied after the first t S timesteps (e.g., t S = 20 ) for the consideration of similar starting sequences, so that the constraints can be written as g t ( θ ) ≥ 0 , ∀ t = t S , ..., T .
3.4 Practical Novel Policy Generation Methods
One thing to note is that WSR and TNB proposed in the prior work [16] correspond to different approaches in constrained optimization problems, yet some important ingredients are missing.
We in this section adopt TNB according to the Feasible Direction Method in constrained optimization
[Figure]
and then propose our method of Interior Policy Differentiation (IPD), according to the Interior
Point Method in constrained optimization literature.
A detailed discussion on WSR is provided in
Appendix C.1.
TNB:
Feasible Direction Method The Feasible Direction Method (FDM) [44, 45] solves the constrained optimization problem by finding a direction ⃗p where taking gradient upon will lead to the increment of the objective function as well as constraints satisfaction, i.e., ∇ θ f T · ⃗p > 0 , if g >and ∇ θ g T · ⃗p > 0 otherwise.
The TNB proposes to use a revised bisector of gradients ∇ θ f and ∇ θ g as ⃗p ,
[Equation]
[Equation]
Clearly, Eq.(7) satisfies the constraints but it is more strict than it as the ∇ θ g term always exists during the optimization of TNB.
Based on TNB, we provide a revised approach, named Constrained
Task Novel Bisector (CTNB), which resembles better with FDM.
Specifically, when g > 0 , CTNB will not apply ∇ θ g on g .
It is clear that TNB is a special case of CTNB when the novelty threshold ris set to infinity.
We note that in both TNB and CTNB, the learning stride is fixed to be |∇ θ f | + |∇ θ g |and may lead to problem when ∇ θ f → 0 , where the final optimization result will rely heavily on the selection of g , i.e., the shape of g is crucial for the success of this approach.
We propose CTNB in our work, as a constrained optimization vairant of TNB, to demonstrate the importance of the constrained optimization perspective in novelty seeking, however, we do not in practice observe such a method achieves satisfactory performance.
IPD: Interior Point Method The Interior Point Method [46, 47] is another approach used to solve the constrained optimization problem.
Thus here we solve Eq.(6) using the Interior Policy
Differentiation (IPD), which can be regarded as an analogy of the Interior Point Method.
In the vanilla Interior Point Method, the constrained optimization problem in Eq.(6) is solved by reforming it to an unconstrained form with an additional barrier term − α log g ( θ ) in the objective as max θ ∈ Θ f ( θ ) − α log g ( θ ) , or more precisely in our problem with the formulation with Eq.(6) we have max θ ∈ Θ E τ ∼ θ [ g task − (cid:80)
Tt =
α log ( r int ,t − r 0 )] , where α > 0 is the barrier factor.
Besides the log barrier term, there are other choices like α 1 g ( θ ) can be used and the objective becomes max θ ∈ Θ f ( θ ) + α 1 g ( θ ) .
As α is small, the barrier term will introduce only minuscule influence on the objective.
On the other hand, when θ get closer to the barrier, the objective will increase rapidly.
The limits when α → 0 then lead to the solution of Eq.(6).
The convergence of such methods are provided in previous works [48, 49].
However, directly applying IPM is computationally expensive and numerically unstable.
In this work, we propose a simple yet novel heuristic method that resembles the idea of barrier methods: we implicitly apply such barrier terms by providing termination signals in interactions with the environments.
Our method can be regarded as revising the primal task MDP into a new one in which the behaviors of agents must satisfy novelty constraints.
Specifically, in the RL paradigm, the learning procedure of an agent is determined by the experiences collected during interactions with the environment and the sampling strategy used to filter experiences in the calculation of policy gradients.
[Figure]
Since the learning process is based on sampled transitions, a more natural way can thus be used to perform the constrained optimization.
We can simply bound the collected transitions in the feasible region by permitting previously trained M policies θ i ∈ Θ ref , i = 1 , 2 , ..., M sending termination signals during the training process of new agents.
In other words, we implicitly bound the feasible region by terminating any new agent that steps outside it.
Consequently, during the training process, all valid samples we collected are inside the feasible region, which means these samples are less likely to appear in previously trained policies.
At the end of the training, we obtain a new policy that has sufficient novelty.
In this way, we no longer need to consider the trade-off between intrinsic and extrinsic rewards deliberately.
The learning process of
IPD is thus more robust and no longer suffers from the objective inconsistency.
Remark 1 (Reward-Shaping-Agnostic Novelty Seeking) .
IPD is a gradient-free method with regard to the novelty reward.
Remark 1 is an important property that only IPD owns.
For other approaches, including both multi-objective approaches and constrained optimization approaches, an elaborated design of the novelty reward function is needed, e.g., it can be any monotonic increasing function of D ρW .
While it is well-known that reward shaping [50–52] is in general a non-trivial work that requires domain knowledge [53, 2–4, 6], such an additional novelty-reward term further increases the burden of proper reward design.
Differently, the seeking of novelty in IPD does not require any (policy) gradient information that flows from the novelty reward, therefore, the selection of reward scaling function is agnostic to the performance of IPD.
IPD learns to become novel in a passive manner, i.e., an episode will be terminated whenever the averaged step-wise novelty is lower than a given threshold.
Searching in a constant hyper-parameter space is at least tractable while searching in a monotonically increasing functional reward shaping class [16] is not – let alone IPD works well with a default novelty threshold parameter r
= averaged differences between PPO policies.
Experiments
According to Proposition 2, the novelty reward r int in Eq.(6) under our novelty metric can be unbiasedly approximated by r int = min θ j ∈ Θ ref D ρ θ W ( θ ( a | s t ) , θ j ( a j | s t )) .
We thus utilize this novelty metric directly throughout our experiments.
We apply different novel policy generation methods, namely WSR, TNB, CTNB, and IPD, to the backbone RL algorithm PPO [33].
The extension to other popular RL algorithms is straightforward.
More implementation details are depicted in Appendix C.
Experiments in the work of [43] show that one can simply change the random seeds before training to get policies that perform differently.
Therefore, we use PPO with varying random seeds as a baseline method for novel policy generation and use the averaged differences between policies learned by this baseline as the default threshold r 0 in CTNB and IPD.
Algorithm 1 and Algorithm 2 show the pseudo code of IPD and CTNB based on PPO, where the blue lines show the additional code added to the standard PPO.
Qualitative results can be found in Appendix D.
[Figure]
[Table]
[Figure]
4.1 The Four Reward Maze Problem
We first utilize a basic 2-D environment named Four Reward Maze as a diagnostic environment where we can visualize learned policies directly.
In this environment, four positive rewards of different values (e.g., +5 , +5 , +10 , +1 for top, down, left and right respectively) are assigned to four middle points with radius 1 on each edge in a 2-D N × N square map.
We use N = 16 in our experiments.
The observation of a policy is the current position and the agent will receive a negative reward of − 0 .
01 at each timestep except stepping into the reward regions.
Each episode starts from a randomly initialized position and the action space is limited to [ − 1 , 1] .
The performance of each agent is evaluated by the averaged performances over 100 trials.
Results are shown in Fig.
2, where the behaviors of the PPO agents are quite similar, suggesting the diversity provided by random seeds is limited.
WSR and TNB solve the novel policy generation problem from the multi-objective optimization formulation, they thus suffer from the unbalance between performance and novelty.
While WSR and TNB both provide sufficient novelty, performances of agents learned by WSR decay significantly, so did TNB due to an encumbered learning process, as we analyzed in Sec.3.3.
Both CTNB and IPD, solving the task with novelty-seeking from the constrained optimization formulation, provide evident behavior diversity and perform recognizably better than TNB and WSR.
4.2 The MuJoCo Benchmark
We evaluate our proposed method on three locomotion tasks [54, 55]: the Hopper-v3 (11 observations and 3 actions), Walker2d-v3 (11 observations and 6 actions), and HalfCheetah-v3 (17 observations and 6 actions).
Although relaxing the healthy termination thresholds in Hopper and Walker may permit more visible behavior diversity, all the environment parameters are set as default values in our experiments to demonstrate the generality of our method.
Comparison on Novelty and Performance We implement WSR, TNB, CTNB, and IPD using the same hyper-parameter settings per environment.
And we also apply CPO [29] as a baseline as a solution of CMDP.
For each method, we first train 10 policies using PPO with different random seeds.
Those PPO policies are used as the primal reference policies, and then we train 10 novel policies that try to be different from previous reference policies.
Concretely, in each method, the 1 st novel policy is trained to be different from the previous 10 PPO policies, and the 2 nd should be different from the previous 11 policies, and so on.
More implementation details are depicted in Appendix C.
Fig.
3 shows our experimental results in terms of novelty (the x-axis) and the performance (the y-axis).
Policies close to the upper right corner are the more novel ones with higher performance.
In all environments, the performance of CTNB, IPD and CPO outperforms WSR and TNB, showing the advantage of constrained optimization approaches in novel policy generation.
Specifically, the results of CTNB are all better than their multi-objective counterparts from TNB, showing the superiority of generating novel policies with constrained optimization.
In all experiments we use a linear novelty reward function, i.e., r int = min θ j D ρW
( θ, θ j ) .
We attribute the failure of CPO, TNB and CTNB in
Walker and HalfCheetah in finding novel policies to that their convergence behavior is fully controlled by the reward scaling function.
Whereas in IPD, there is no novelty-gradient controlled by such a scaling function.
Comparisons of the task-related rewards are carried out in Table 1, where among all the four methods,
IPD provides sufficient diversity with minimum loss of performance.
Instead of performance decay, we find IPD is able to find better policies in the environment of Hopper and HalfCheetah.
Moreover, in the Hopper environment, while the agents trained with PPO tend to fall into the same local minimum.
(e.g., they all jump as far as possible and then terminate this episode.
On the contrary, PPO with IPD keeps new agents away from falling into the same local minimum, because once an agent has reached some local minimum, agents learned later will try to avoid this region due to the novelty constraints.
Such property shows that IPD can enhance the traditional RL schemes to tackle the local exploration challenge [56, 57].
A similar feature brings about reward growth in the environment of HalfCheetah.
Success Rate of Each Method
In addition to averaged reward, we also use the success rate as another metric to compare the performance of different approaches.
Roughly speaking, the success rate evaluates the stability of each method in terms of generating a policy that performs as good as the policies PPO generates.
In this work, we regard a policy successful when its performance achieves at least as good as the median performance of policies trained with PPO.
To be specific, we use the median of the final performance of PPO as the baseline, and if a novel policy, which aims at performing differently to solve the same task, surpasses the baseline during its training process, it will be regarded as a successful policy.
By definition, the success rate of PPO is 0 .
5 as a baseline for every environment.
Table 1 shows the success rate of all the methods.
The results show that all constrained novel policy generation methods (CTNB, IPD, CPO) can surpass the average baseline during training, while the multi-objective optimization approaches normally can not.
4.3 Novel Policy Generation without Performance Decay
Multi-objective formulation of novel policy generation has the risk of sacrificing the primal performance as the overall objective needs to consider both novelty and primal task rewards.
On the contrary, under the perspective of constrained optimization, there will be no more trade-off between novelty and final reward as the only objective is the task reward.
Given a certain novelty threshold, the algorithms tend to find the optimal solution in terms of task reward under constraints, thus the learning process becomes more controllable and reliable, i.e., one can utilize the novelty threshold to control the degree of novelty.
The proper magnitude of the novelty threshold leads to more exploration among a population of policies, thus the performance of latterly found policies may be better than or at least as good as those trained without novelty seeking.
However, when a larger magnitude of novelty threshold is applied, the performance of found novel policies will decrease because finding a feasible solution will get harder under more strict constraints.
Fig.
4 shows experimental results on adjusting the thresholds, which supports our intuition.
Conclusion
In this work, we rethink the novel policy seeking problem under the perspective of constrained optimization.
We first introduce a new metric to measure the distances between policies, on top of which we define the novelty of a policy.
Based on our formulation of constrained optimization, we provide practical algorithms for constrained novel policy learning, we evaluate several constrained policy optimization methods: namely the CPO, Constrained TNB, and the Interior Policy Differentiation (IPD) proposed in this work.
Our experimental results demonstrate IPD, as a novelty (policy) gradient-free approach, can effectively learn various well-performing yet diverse policies, outperforming previous multi-objective methods, as well as constrained optimization baselines.
A Missing Proofs A.1 Proof of Proposition
Definition 2.
A metric space is an ordered pair ( M, d ) where M is a set and d is a metric on M , i.e., a function d : M × M → R such that for any x, y, z ∈ M , the following holds:
d ( x, y ) ≥ 0 , d ( x, y )
=
⇔ x = y , 2.
d ( x, y ) =
d ( y, x ) , 3.
d ( x, z ) ≤ d ( x, y ) + d ( y, z ) .
The first two properties are obviously guaranteed by D ρW .
As for the triangle inequality,
E s
[Equation]
( s ) [ D
[Equation]
( θ i ( s ) , θ k
( s )]
=
E s ∼ ρ ( s ) [ |A| (cid:88) l
= | θ i ( s ) − θ k
( s ) | ] =
E s ∼ ρ ( s ) [ |A| (cid:88)
l
= | θ i ( s ) − θ j
( s ) + θ j ( s ) − θ k
( s ) | ] ≤ E s ∼ ρ ( s ) [ ( |A| (cid:88) l
= | θ i ( s ) − θ j ( s ) | + | θ j ( s ) − θ k
( s ) | )]
=
E s ∼ ρ ( s ) [ |A| (cid:88) l
= | θ i ( s ) − θ j ( s ) | ] + E s ∼ ρ ( s ) [ |A| (cid:88) l = | θ j ( s ) − θ k
( s ) | ] =
E s ∼ ρ ( s ) [ D W ( θ i ( s ) , θ j ( s )]
+ E s ∼ ρ ( s )
[ D W ( θ j ( s ) , θ k
( s )]
B Proof of Proposition
ρ θ ( s ) =
P ( s 0 = s | θ )
+ P ( s 1 = s | θ ) + ...
+ P ( s T = s | θ )
L.L.N. = lim N →∞ (cid:80) Ni
=
I ( s
= s | τ i )
N + (cid:80) Ni
=
I ( s 1 = s | τ i )
N + ... + (cid:80) Ni =
I ( s T = s |
τ i )
N = lim N →∞ (cid:80)
Tj =0 (cid:80) Ni =
I ( s j = s | τ i )
N ρ θ ( s ) =
N (cid:88) i =
T (cid:88)
j =
I ( s j = s | τ i )
N
E [ ρ θ ( s ) − ρ θ ( s )] =
C Implementation Details C.1 More Details on WSR
WSR: Penalty Method The Penalty Method considers the constraints of Eq.(6) by putting constraint g ( θ ) into a penalty term, followed by solving the following unconstrained problem in an iterative manner,
[Equation]
The limit of the above unconstrained problem when α → 0 then leads to the solution of the original constrained problem.
As an approximation, WSR chooses a fixed weight α , and uses the gradient of ∇ θ f + 1 − αα ∇ θ g instead of ∇ θ f + 1 − αα ∇ θ min { g ( θ ) , 0 } , thus the final solution will intensely rely on the selection of α .
C.2 Calculation of D W
We use deterministic part of policies in the calculation of D W , i.e., we remove the Gaussian noise on the action space in PPO and use D W ( a 1 , a 2 ) = | a 1 − a 2 | .
C.3 Network Structure
We use MLP with 2 hidden layers as our actor models in PPO.
The first hidden layer is fixed to have 32 units.
We choose to use 10 , 64 and 256 hidden units for the three tasks respectively in all of the main experiments, after taking the success rate, performance and computation expense (i.e. the preference to use less unit when the other two factors are similar) into consideration.
C.4 Training Timesteps
We fix the training timesteps in our experiments.
The timesteps are fixed to be 1 M in Hopper-v3, 1 . 6 M for Walker2d-v3 and 3 M for HalfCheetah-v3.
D Visualize Diversity D.1 Mujoco Locomotion
In this section, we provide some qualitative results of IPD on the Mujoco locomotion tasks.
In all of our experiments we use the vanilla Mujoco locomotion benchmarks, with the default settings on defining healthy states.
Although otherwise the visualization of learned policies might become more diverse (e.g., a Hopper agent may learn to stand-up after falling down while another agent may learn to move forward on the ground if we set the z -axis healthy threshold as 0 ).
With the method of IPD, the Hopper policies (Figure 5) learns to jump further and avoids falling down rather instead of just jumping and falling down (Figure 6).
In the Walker2d environment, the color of purple indicates the left leg is visible.
It can be seen that the IPD policies (Figure 7) learn to use both left and right legs in walking, while the PPO policies usually learn jumping.
(Figure 8).
In
HalfCheetah, the IPD policies (Figure 9) perform much better than the PPO policies (Figure 10).
The
IPD policies leran to run with head-downward (Figure 9 line 1), head-upward (Figure 9 line 3), and forward (Figure 9 line 5) while the PPO policies are always
[Table]
In Hopper and HalfCheetah, IPD is able to improve the primal task performance by avoiding always getting trapped in some certain sub-optimal behaviors.