{'fraction_non_alphanumeric': 0.028509105666311572, 'fraction_numerical': 0.007152640389590625, 'mean_word_length': 4.632571428571429, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Curiosity Based Reinforcement Learning on Robot Manufacturing Cell

This paper introduces a novel combination of scheduling control on a flexible robot manufacturing cell with curiosity based reinforcement learning. Reinforcement learning has proved to be highly successful in solving tasks like robotics and scheduling. But this requires hand tuning of rewards in problem domains like robotics and scheduling even where the solution is not obvious. To this end, we apply a curiosity based reinforcement learning, using intrinsic motivation as a form of reward, on a flexible robot manufacturing cell to alleviate this problem. Further, the learning agents are embedded into the transportation robots to enable a generalized learning solution that can be applied to a variety of environments. In the first approach, the curiosity based reinforcement learning is applied to a simple structured robot manufacturing cell. And in the second approach, the same algorithm is applied to a graph structured robot manufacturing cell. Results from the experiments show that the agents are able to solve both the environments with the ability to transfer the curiosity module directly from one environment to another. We conclude that curiosity based learning on scheduling tasks provide a viable alternative to the reward shaped reinforcement learning traditionally used.


I. INTRODUCTION
Reinforcement Learning (RL) is becoming a popular algorithm to solve complex games and tasks like Atari [1], physics simulation [2], Go [3] and Chess [4], Robotics [5], and optimization problems [6] etc. In these approaches, the RL agent is given a continuous supply of dense extrinsic reward by the environment for the action it takes. While providing a reward or defining a reward function is not a problem in common gaming tasks, it quickly becomes cumbersome in complex engineering tasks like the optimization problem [7]. And traditionally when the rewards are not directly available, they need to be shaped to guide the agent in the direction of an optimal solution. This approach creates three problems: one, this introduces a huge inductive bias in the reward scheme that it cripples the generalized learning of the RL agent from the start. So much so that it might be only able to solve in the known solution space; two, reward shaping is a notoriously difficult engineering problem, where un-optimized rewards could break the learning process or provide only sub-optimal solutions; and finally, it creates solutions which cannot be transferred to new environments, since the rewards have been heavily tuned for a particular environment. In this paper, we propose to apply curiosity based learning to a flexible Robot Manufacturing Cell.
In [8], a Robot Manufacturing Cell (RMC) was proposed as an optimization problem similar to the scheduling problems encountered in the production planning. And in [9], the same RMC was solved using central and distributed advantage actor critic (A2C), through hand engineered reward signals. Similar reward shaping methods are also followed in [10] [11] [12], where rewards for each of the scheduling problem is hand engineered to suit the environment they work in. This obviously creates a problem of non-generalized solutions, where the learning of an agent from one environment is not transferable to an another, even though they both solve similar optimization problems.
To overcome this limitation of the reinforcement learning application in engineering problems, in this paper we apply curiosity [13] to the RMC environment. Curiosity uses the intrinsic motivation of the agent to create rewards based on the surprise factor of the agents familiarity with the environment states. Through the application of curiosity in reinforcement learning of the RMC we overcome all the problems stated above. The main contributions of this paper as follows: • We propose curiosity as an effective tool to eliminate the inductive bias induced by the reward shaping normally used in reinforcement learning of scheduling tasks. Further, curiosity eliminates complex reward shaping for engineering tasks like scheduling. • We show that a direct transfer of the reward function from one manufacturing environment to another is possible without any tuning requirements. • We combine curiosity with gradient monitoring, an effective approach to stabilize training. We apply the curiositybased RL to two multi-robot environments where we particularly show the improvements achieved by the proposed approach in both environments.
The paper is organized as follows. Section II introduces the learning problem, RMC, in detail, describing the operations and setup. Section III introduces the RL algorithms used in this paper along with further optimizations that were used, while Section IV, Section IV-A, and Section IV-B explain the curiosity module along with other optimizations used. Section V describes the results that were achieved on the RMC through the application of the RL along with its optimizations, while Section VI provides the conclusion with future scope of work.

II. ROBOT MANUFACTURING CELL
In this paper, RL model is applied to a cooperative selflearning RMC [8]. The RMC consists of two industrial robots, an Adept Cobra i600 SCARA-robot and an ABB IRB1400 6-DOF-robot, both of which share a common work platform as shown in Figure 1. The setup has six stations totally, two input stations (IB1, IB2), three processing or work stations (M1, M2, M3) and one output station (OB). There are two different types of work-piece in this system (WP-1, WP-2). The WP-1 goes through IB1, M1, M2, M3, and then OB, while WP-2 goes through IB2, M2, M1, M3 and then OB. Both the robots have their own proprietary control software. Hence a supervisory Siemens Programmable Logic Control (PLC) system is developed to control and coordinate the robot movement. Two experiments are conducted to demonstrate the applicability of the curiosity based approach on scheduling problems. The first experiment is conducted on a simple structured Robot Manufacturing Cell (sRMC) environment, similar to [9] and the second experiment is conducted on a graph-network based Robot Manufacturing Cell (gRMC) environment, which was developed in [14]. gRMC is a scalable variant of the sRMC environment, where the machines and the buffers are represented by the nodes of a graph while the connections between them are expressed as edges. A workpiece is transported between the nodes when the edge is activated. In sRMC no buffers are considered for the processing stations environment, i.e., there is no queue in front or after the processing stations. The RL agent's actions here are the movements of the work-pieces between the processing stations. While in gRMC three buffer-stations are considered, one after each of the processing stations (MB1, MB2, MB3) as shown in Figure 2. Here the agent's action is the activation of the edges connecting the nodes. If a node is activated then the work-piece is moved from the 'from'-node to the 'to'-node. Two different types of edges are defined in the system, to move the different work-pieces. Both the work-pieces are embedded with the RFID chip which gives the required information to the robots.

III. REINFORCEMENT LEARNING
RL is a field of machine learning where an agent is trained to take a sequence of decisions on an environment, modeled as a Markov Decision Process (MDP), to maximize the cumulative reward signal. The RL system has two major components namely, the agent and the environment. The agent interacts with the environment, takes an action a t based on the agent's policy π(a t |s t ) from its current state s t and moves to a new state s t+1 . Based on the action taken by the agent, the environment sends a reward signal r t to the agent. The goal of the agent is to find an optimal policy that maximizes the cumulative reward [15]. Hence, the agent tries to maximize the expected return E[R t |π] with the discounted reward given by R = t γ t r t and discount factor 0 ≤ γ ≤ 1. The MDP is defined by the tuple (S, A, P, R, p 0 ), with the set of states S, the finite set of actions A, a transition model P for a given state s and an action a, the reward function R : S × A × S → R, which provides a reward r for each state transition s t → s t+1 with an initialization probability p 0 .
The policy is defined using either value based methods or policy gradient methods. Value based methods use either The policy is then defined by an − greedy strategy where greedy actions are given by π(a|s) = argmax(q(s, A)), where the agent exploits, or a non-greedy action is given, where the agent explores. In policy gradient methods, a parameterized policy, π(a|s, θ), is used to take action. The policy can still be improved using value functions as seen in [1]. The the agent's objective is to derive an optimal policy, π * (a|s), that maximizes the reward collection. Correspondingly, the policy is updated in a way to maximize a cost function J(θ t ) given by, where θ is the policy parameters of π and ρ is the learning rate.
A. Advantage Actor Critic (A2C): Advantage Actor Critic is a policy gradient algorithm which combines policy gradient method with value based approach like SARSA [15]. In A2C, the actor tries to find the optimal policy and the critic evaluates the actor's policy. Here, the actor refers to the policy π(a|s, θ 1 ) and the critic refers to the value function ν(s, θ 2 ), where θ 1 is the parameter of the actor and the θ 2 is the parameter of the critic. The cost function equation of the A2C is given by Eqn. 2 and 3 respectively.

IV. CURIOSITY DRIVEN LEARNING
Children often learn through intrinsic motivation such as curiosity. Psychologists define a behavior as intrinsically motivated when a human works for his own sake. Similarly, intrinsic motivation in RL keeps an agent engaged in the exploration of new knowledge and skills when the rewards are rare [16]. There are lots of approaches to develop the intrinsic reward of an agent like prediction error, prediction uncertainty, or development of the forward model trained along with the policy of an agent [17]. These approaches drive the agent to explore the environment in the absence of a dense extrinsic reward. In this paper, we use prediction error as the intrinsic reward, which is produced by the agent itself with a model called Intrinsic Curiosity Model (ICM). ICM is composed of two subsystems: an inverse dynamic model that produce an intrinsic reward signal and forward dynamic model that outputs a sequence of actions which guides the agent to maximize the reward signal [13]. Figure 3 represents the schematic architecture of the ICM. The ICM encodes the current state s t and the next state s t+1 into the feature of current state φ(s t ) and feature of next state φ(s t + 1). The feature of current state φ(s t ) and the feature of next state φ(s t + 1) are trained with inverse dynamic model that predicts actionâ t [13]. Mathematically, this transition can be represented as,â t = g(s t , s t+1 ; θ I ) where g is a soft-max distribution function of all possible actions that could be taken and θ I is the neural network parameter. The loss function of the inverse dynamic model can represent by the following, where L I the loss function that calculates the deviation between the actual action a t and the predicted actionâ t . The forward dynamic model takes φ(s t ) and action a t as the inputs and outputs the predicted feature representation φ(a t+1 ) of next state s t+1 . The forward dynamic model can be represented by the following, where f is the learned function and θ F is the ICM neural network parameter. The loss function of the forward model is given below: where L F is the loss function that calculates the variance between the predicted feature representation of next statê φ(a t+1 ) and the actual predicted feature of next state φ(s t +1). So, the intrinsic reward r i t can be calculated as: where η > 0 is the scaling factor of the intrinsic reward signal. The intrinsic reward is generated by the agent at time t. Besides intrinsic rewards, the agent may also get extrinsic reward r e t from the environment. To generate the intrinsic reward signal and to optimize the ICM, the inverse dynamic model and forward dynamic model loss should be combined. So, the overall optimization problem of ICM that helps the agent to learn can be represented as: where 0≤β≤1 is a scaling factor that weights the inverse model against the forward model, and λ > 0 is a scaling factor of policy gradient loss against the intrinsic reward [13]. In this paper, to speed up the learning process of the RL agents two optimization techniques called Gradient Monitoring and Curriculum Learning are used. They are explained further below.

A. Gradient Monitoring
RL has a non stationary learning problem. This makes ensuring stability in learning a critical part of RL. In this paper an optimization method called Gradient Monitoring (GM) is used to stabilize the RL training of the RMC environments. GM provides for a faster convergence and better generalization performance of the trained RL agent, for a small computational overhead, by steering the gradients during the learning process towards the most important weights. The added benefit of using GM is that it allows for a continuous adjustment of the neural network's utilization capacity, i.e., the size of the neural network need not be tuned with as much care since GM automatically derives the required size of the neural network required for the training process [18].

B. Curriculum Learning
Humans learn things efficiently, when the tasks are organized in such a way that the complexity levels increase gradually. This strategy is called Curriculum Learning (CL). CL is a training process where the criterion of the training process is co-related with different set of weights. It is a form of re-weighting of the training distribution. At the beginning, the associated weights represent the simpler task, that can be learned most easily. The next training criterion involves a small change in the weighting of task that increases the probability of sampling slightly more complex task. At the end, the re-weighting of the tasks is uniform, and the final target is trained [19]. In RL, sometimes it becomes difficult for the RL agent to handle complex tasks directly and to solve this problem CL technique is used.

V. EXPERIMENTAL RESULTS
In this paper, two experiments are conducted. First sRMC is solved using ICM and CL, since the final task of planning of 20 WP-1 and 20 WP-2 was too difficult for the agent. Then in the same experiment, GM is introduced which helps the agent to converge without the use of CL. Next in the second experiment, the ICM used in sRMC is used in the gRMC environment. Here, only CL is used since the overhead GM did not provide a corresponding gain. The results thence obtained are discussed below in two parts based on their environment, sRMC and gRMC. The parts output in each of the case is reported, along with the rewards collected by in setup.

A. sRMC:
In this section, first the results of curriculum learning without gradient monitoring approach in sRMC environment is discussed. The result in parts output, WP-1 and WP-2, with respect to iterations is shown in Figure 4. Here, the target is 20 work-pieces for each agent. Initially, without the additional optimizations the agents were able to solve only seven workpieces each as opposed to the target of 20 each. Hence, CL was introduced to divide the final target into smaller targets of increasing difficulty, i.e. target of 5, 10, 15, and 20 workpieces of WP-1 and WP-2. Both the agents are trained for 1e 5 To increase the convergence speed of the agents, GM was introduced into the agent learning the sRMC environment. The improvement posed by GM was good enough to remove the CL completely from the training regime of sRMC environment. This quickened the learning progress as shown in Figure 4. A target of 20 work-pieces for each agent was set directly rather than dividing the targets into smaller tasks. The agents solved the target directly in 5e 3 steps compared to the 0.78e 5 without GM. With this, the objective of training the agents on the sRMC environment was completed. The results graph shows an interesting trend. Figure 6 shows the combined, intrinsic and extrinsic, rewards collected by the agents. The rewards graph can be used to describe the agent's learning behavior. Normally, in extrinsic reward-based RL algorithm, the slope of the reward curves becomes zero after reaching a solution. But the intrinsic reward-based system works differently. When the agent remains curious about completing the target, it generates the intrinsic reward by itself. But once the agent finishes exploring its environment and finds the an optimal policy, the agent remains no more curious and loses its motivation, hence receives less reward for the same task. That means, intrinsic rewards obviously reduce once the agent has converged. This is illustrated in the Figure 6, where after the iteration number 1e5, the rewards collected reduces. The next objective is to transfer the ICM incorporated here in to another environment without any architectural changes.

B. Graph network based curriculum learning:
In the next experiment, the intrinsic curiosity module is plugged to train the agents on gRMC. The learning process was a lot more difficult in this setup. This difficulty was also Figure 7. Parts Output (gRMC without gradient monitoring) noted in the reward shaping method, where the agent did not converge in regular training. Hence, first CL was introduced in to the training regime. The agent's target in curriculum learning was designed keeping in mind the difficulty i.e., targets of 1, 2, 3, 4, etc., were used. The agent solved the targets until a target of seven work-pieces each as shown in Figure V-B, although the training times were extremely high. Another optimization trial using GM produced similar results, but instead increased the training times marginally. This could be because of the complex nature of the gRMC interaction and the higher size of the action space. When looking at Figure V-B though, the agent starts exploring the environment from its early stage and the agent reaches to the peak of exploration faster compared to sRMC. When the agent learns to solve its target, the curiosity of the agent reduces, and this leads to a reduction of further exploration of the environment. In addition to that, the combined rewards collection by the agent in gRMC is much more higher compared to the sRMC. The objective of solving the a different environment like gRMC using the same architecture of ICM as used in sRMC is achieved.

VI. CONCLUSION
RL on industrial scheduling problems are difficult to train because of the inherent bias related to hand tuned rewards. A novel combination of the flexible RMC and a curiosity based RL has been proposed in this study. We found that the application of the curiosity based RL provides good solutions even with very scarce external reward. Additionally, we found that the reward function architecture used in one environment could be easily transferred to another, which was is impossible in hand tuned rewards. In future work, we plan to improve the performance of the agent by using a hybrid reward function providing rewards with little inductive bias for a quicker initial learning but with enough generalized performance. This combined with a gRMC with a custom message passing network could provide highly generalized solutions that can be directly transferable from one robot to another.