Learning device, learning method and learning program
The learning device addresses the challenge of behavioral safety in reinforcement learning by using a convex optimization problem with gradient functions to ensure safe actions through forward and backpropagation, stabilizing behavior in reinforcement learning.
Patent Information
- Application Number
- JP2023050157
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-03-27
- Publication Date
- 2024-10-09
- Estimated Expiration
- 2043-03-27
AI Technical Summary
Reinforcement learning in real systems faces challenges in ensuring behavioral safety due to the complexity of neural networks, making it difficult to adjust parameters for safe actions, and existing methods like convex optimization problems do not guarantee the optimal solution is found early in the learning process.
A learning device that includes a processor and storage device, which trains a neural network by generating a convex optimization problem with a gradient function for parameter updates, ensuring safe actions through a process of forward and backpropagation to calculate safety indices.
Guarantees the stability of behavior in reinforcement learning by ensuring the optimal solution to convex optimization problems is found, thus ensuring safe actions are taken.
Smart Images

Figure 2024139283000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to a learning device, a learning method, and a learning program for performing learning. [Background technology]
[0002] Reinforcement learning is a machine learning method that learns a policy to accomplish a task through interactions with the environment. In conventional reinforcement learning, the policy is mainly represented by a neural network, and the policy is learned by adjusting the parameters of the neural network.
[0003] In recent years, there has been a lot of attention on applying reinforcement learning to real systems. However, one problem with applying it to real systems is that the complexity of neural networks makes it difficult to adjust parameters to ensure the safety of actions.
[0004] Specifically, because neural networks have many complex parameters, it is difficult to learn strategies for determining appropriate behavior (parameter adjustment), and it is even more difficult to adjust the parameters to act appropriately and safely.
[0005] The safety of an action means not engaging in risky behavior. For example, while driving a car below the legal speed limit may be an appropriate behavior, if turning a corner at that speed is dangerous, the safety of the action is not guaranteed.
[0006] One of the difficulties in adjusting parameters to ensure the safety of actions is that it is technically difficult to formulate safety, making it impossible to set safety indicators for AI (Artificial Intelligence).
[0007] For this reason, a technique is disclosed in which a convex optimization problem is generated during learning and the result of solving the convex optimization problem is set as an index, as in Non-Patent Document 1. Non-Patent Document 1 discloses an approach to differentiation by a controlled convex program, which is a subclass of convex optimization problem used by domain-specific languages (DSLs) for convex optimization.
[0008] In Non-Patent Document 1, safety is formulated as a convex optimization problem that satisfies constraint conditions. In other words, the solution of the convex optimization problem is an index indicating safety. In conventional reinforcement learning, the reward is set as an index to be maximized, but when Non-Patent Document 1 is applied to conventional reinforcement learning, the reward and safety indexes are maximized. Therefore, the parameters of the neural network are updated in a direction that ensures safety, making it possible to adjust the parameters that ensure safety.
[0009] Furthermore, claim 2 of the following Patent Document 1 states, "The computer-implemented method of claim 1 comprises performing an optimization analysis to generate an optimization output, and compiling a command sequence using the optimization output, where the optimization analysis uses (i) a convex optimization solver, (ii) data representing the target state, and (iii) data representing each of the sets of responses, whereby the microwave oven executes the command sequence to heat the item to near the target state," and paragraph
[0098] states, "The training data can be used to train a neural network according to an approach in which a loss function is iteratively minimized according to a stochastic gradient descent evaluation." [Prior art documents] [Patent documents]
[0010] [Patent Document 1] Special Publication No. 2019-519744 [Non-patent literature]
[0011] [Non-Patent Document 1] Agrawal, Akshay, et al, "Differentiable convex optimization layers," 2019. Summary of the Invention [Problem to be solved by the invention]
[0012] When training a neural network by including the results of a convex optimization problem in its indices, the training procedure is as follows: (1) first, forward propagation is performed, in which a convex problem is generated from the input data, solved, and an indices are output; and (2) back propagation is then performed, in which the gradient is calculated in reverse order from the output indices and trained.
[0013] However, when Non-Patent Document 1 is applied to reinforcement learning, the optimal solution of the convex optimization problem (the best solution among the allowable solutions that satisfy all constraint conditions) is not necessarily obtained in the early stage of learning. The convex optimization problem for calculating safety has very strict constraint conditions, so the optimal solution is not easily obtained. Since the backpropagation calculation cannot be performed unless the optimal solution is obtained, Non-Patent Document 1 is not suitable for use in reinforcement learning.
[0014] Furthermore, Patent Document 1 does not mention solving a convex optimization problem including a gradient function related to the parameter update policy of the neural network in training the neural network, and therefore reinforcement learning with guaranteed safety cannot be performed when an optimal solution to a convex optimization problem cannot be obtained.
[0015] The present invention aims to guarantee the stability of actions in reinforcement learning and to guarantee the stability of actions in convex optimization problems. [Means for solving the problem]
[0016] A learning device according to one aspect of the invention disclosed in the present application has a processor that executes a program and a storage device that stores the program, and is a learning device for training a neural network that learns a strategy for improving a first index, wherein the processor executes the following processes: generating a convex optimization problem including a gradient function related to an update policy for parameters included in the neural network based on information about the neural network; generating a second index related to the strategy based on the convex optimization problem; and updating the parameters included in the neural network based on the first index and the second index. Effect of the Invention
[0017] According to a representative embodiment of the present invention, it is possible to guarantee the stability of actions in reinforcement learning and to guarantee the stability of actions in a convex optimization problem. Problems, configurations, and effects other than those described above will become clear from the following description of the embodiments. [Brief description of the drawings]
[0018] [Figure 1] FIG. 1 is a block diagram illustrating an example of a hardware configuration of a learning device. [Diagram 2] FIG. 2 is a block diagram illustrating an example of a functional configuration of the learning device. [Diagram 3] FIG. 3 is an explanatory diagram showing an example of general forward propagation and backward propagation. [Figure 4] FIG. 4 is an explanatory diagram showing an example of forward propagation and backward propagation in the convex optimization unit. [Diagram 5] FIG. 5 is a diagram illustrating an example of a matrix class. [Figure 6] FIG. 6 is an explanatory diagram showing a forward propagation execution example 1 executed by the forward propagation execution unit. [Figure 7] FIG. 7 is an explanatory diagram showing matrix data of a variable matrix. [Figure 8] FIG. 8 is an explanatory diagram illustrating a second forward propagation execution example executed by the forward propagation execution unit. [Figure 9] FIG. 9 is an explanatory diagram showing matrix data of a variable matrix and a constant matrix. [Figure 10A] FIG. 10A is a flowchart illustrating an example of a question generation processing procedure by the question generator. [Figure 10B] FIG. 10B is an explanatory diagram showing an example of a closed loop system. [Figure 11] FIG. 11 is a flowchart illustrating an example of a standard form conversion process procedure performed by the standard form converter. [Figure 12] FIG. 12 is an explanatory diagram showing an example of a solution update algorithm. [Figure 13] FIG. 13 is an explanatory diagram showing forward propagation and backward propagation for updating the variable matrix X. [Figure 14] FIG. 14 is a flowchart illustrating an example of an optimization procedure performed by the optimization unit. [Figure 15] FIG. 15 is a flowchart illustrating an example of a procedure of the solution conversion process performed by the solution conversion unit. [Figure 16] FIG. 16 is a flowchart illustrating an example of an index calculation process procedure performed by the index calculation unit. [Figure 17] FIG. 17 is a flowchart illustrating an example of a policy improvement processing procedure performed by the policy improvement unit. [Figure 18] FIG. 18 is a flowchart illustrating an example of detailed processing steps of the policy neural network update process (step S1702) illustrated in FIG. [Figure 19] FIG. 19 is a flowchart illustrating a detailed example of the process steps of the value function neural network update process (step S1703) illustrated in FIG. [Figure 20] FIG. 20 is an explanatory diagram showing an example of the input screen. [Figure 21] FIG. 21 is an explanatory diagram showing an example of the output screen. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0019] <Convex optimization problem> Convex optimization problems are explained using semidefinite programming as an example. Semidefinite programming is a type of convex optimization problem on a convex cone made up of all semidefinite matrices. Semidefinite programming is expressed by the primal problem (A) and dual problem (B) in the following formula (1).
[0020]
number
[0021] In the primal problem (A), C∈S n is a constant matrix, and we show that the constant matrix C is a real symmetric matrix of size n.
[0022] In the primal problem (A), X∈S n is a variable matrix, and indicates that the variable matrix X is a real symmetric matrix of size n.
[0023] In the primal problem (A), the operator “·” in U·V indicates the dot product of matrices U and V.
[0024] In the main problem (A), S n denotes the set of real symmetric matrices of size n.
[0025] In the primal problem (A), b ∈ R m is a constant vector, indicating that the constant vector b is an m-th order vector.
[0026] In the dual problem (B), y∈R m is a variable vector, and indicates that the variable vector y is an m-th order vector.
[0027] In the dual problem (B), Z∈S n is a variable matrix, and indicates that the variable matrix Z is a real symmetric matrix of size n.
[0028] Constant matrix A 1 ~A mGiven A, C, and a constant vector b, a convex optimization problem with the symmetric matrix X as the variable matrix is called the primal problem of a semidefinite programming problem. The variable matrix X that satisfies the constraints of the primal problem (A) is called a feasible solution to the primal problem. Furthermore, when the variable matrix X, which is a feasible solution, is positive definite, the feasible solution is called an interior point feasible solution.
[0029] For the primal problem (A), the variable vector y 1 ~y m A convex optimization problem with variables Z and the variable matrix Z is called the dual problem (B) of the semidefinite programming problem. i ,Z) is called a feasible solution of the dual problem (B). Furthermore, when the variable matrix Z, which is a feasible solution, is positive definite, the feasible solution is called an interior point feasible solution.
[0030] The following inequality (2) holds between the objective function value of the primal problem (A) and the objective function value of the dual problem (B).
[0031]
number
[0032] If the objective function value of the primal problem (A) (the first term on the left side of the above inequality (2)) and the objective function value of the dual problem (B) (the second term on the left side of the above inequality (2)) are the same, then (X, y, Z) is the optimal solution to the semidefinite programming problem.
[0033] <Example of hardware configuration of learning device> FIG. 1 is a block diagram showing an example of the hardware configuration of a learning device. The learning device 100 includes a processor 101, a storage device 102, an input device 103, an output device 104, and a communication interface (communication IF) 105. The processor 101, the storage device 102, the input device 103, the output device 104, and the communication IF 105 are connected by a bus 106. The processor 101 controls the learning device 100. The storage device 102 serves as a working area for the processor 101. The storage device 102 is a non-transient or temporary recording medium that stores various programs and data. Examples of the storage device 102 include a ROM (Read Only Memory), a RAM (Random Access Memory), a HDD (Hard Disk Drive), and a flash memory. The input device 103 inputs data. Examples of the input device 103 include a keyboard, a mouse, a touch panel, a numeric keypad, a scanner, a microphone, and a sensor. The output device 104 outputs data. The output device 104 may be, for example, a display, a printer, or a speaker. The communication IF 105 connects to a network and transmits and receives data.
[0034] <Example of functional configuration of learning device 100> 2 is a block diagram showing an example of a functional configuration of the learning device 100. The learning device 100 has an environment unit 201, a policy improvement unit 202, and a convex optimization unit 203. Specifically, the environment unit 201, the policy improvement unit 202, and the convex optimization unit 203 are realized, for example, by causing the processor 101 to execute a program stored in the storage device 102 shown in FIG.
[0035] The environment unit 201 includes a state calculation unit 211, a reward calculation unit 212, and an environment reset unit 213, similar to conventional reinforcement learning. The state calculation unit 211 updates the state when an action is given. The reward calculation unit 212 calculates a reward for the selected action. The environment reset unit 213 resets the environment for each episode.
[0036] The policy improvement unit 202 includes an action decision unit 221, a parameter update unit 222, and a learning data collection unit 223. The action decision unit 221 selects an action that maximizes the value of the action calculated by the value function. The parameter update unit 222 updates the policy parameters of the policy neural network and the parameters of the value function neural network. The learning data collection unit 223 collects learning data (actions, states, rewards).
[0037] The convex optimization unit 203 solves a convex optimization problem, which is a problem of minimizing a convex function on a convex set. When the action, state, reward, and policy parameters are input, the convex optimization unit 203 outputs the solution of the convex optimization problem to the policy improvement unit 202 as an index.
[0038] The convex optimization unit 203 includes a gradient function storage unit 231 , a problem generator 232 , a standard form converter 233 , an optimizer 234 , a solution converter 235 , an index calculator 236 , and a matrix class 237 .
[0039] The gradient function storage unit 231 stores information for executing backpropagation (hereinafter, backpropagation execution information). When learning data (action, state, reward) and policy parameters are given, the problem generator 232 generates an optimization problem. An optimization problem is a combination of an objective function and constraint conditions. An objective function is generated in step S1006, which will be described later, and constraint conditions are generated in step S1007.
[0040] The standard form conversion unit 233 outputs a constant matrix and a constant vector based on the objective function and constraint conditions from the problem generation unit 232. The standard form is the primal problem (A) or the dual problem (B) described in the above formula (1). The optimization problem is defined using the constant matrices A and C and the constant vector b. The standard form conversion unit 233 converts the objective function and constraint conditions into the constant matrices A and C and the constant vector b.
[0041] The optimization unit 234 executes a process of finding an optimal solution to the primary problem (A) and the dual problem (B). Details of the optimization unit 234 will be described later with reference to Figs.
[0042] The solution conversion unit 235 converts the solution obtained from the optimization unit 234 into a variable matrix. Details of the solution conversion unit 235 will be described later with reference to FIG.
[0043] The index calculation unit 236 calculates an index for evaluating the safety of an action based on the optimality of the solution obtained from the optimization unit 234 and the variable matrix obtained from the solution conversion unit 235. The index for evaluating the safety of an action is a real value equal to or greater than 0, and a larger index value indicates higher safety. Details of the index calculation unit 236 will be described later with reference to FIG. 16.
[0044] <Forward and backward propagation> FIG. 3 is an explanatory diagram showing an example of general forward propagation and backward propagation. A sequence 301 shows forward propagation, and a sequence 302 shows backward propagation for the sequence 301. In the sequence 301, when a value 311 of a variable x is input to a function f, the function f calculates a value 312 of a variable y, and when a value 312 of a variable y is input to a function g, the function g calculates a value 313 of a variable z. In forward propagation, when the functions f and g perform calculations on the input values 311 and 312 of the variables x and y to output the values 312 and 313 of the variables y and z, the input values 311 and 312 of the variables x and y, the output values 312 and 313 of the variables y and z, and the gradient functions f′(x), g′(y) corresponding to the calculations by the functions f and g are held. Since such information for executing backward propagation is held, the convex optimization unit 203 can execute backward propagation.
[0045] The calculations using functions f and g include operations required for neural network training, such as addition, subtraction, multiplication, division, matrix multiplication, tanh, etc. Hereinafter, the expression "performing forward propagation" means that while performing normal calculations (performing operations on inputs and outputting the results), information for performing back propagation is retained.
[0046] In the backpropagation of the sequence 302, gradients 323, 322, and 321 are calculated from the output side of the forward propagation toward the input side based on the information for executing the backpropagation that was held during the forward propagation.
[0047] 4 is an explanatory diagram showing an example of forward propagation and backward propagation in the convex optimization unit 203. A sequence 401 shows forward propagation, and a sequence 402 shows backward propagation for the sequence 401. In the sequence 401, a function f convex to variable x in When the value 411 is input, the function f convex is the variable y out Calculate the value 412 of the function f convex is the variable y out This is a function that outputs the value 412 of the variable y out The final output value of is L, which is the index output from the convex optimizer 203.
[0048] In forward propagation, the input variable x in For the value 411, the function f convex performs the calculation and assigns the variable y out When outputting the value 412 of the input variable x in The value of 411 and the output variable y out The value of 412 and the function f convex The gradient function f´ corresponding to the operation convex is stored in the gradient function storage unit 231. Since information for executing such back propagation is stored in the gradient function storage unit 231, the convex optimization unit 203 can execute back propagation.
[0049] In the backpropagation of the sequence 402, gradients 422, 421 are calculated from the output side to the input side of the forward propagation based on the information for performing the backpropagation that has been retained.
[0050] <Matrix class> 5 is an explanatory diagram showing an example of the matrix class 237. A semidefinite programming problem is described using a constant matrix and a variable matrix. When generating a constant matrix and a variable matrix, the matrix class 237 is generated. The matrix class 237 includes matrix data 501 and a forward propagation execution unit 502. As shown in FIG. 3 and FIG. 4, the forward propagation execution unit 502 executes forward propagation and stores information for executing back propagation in the gradient function storage unit 231.
[0051] The matrix data 501 includes an index 511 and a matrix 512. The index 511 specifies the matrix 512 in the same row. The values 0 to 4 of the index 511 may be expressed as indexes #0 to #4. The variable matrix is expressed by a linear combination of five types of matrices 512(0) to 512(4) of indexes #0 to #4.
[0052] Specifically, for example, the variable matrix H(x) can be expressed by the following equation (3).
[0053]
number
[0054] In the above formula (3), x 1 ,x 2 ,…,x p has p (p is an integer equal to or greater than 1) variables, H 0 is a constant matrix, H 1 ,H 2 ,…,H p is a binary matrix (it is a binary matrix when it is generated, but after forward propagation the matrix is not a binary matrix).
[0055] For example, the 2-by-2 variable matrix X 1 When the above is generated, it is expressed as in the following equation (4).
[0056]
number
[0057] Matrix of variables X 1 5, is stored as a pair of a variable index 511 and a corresponding matrix 512. That is, in the right-hand side of the above formula (4), the variable x 1 is expressed using the matrix 512(1) of index #1, and the variable x 2 is expressed using the matrix 512(2) of index #2, and the variable x 3 is expressed using the matrix 512(3) of index #3, and the variable x 4is expressed using the matrix 512(4) of index #4. Note that the constant matrix H 0 corresponds to matrix 512(0).
[0058] <Example of forward propagation execution> Next, an example of forward propagation execution performed by the forward propagation execution unit 502 will be described.
[0059] 6 is an explanatory diagram showing a forward propagation execution example 1 executed by the forward propagation execution unit 502. The forward propagation execution example 1 shows matrix addition. A sequence 601 shows forward propagation, and a sequence 602 shows backpropagation for the sequence 601. In the sequence 601, a function Add showing addition has two variables M j 1 , M j 2 When the value 611,612 is entered, the function Add returns the variable M j 3 When a gradient 623 is input to the gradient function Add′, the gradient function Add′ calculates gradients 621 and 622. j is the value of the index 511.
[0060] The gradients 623, 622, and 621 are values output by performing backpropagation. The gradient function Add' is a gradient function corresponding to the operation by the function Add.
[0061] The forward propagation execution unit 502 executes the input variable M j 1 , M j 2 The function Add performs an operation on each value 611, 612 of j 3 When outputting the value 613 of the input variable M j 1 , M j 2 The values 611,612 and the output variable M j 3 The value 613 and the gradient function Add′ are stored in the gradient function storage unit 231.
[0062] For example, the 2-by-2 variable matrix X 2When the above is generated, it is expressed as in the following equation (5).
[0063]
number
[0064] Addition of matrix variables X by the function Add 3 =X 1 +X 2 is expressed as the following equation (6).
[0065]
number
[0066] For example, variable x at index #1 1 In the first term on the right side of the above equation (6), forward propagation is performed using the following equation (7).
[0067]
number
[0068] Figure 7 shows the variable matrix X 1 ~X 3 FIG. 1 is an explanatory diagram showing matrix data of a variable matrix X 1 As shown in the above formula (4), the matrix data 701 is expressed by the matrix data 501 shown in Fig. 5. A matrix 712 indicates a matrix of index #j (j = 0 to 4).
[0069] Matrix of variables X 2 The matrix data 702 is the matrix 722 shown in each term on the right side of the above formula (5). The matrix 722 indicates the matrix of index #j (j=0 to 4).
[0070] Matrix of variables X 3 The matrix data 703 is a matrix 732 calculated by adding the terms on the right side of the above formula (6). The matrix 732 indicates the matrix of index #j (j=0 to 4).
[0071] 8 is an explanatory diagram showing a forward propagation execution example 2 executed by the forward propagation execution unit 502. The forward propagation execution example 1 shows a matrix multiplication. A sequence 801 shows forward propagation, and a sequence 802 shows backpropagation for the sequence 801. In the sequence 801, a function Matmul indicating a matrix multiplication is provided with two variables M j 1 , M 0 2 When the values 811 and 812 are input, the function Matmul j 3 When a gradient 823 is input to the function Matmul′, the function Matmul′ calculates gradients 821 and 822. j is the value of the index 511.
[0072] Gradients 823, 822, and 821 are values output by executing backpropagation. The function Matmul' is a gradient function corresponding to the operation by the function Matmul.
[0073] The forward propagation execution unit 502 executes the input variable M j 1 , M 0 2 The function Add performs an operation on each value 811, 812 of the variable M j 3 When outputting the value 813 of the input variable M j 1 , M 0 2 The values 811, 812 and the output variable M j 3 The value 813 and the gradient function Matmul′ are stored in the gradient function storage unit 231.
[0074] In matrix multiplication, at least one of the two matrices to be multiplied is a constant matrix. For example, the variable matrix X in the above formula (4) 1 and the constant matrix C in the following equation (8) 1 The matrix product of variables X and Matmul 4 =X 1 C 1 is expressed by the following equation (9).
[0075]
number
[0076] For example, variable x at index #1 1 In the first term on the right side of the above equation (9) for, forward propagation is performed using the following equation (10).
[0077]
number
[0078] Figure 9 shows the variable matrix X 1 ,X 4 and a constant matrix C 1 FIG. 1 is an explanatory diagram showing matrix data of a variable matrix X 1 As shown in the above formula (4), the matrix data 701 is expressed by the matrix data 501 shown in Fig. 5. A matrix 712 indicates a matrix of index #j (j = 0 to 4).
[0079] constant matrix C 1 The matrix data 901 is the matrix shown in the above formula (8). That is, in the matrix data 912, index #0 is a constant matrix C 1 The other indexes #1 to #4 are 0 matrices.
[0080] Matrix of variables X 4 This matrix data 904 is a matrix 942 calculated by multiplying the matrices in the terms on the right side of the above formula (9). Matrix 942 indicates the matrix of index #j (j=0 to 4).
[0081] <Question Generation Process by Question Generation Unit 232> 10A is a flowchart showing an example of a problem generation processing procedure by the problem generator 232. The problem generator 232 acquires actions and policy parameters from the policy improver 202, and acquires a state and a reward from the environment unit 201 (step S1001).
[0082] The problem generator 232 models the state transition of the environment as a first-order transfer function from the state and the action (step S1002).
[0083] The problem generator 232 uses the transfer function model and the strategy to configure a closed loop system (step S1003).
[0084] FIG. 10B is an explanatory diagram showing an example of a closed loop system. The closed loop system 1000 is a system in which a closed loop is formed by a policy 1101 and a transfer function 1102. When a state and a reward are given in a policy network in which policy parameters are set, the policy 1101 determines an action that maximizes the reward in a probability distribution that determines an action in a state, and outputs the action to the transfer function 1102. When an action is input, the transfer function 1102 outputs the state and the reward to the policy 1101. By constructing a condition for the stability of such a closed loop system 1000, it becomes possible to calculate an index of the safety of the action.
[0085] Returning to FIG. 10A, the problem generator 232 generates a constant matrix based on the closed-loop system configured in step S1003 (step S1004).
[0086] The problem generator 232 generates a variable matrix for satisfying the conditions for ensuring the safety of the closed loop system, that is, the safety of the behavior (step S1005).
[0087] The problem generator 232 executes forward propagation to generate an objective function related to the safety of an action, using the constant matrix generated in step S1004 and the variable matrix generated in step S1005 (step S1006).
[0088] The problem generator 232 executes forward propagation to generate constraints regarding the safety of actions, using the constant matrix generated in step S1004 and the variable matrix generated in step S1005 (step S1007).
[0089] The problem generator 232 calculates the objective function (c T x) and the constraint generated in the forward propagation in step S1007 are output to the standard form conversion unit 233 (step S1008).
[0090] The problem generation unit 232 generates a condition regarding the safety of an action as a problem (formula (11-1) below) of minimizing a linear objective function regarding the safety of the action under a linear matrix inequality constraint (formula (11-2) below) (formula (11) below).
[0091]
number
[0092] T indicates the transpose of a matrix or vector. The above formula (11-2) is the constraint generated by the forward propagation in step S1007, and is the constraint on the safety of the action in step S1007. c is a constant vector, and x is a variable vector. G0, G1, ... Gq are constant matrices, and G(x) is a matrix-valued function.
[0093] When there are multiple (K) linear matrix inequality constraints, the optimization problem is as follows (Equation (12) below).
[0094]
number
[0095] In steps S1006 and S1007, the problem generator 232 uses the generated constant matrix and variable matrix to calculate c in the above formula (11). T Forward propagation is performed to calculate x and G(x). Specifically, for example, the forward propagation execution unit 502 in the matrix class 237 executes forward propagation to calculate the objective function and the constraint conditions.
[0096] The constant matrices G0, G1, ... Gq are constants in a convex optimization problem, but in neural network training they are treated as parameters whose gradients should be calculated.
[0097] Although the condition for the safety of an action is expressed in the general form of the above formula (11), it is also possible to use inequalities related to matrix variables in their original form. For example, if the variable matrix X∈S n and a constant matrix A∈R n×n may be expressed as follows using a matrix object (Equation (13) below):
[0098]
number
[0099] <Standard system conversion process by the standard form conversion unit 233> 11 is a flowchart showing an example of a standard system conversion procedure by the standard form conversion unit 233. By converting to a standard form by the standard form conversion unit 233, it becomes possible to solve an optimization problem in a general purpose manner. For example, if the user's request or the target system is different, the objective function and constraint conditions generated in steps S1006 and S1007 change, but by converting to the standard form, it becomes possible to solve the optimization problem in the same format even if the user's request or the system is different.
[0100] The standard form conversion unit 233 acquires the objective function and the constraint conditions from the problem generation unit 232 (step S1101).
[0101] The standard form conversion unit 233 executes forward propagation to calculate a constant matrix C of the semidefinite programming problem (the above formula (1)) from the constraint conditions (step S1102).
[0102] The standard form conversion unit 233 converts the constant matrix A i Then, forward propagation is performed to calculate (step S1103).
[0103] The standard form conversion unit 233 executes forward propagation to calculate a constant vector b of the semidefinite programming problem (the above formula (1)) from the objective function (step S1104).
[0104] The standard form conversion unit 233 converts the constant matrix A i , constant vector b, and constant matrix C are output to optimization unit 234 (step S1105).
[0105] Constant matrix A i , constant vector b, and constant matrix C are the matrix G in the above formula (11). i Using (i=0,1,...,q) and matrix c, it is calculated as follows:
[0106] Constant matrix A i =G i (i = 0, 1, …, q) (14) constant vector b = -c (15) constant matrix C=-G 0 (16)
[0107] The above formulas (14) to (16) include the policy parameters (weights of the policy neural network) as well as the parameters of the transfer function model (weight matrix). However, the constant matrix generated from the parameters of the transfer function model is a constant in the convex optimization problem and in neural network learning, and is therefore not treated as a parameter for which the gradient should be calculated.
[0108] <Solution update algorithm> 12 is an explanatory diagram showing an example of a solution update algorithm. From a feasible initial solution 1201 in a feasible region 1200 or an infeasible initial solution 1202 outside the feasible region 1200, forward propagation is performed to update the solution along a central path 1204. The feasible initial solution 1201 does not have to be an admissible solution 1211.
[0109] Iteration points 1203 are output values from the function in forward propagation. In Fig. 12, there are three iteration points 1203, and then an optimal solution 1212 is obtained, which indicates that forward propagation has been performed four times. At each iteration point 1203, the input value, output value, and gradient function are stored in the gradient function storage unit 231 as information for performing back propagation, thereby enabling back propagation to be performed.
[0110] 13 is an explanatory diagram showing forward propagation and backward propagation for updating a variable matrix X. In FIG. 13, a sequence 1301 shows forward propagation, and a sequence 1302 shows backward propagation for the sequence 1301. In the sequence 1301, when a function F is applied to the variable matrix X k is input, the function F is the variable matrix X k+1 The function F is calculated by the index variable matrix X k+1 where k is a number indicating the iteration point 1203 in FIG. 12, and indicates the number of propagations in ascending order starting from k=1.
[0111] Matrix of variables X k is the variable matrix that constitutes the k-th iteration point 1203, and the variable matrix X k+1 is a variable matrix constituting the k+1-th iteration point 1203. That is, the k-th iteration point 1203 is a variable matrix X k , the variable vector y k and the variable matrix Z k The k+1-th iteration point 1203 is constructed by the variable matrix X k+1 , the variable vector y k+1 and the variable matrix Z k+1 It is composed of:
[0112] In forward propagation, the input variable matrix X k The function F performs operations on the variable matrix X k+1 When outputting, the input variable matrix X k and the output variable matrix X k+1 and a gradient function F' corresponding to an operation using the function F are stored in the gradient function storage unit 231. Since information for executing such back propagation is stored in the gradient function storage unit 231, the convex optimization unit 203 can execute back propagation.
[0113] In the backpropagation of the series 1302, gradients 1322, 1321 are calculated from the output side to the input side of the forward propagation based on information for executing the backpropagation stored in the gradient function storage unit 231. Note that while forward propagation and backpropagation are shown for the variable matrix X in Fig. 13, the same applies to the variable vector y and the variable matrix Z, although they are not shown.
[0114] The k+1th iteration point 1203(X k+1 ,y k+1 ,Z k+1 ) is determined to satisfy the following conditional expression (17), and the optimality δ of the solution is expressed by the following expression (18).
[0115]
number
[0116] That is, if δ=0 in the above formula (18), the k+1th iteration point 1203 (X k+1 ,y k+1 ,Z k+1 ) is the optimal solution 1212 of the semidefinite programming problem (the above formula (1)). p is the step length for updating the matrix X, and α d is the step length for updating the matrix Z.
[0117] <Optimization process by optimization unit 234> 14 is a flowchart showing an example of an optimization procedure performed by the optimization unit 234. The optimization unit 234 receives the constant matrix A i , a constant vector b, and a constant matrix C (see the above formulas (14) to (16)) are obtained (step S1401).
[0118] The optimization unit 234 optimizes the constant matrix A i , constant vector b, and constant matrix C are substituted into the primal problem (A) and dual problem (B) of the above equation (1) to obtain the initial solution (X 0 ,y 0 ,Z 0 ) (step S1402).
[0119] The optimization unit 234 generates an equation for approximating the points on the central path 1204 (step S1403).
[0120] The optimization unit 234 solves the equation generated in step S1403 to determine the search direction (dX k ,dy k,dZ k ) is calculated (step S1404).
[0121] The optimization unit 234 executes forward propagation to calculate the step sizes αp and αd (step S1405).
[0122] The optimization unit 234 determines the next iteration point 1203 (X k+1 ,y k+1 ,Z k+1 ) is determined so as to satisfy the conditional expression of the above formula (17) (step S1406).
[0123] The optimization unit 234 executes forward propagation to calculate the optimality δ of the solution of the above equation (18) (step S1407).
[0124] The optimization unit 234 judges whether or not the optimal solution 1212 is obtained before the predetermined number of repetitions (step S1408). If the optimal solution 1212 is not obtained before the predetermined number of repetitions (step S1408: No), the process returns to step S1403. If the optimal solution 1212 is obtained before the predetermined number of repetitions, or if the predetermined number of repetitions has ended (step S1408: Yes), the optimization unit 234 outputs the optimality δ of the solution to the index calculation unit 236 (step S1409).
[0125] The optimization unit 234 outputs the updated solution (X, y, Z) to the solution conversion unit 235 (step S1410). The updated solution (X, y, Z) is the optimal solution 1212 if the optimal solution 1212 is obtained, and is the last updated iteration point 1203 (X k+1 ,y k+1 ,Z k+1 ).
[0126] <Solution conversion process by the solution conversion unit 235> 15 is a flowchart showing an example of a procedure for solution conversion processing by the solution conversion unit 235. Since the solution (X, y, Z) from the optimization unit 234 is a standard form solution, the solution conversion unit 235 executes a process of returning the solution (X, y, Z) to the original problem (i.e., the form of the objective function and constraint conditions generated in steps S1006 and S1007).
[0127] The solution conversion unit 235 obtains the solution (X, y, Z) from the optimization unit 234 (step S1501).
[0128] The solution conversion unit 235 executes forward propagation to convert the matrix into a variable matrix used in the formulation of the safety (step S1502).
[0129] The solution conversion unit 235 outputs the variable matrix converted by the forward propagation in step S1502 to the index calculation unit 236 (step S1503).
[0130] <Index Calculation Processing by Index Calculation Unit 236> 16 is a flowchart showing an example of an index calculation process procedure by the index calculation unit 236. The index calculation unit 236 obtains the optimality δ of the solution from the optimization unit 234, and obtains the variable matrix from the solution conversion unit 235 (step S1601).
[0131] The index calculation unit 236 executes forward propagation to calculate the safety of an action using the variable matrix acquired in step S1601 (step S1602).
[0132] The index calculation unit 236 executes forward propagation to calculate an index from the safety of the action obtained in the forward propagation in step S1602 and the optimality δ of the solution (step S1603).
[0133] The index calculation unit 236 outputs the index obtained by the forward propagation in step S1603 to the policy improvement unit 202 (step S1604).
[0134] <Policy improvement processing by the policy improvement unit 202> 17 is a flowchart showing an example of a policy improvement processing procedure by the policy improvement unit 202. The policy improvement unit 202 determines an action by the action decision unit 221, and collects learning data (action, state, reward) by the learning data collection unit 223 (step S1701). The policy improvement unit 202 executes a policy neural network update process by the parameter update unit 222 (step S1702). The policy improvement unit 202 executes a value function neural network update process by the parameter update unit 222 (step S1703). The policy improvement unit 202 determines whether learning is completed (step S1704).
[0135] Specifically, for example, the policy improvement unit 202 determines that learning is complete when the number of interactions with the environment reaches a predetermined number. Here, one interaction with the environment is a process in which "the action decision unit 221 decides an action based on a state, the action is input to the environment unit 201, and the next state and reward are output."
[0136] If the learning is not complete (step S1704: No), the process returns to step S1701. If the learning is complete (step S1704: Yes), the policy improvement process ends.
[0137] Fig. 18 is a flowchart showing a detailed example of the process procedure of the policy neural network update process (step S1702) shown in Fig. 17. The policy neural network is a neural network that receives a state as an input and outputs an action. The policy improvement unit 202 outputs policy parameters (weights of the policy neural network) and learning data (action, state, reward) to the convex optimization unit 203 through the parameter update unit 222, and acquires an index (step S1801).
[0138] The policy improving unit 202 executes forward propagation using the learning data (action, state, reward) by the parameter updating unit 222 to calculate an objective function (for example, a surrogate objective function) that leads to maximization of the reward (step S1802). Specifically, the policy improving unit 202 executes forward propagation with the objective function that leads to maximization of the reward as a first index and the index acquired from the convex optimization unit 203 as a second index. For example, the policy improving unit 202 executes forward propagation with the objective function that leads to maximization of the reward as a first index and the index acquired from the convex optimization unit 203 as a second index, and calculates a value obtained by multiplying the first index and the second index by a coefficient and adding them together.
[0139] The policy improving unit 202 executes forward propagation by the parameter updating unit 222, using the index acquired in step S1801 and the proxy objective function obtained by executing the forward propagation in step S1802, to calculate a loss function of the policy (step S1803). Specifically, for example, the policy improving unit 202 executes forward propagation by the parameter updating unit 222, taking the objective function leading to maximization of the reward obtained by executing the forward propagation in step S1802 as a first index, the index acquired in step S1801 as a second index, and calculates a value obtained by multiplying the first index and the second index by a coefficient and adding them together.
[0140] The policy improving unit 202, by using the parameter updating unit 222, executes back propagation for the forward propagation for calculating the loss function of the policy, and calculates the gradient (step S1804).
[0141] The policy improving unit 202 updates the policy parameters of the policy neural network using the gradient obtained in step S1804 through the parameter updating unit 222 (step S1805). After that, the process proceeds to the value function neural network updating process (step S1703).
[0142] Fig. 19 is a flowchart showing a detailed example of the processing procedure of the value function neural network update process (step S1703) shown in Fig. 17. The policy improvement unit 202 executes forward propagation to calculate a loss function of the value function using learning data (action, state, reward) by the parameter update unit 222 (step S1901).
[0143] The value function is a function that evaluates the value of an action. Specifically, for example, the value function is a function that calculates an estimated value of a reward when an action is selected for a state from the environment unit 201 as the value of the action. The policy improvement unit 202 selects an action that maximizes the estimated value of the reward by the action decision unit 221, and outputs the action to the environment unit 201.
[0144] The policy improving unit 202 executes back propagation for the forward propagation that calculates the loss function of the value function, and calculates the gradient (step S1902).
[0145] The policy improving unit 202 updates the parameters of the value function neural network using the gradient obtained in step S1902 (step S1903), and then proceeds to step S1704.
[0146] <Screen example> 20 is an explanatory diagram showing an example of an input screen. The input screen 2000 is a graphic user interface that is displayed on a display, which is an example of the output device 104, and allows the user to input operations. The input screen 2000 has a first setting item 2001 to a seventh setting item 2007, and an execute button 2008.
[0147] A first setting item 2001 is an item for setting the number of interactions with the environment by a user operation. The set number is a criterion for determining whether to end learning in step S1704.
[0148] A second setting item 2002 is an item for setting the learning rate of the policy neural network through a user operation.
[0149] The third setting item 2003 is an item for setting the learning rate of the value function neural network through a user operation.
[0150] The fourth setting item 2004 is an item for setting, by a user operation, a discount rate of the objective function that leads to maximization of the reward.
[0151] A fifth setting item 2005 is an item for setting, by user operation, a generalized advantage estimator (GAE), which is a parameter of an objective function that leads to maximization of reward, that is, a generalized advantage estimate of the objective function.
[0152] A sixth setting item 2006 sets a parameter for adjusting a coefficient by which the safety of an action in the second index is multiplied, by a user operation.
[0153] A seventh setting item 2007 sets a parameter for adjusting a coefficient by which the optimality of the second index matrix variable is multiplied by a user operation.
[0154] When the execute button 2008 is pressed, learning is executed with the parameters set in the first setting item 2001 to the seventh setting item 2007.
[0155] 21 is an explanatory diagram showing an example of an output screen. In the case of step S1704: Yes, the output screen 2100 displays the learning result on a display, which is an example of the output device 104. "Return" displays a numerical value indicating how much the reward has been maximized, and "Safety Metric" displays a numerical value indicating how much the index for evaluating the safety of the behavior has been maximized. The larger both numerical values are, the greater the maximization.
[0156] In this way, according to this embodiment, the convex optimization unit 203 calculates the gradient by performing back propagation from the index, thereby ensuring the stability of actions in a convex optimization problem.
[0157] The present invention is not limited to the above-described embodiments, and includes various modified examples and equivalent configurations within the spirit of the appended claims. For example, the above-described embodiments have been described in detail to clearly explain the present invention, and the present invention is not necessarily limited to those having all of the configurations described. Also, a part of the configuration of one embodiment may be replaced with a configuration of another embodiment. Also, a configuration of another embodiment may be added to a configuration of one embodiment. Also, a part of the configuration of each embodiment may be added, deleted, or replaced with another configuration.
[0158] Furthermore, each of the aforementioned configurations, functions, processing units, processing means, etc. may be realized in hardware, for example by designing some or all of them as an integrated circuit, or may be realized in software by a processor interpreting and executing a program that realizes each function.
[0159] Information such as programs, tables, files, etc. that realize each function can be stored in a storage device such as a memory, a hard disk, or an SSD (Solid State Drive), or in a recording medium such as an IC (Integrated Circuit) card, an SD card, or a DVD (Digital Versatile Disc).
[0160] In addition, the control lines and information lines shown are those considered necessary for the explanation, and do not necessarily show all the control lines and information lines necessary for implementation. In reality, it can be considered that almost all components are connected to each other. [Explanation of symbols]
[0161] 100 Learning Device 101 Processor 102 Storage Devices 201 Environment Department 202 Policy Improvement Department 203 Convex Optimization Section 211 State Calculation Unit 212 Remuneration Calculation Department 213 Environmental Reset Department 221 Policy Improvement Department 221 Action Decision-Making Department 222 Parameter Update Section 223 Learning Data Collection Department 231 Gradient function memory section 232 Problem generation part 233 Standard Form Conversion Unit 234 Optimization Department 235 Solution conversion section 236 Indicator calculation section
Claims
1. A learning device for training a neural network that learns a strategy for improving a first index, the learning device comprising: a processor that executes a program; and a storage device that stores the program, the learning device comprising: The processor, A problem generation process for generating a convex optimization problem including a gradient function related to an update policy for parameters included in the neural network based on information about the neural network; an index generation process for generating a second index for the policy based on the convex optimization problem generated by the problem generation process; an update process for updating parameters included in the neural network based on the first index and the second index; A learning device that executes the above.
2. The learning device according to claim 1 , The convex optimization problem is a semidefinite programming problem. A learning device characterized by:
3. The learning device according to claim 1 , The information about the neural network is a parameter included in the neural network. A learning device characterized by:
4. The learning device according to claim 1 , In the problem generation process, the processor configures a closed-loop system of the policy and a transfer function model that models a state transition of an environment based on a state and an action, and generates the convex optimization problem so as to satisfy a condition that ensures the safety of the closed-loop system. A learning device characterized by:
5. The learning device according to claim 1 , In the update process, the processor performs forward propagation to calculate a loss function of the policy using the first index and the second index, calculates a gradient by performing back propagation with respect to the forward propagation, and updates the parameters using the gradient. A learning device characterized by:
6. A learning method executed by a learning device for training a neural network that learns a strategy for improving a first index, the learning method comprising: a processor that executes a program; and a storage device that stores the program, the learning device comprising: The processor, A problem generation process for generating a convex optimization problem including a gradient function related to an update policy for parameters included in the neural network based on information about the neural network; an index generation process for generating a second index for the policy based on the convex optimization problem generated by the problem generation process; an update process for updating parameters included in the neural network based on the first index and the second index; A learning method comprising:
7. a learning program that causes a processor to train a neural network that learns a strategy for improving a first metric, The processor, A problem generation process for generating a convex optimization problem including a gradient function related to an update policy for parameters included in the neural network based on information about the neural network; an index generation process for generating a second index for the policy based on the convex optimization problem generated by the problem generation process; an update process for updating parameters included in the neural network based on the first index and the second index; A learning program characterized by executing the above.
Citation Information
Patent Citations
Systems and methods for robust optimization of trajectory-centered reinforcement learning
JP2023504220A
Adaptive control mechanism for uncertain systems with actuator dynamics
US11079737B1
Microwave oven with infrared evaluation control
JP2019519744A
