Fault-tolerant fpva biochip physical design method based on dqn
By employing a DQN-based physical design method for FPVA biochips and utilizing deep reinforcement learning algorithms to generate mixer layout and wiring schemes, the blockage and leakage problems of FPVA biochips are solved, improving execution efficiency and reducing manufacturing costs.
Patent Information
- Application Number
- CN202311665890.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-12-06
AI Technical Summary
Existing FPVA biochips are prone to clogging and leakage during manufacturing or use, leading to obstructed fluid flow, cross-contamination, and deviations in bioassay results, and are also costly to manufacture.
A fault-tolerant FPVA biochip physical design method based on DQN is adopted. By designing a chip environment model, action decision model and reward function, and training a neural network with a deep reinforcement learning algorithm, the layout and wiring scheme of the mixer is generated, which satisfies the fault tolerance constraint and reduces the fluid path length.
This improves the execution efficiency of FPVA biochips, reduces manufacturing costs, and ensures the accuracy of bioassays and the efficiency of fluid transport.
Smart Images

Figure CN117669469B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip design, specifically to a fault-tolerant FPVA biochip physical design method based on DQN. Background Technology
[0002] Fully Programmable Valve Array (FPVA) biochips combine the advantages of digital microfluidic biochips and flow-based microfluidic biochips. They can perform multiple bioassays on a single chip without modifying any hardware, and have therefore attracted widespread attention.
[0003] In physical design, factors such as component layout, total fluid transport length, and the number of fluid crossovers directly impact chip manufacturing costs, bioassay efficiency, and reliability. Therefore, developing an efficient and reliable automated physical design method is crucial for improving chip quality and yield. However, due to environmental or human factors, FPVA biochips experience physical failures during manufacturing or use. These failures can be categorized into two types: blockage and leakage. Blockage can be caused by various factors, such as channel disconnection, misalignment between the control and flow layers, and valve malfunction. Blockage can obstruct fluid flow or cause unspecified valves to close. On the other hand, independent microchannels may inadvertently connect through fault points on the channel walls, leading to leakage within the layers. Leakage can cause fluid from the flow layer to seep into adjacent flow channels, resulting in cross-contamination or asynchronous valves switching synchronously. Ignoring these failures in chip design can lead to biased or even erroneous bioassay results, as well as significant waste of expensive reagents. Summary of the Invention
[0004] The purpose of this invention is to solve the above-mentioned problems and provide a fault-tolerant FPVA biochip physical design method based on DQN, which can generate FPVA biochip physical design schemes with good execution efficiency, improve the execution efficiency of FPVA biochips, and reduce the manufacturing cost of chips.
[0005] To achieve the above objectives, the technical solution of the present invention is: a fault-tolerant FPVA biochip physical design method based on DQN. First, the layout in the FPVA biochip physical design is realized by designing the chip's environment model, action decision model, reward function, and DQN model; then, based on the layout, the wiring in the FPVA biochip physical design is realized by using a fluid transport priority strategy and a breadth-first search algorithm.
[0006] In one embodiment of the present invention, the method includes the following steps:
[0007] (1) Information mapping stage: The current state of the FPVA biochip is converted into a two-dimensional grid through information mapping. The position of the mixer is represented by the coordinates of the lower left cell of the mixer. The information mapping determines whether each cell on the FPVA biochip meets the layout requirements based on the current state of the FPVA biochip.
[0008] (2) Fault-tolerant physical design stage: Train the neural network model based on deep reinforcement learning algorithm to generate the layout timing and position information of the mixer, while ensuring that the layout of each mixer meets the fault-tolerant constraints;
[0009] (3) Fault-tolerant wiring stage: Based on the timing requirements given in the bioassay, realize the wiring plan for the fluid, and reduce the length of the fluid path under the premise of meeting the fault-tolerant constraints and not causing fluid conflicts.
[0010] In one embodiment of the present invention, step (1) is specifically implemented as follows:
[0011] (1.1) Fault mapping:
[0012] Based on the four different manifestations of faults, faults are divided into three categories and mapped onto the FPVA biochip: fault units caused by flow channel blockage and flow channel leakage, blockage units caused by valve blockage, and fusion units caused by valve leakage. Among them, fault units and fusion units connected to fault units cannot be used during layout and wiring.
[0013] (1.2) Information mapping:
[0014] To reduce strategy complexity, the current state of the FPVA biochip is converted into a two-dimensional grid through information mapping. The position of the mixer is represented by the coordinates of the bottom-left cell of the mixer. The information mapping determines whether each cell on the FPVA biochip meets the layout requirements based on the current state of the FPVA biochip. This information mapping reduces the complexity of environment updates from log(nm) to log(n). A two-dimensional array is used to represent the state of the FPVA biochip.
[0015] state = s(FPVA[size][size])
[0016] Where size represents the size of the FPVA biochip; FPVA[x][y] represents the state of the cell at position (x,y) in the FPVA biochip. When the cell is empty, the value of FPVA[x][y] is 0, otherwise it is a value greater than 0 (set to 10 in this article). The s() function iterates through and records the state of each cell as the state of the FPVA biochip.
[0017] (1.3) Action settings:
[0018] The ε-greedy algorithm is used to select the action policy, where each action determines the position of a mixer:
[0019]
[0020] Where action_MaxQ(s,a,ω) represents selecting the action with the largest reward value in the experience, action_random represents randomly generating a new action, s is the current usage state of the FPVA biochip, a is the layout position selected for the current state, ω is the weight parameter of the neural network, c is a random number in the range [0,1], and ε is a fixed value of 0.3.
[0021] (1.4) Motion constraints:
[0022] Since concurrently executing mixers cannot overlap, while non-concurrently executing mixers can overlap, action constraints are used to maximize the overlap area of mixers by selecting actions to ensure that the position of a mixer overlaps with its parent mixer as much as possible. First, mixers are classified according to whether they can be executed concurrently, and mixers in the same group cannot overlap. To ensure that mixers with transport relationships overlap as much as possible, mixers other than those in the first group are only allowed to be placed within the smallest rectangle that contains all their parent mixers.
[0023] (1.5) Reward function:
[0024] The goal during the layout phase is to make the mixer layout as compact as possible while satisfying fault tolerance constraints and avoiding component conflicts, thereby reducing the path length of fluid transport and the completion time of bioassays; therefore, the reward function is as follows:
[0025] reward=-α×S-β×Lk
[0026] Where α and β are constant coefficients; S is the chip area occupied by the mixer layout, and its calculation formula is as follows:
[0027] S = 4 - res
[0028] Where res represents the area of overlap between the layout mixer and its parent mixer. If the layout mixer is the first group of mixers, then res = 0.
[0029] L is the sum of the Manhattan distances between components with a transportation relationship, and its calculation formula is as follows:
[0030] L=∑ j∈father(i) len(i,j)+a×l
[0031] Where len(i,j) represents the Manhattan distance between component i and component j; father(i) represents the set of components that need to be fed into component i; a is 1 when the corresponding action is to lay out the last set of mixers, otherwise a = 0; l represents the Manhattan distance between the mixer and the output port;
[0032] k is the penalty term for violating layout constraints, and its definition formula is as follows:
[0033]
[0034] Where M is a constant with a value of 1000; FPVA[x a ][y a The location of the mixer selected for the action on the FPVA biochip.
[0035] In one embodiment of the present invention, step (2) is specifically implemented as follows:
[0036] A deep neural network is used instead of a Q-table to generate the Q-value corresponding to a given state and action, as shown below:
[0037] Q(s,a,ω)≈Q π (s,a)
[0038] Where ω represents the weight parameters of the neural network, and π represents the policy of the neural network. Given the input state s, the policy π is used to select the action a that maximizes the reward value. The goal of training the neural network model is to find an optimal policy π* to maximize the overall reward. The specific formula is as follows:
[0039] π*=arg max π∈Π R π
[0040] Where Π represents the set of strategies, and R π This represents the sum of rewards obtained under strategy π, and its calculation formula is as follows:
[0041]
[0042] Where T represents the total number of decisions required to complete the entire layout, and s t π(s) represents the state of the chip at the t-th decision of the neural network. t ) indicates in s t In the given state, the action selected by policy π, reward(s) t ,π(s t )) indicates that in s t Take action π(s) in the state t The reward value;
[0043] The neural network consists of three convolutional layers and two fully connected layers; the size of the input two-dimensional grid is fixed at 12×12×1 by padding; each convolutional layer uses a 3×3 kernel with a stride of 1; the fourth fully connected layer consists of 256 units, and the last fully connected layer consists of 144 units. Each unit outputs a Q value corresponding to an action, and the final action output by the network is selected based on the magnitude of the Q value.
[0044] Neural networks are divided into value networks and target networks. The value network is equivalent to a value function. On one hand, it is trained based on samples generated by the interaction between the agent and the environment, adjusting the network weight parameters and improving the value function. On the other hand, after the neural network is trained, it outputs the layout position of the mixer based on the current state of the FPVA biochip. The target network is a network with the same structure as the value network, but its parameters are not necessarily the same. After a certain number of iterations, the parameters of the value network are copied to the target network. The target network is used to calculate the target value and then update the parameters of the value network using a loss function.
[0045] To update the value network parameters ω, the mean squared error is used to define the loss function, as shown in the following equation:
[0046] Loss(ω)=E((TarQ-Q(s,a,ω)) 2 )
[0047] Where E is the mean squared error; TarQ is the target value, and its calculation formula is as follows:
[0048] TarQ=reward+λmaxQ(s',a',ω - )
[0049] Where reward is the reward value for performing action a in state s; λ is 0.9; s' is the next state; a' is the next action; ω - These are the weight parameters of the neural network in the target network;
[0050] After obtaining the loss function, the gradient descent algorithm is directly used to solve for the weight parameter ω of the loss function Loss(ω) of the neural network model. The calculation formula is as follows:
[0051]
[0052] in, It can be computed by deep neural networks; after obtaining the gradient of TarQ, stochastic gradient descent is used to simplify the calculation process and obtain the optimal Q value.
[0053] In one embodiment of the present invention, step (3) is specifically implemented as follows:
[0054] During the routing phase, routing needs to reduce the length of fluid paths while satisfying fault tolerance constraints and avoiding fluid conflicts. To avoid fluid conflicts, fluid transport priorities are set. When a fluid conflict occurs, low-priority fluids must wait for high-priority fluids to leave the conflicting cell before continuing transport. Then, a fault-tolerant transport path is constructed using a breadth-first search. Specifically:
[0055] (1) Fluid priority classification
[0056] Based on the types of components at the beginning and end of fluid transport, fluids are classified into the following three categories:
[0057] 1) Fluid transported from the input port to the mixer: Prioritize transporting the fluid that performs the mixing operation earlier; based on this, prioritize the input of the fluid required by the mixer that is farther from the input port;
[0058] 2) Fluid transported from mixer to mixer: Prioritize transporting fluids that were mixed earlier;
[0059] 3) Fluid transported from the mixer to the output port: Prioritize outputting the fluid in the mixer that is closer to the output port;
[0060] Fluid transported from the mixer to the mixer has higher priority than fluid transported from the input port to the mixer; at the same time, if fluid is transferred to a cell that is already occupied by another fluid, the fluid in that cell has priority.
[0061] (2) Local wiring based on breadth-first search
[0062] The overall wiring is divided into end-to-end local wiring. The total fluid transport path is divided into local paths: fluid transport from the input port to the mixer; fluid transport from the mixer to the mixer; and fluid transport from the mixer to the output port. Then, a breadth-first search is performed on each local path. The method flow is as follows:
[0063] First, initialize a queue and set the starting unit of the wiring as the head of the queue. Then, start traversing. Each traversal requires first taking out the head element of the queue. Then, insert the adjacent units of the head element that can be wired and have not been visited into the queue and mark their predecessor nodes as the head element. If the target unit is found, end the traversal directly. Then, find the shortest path based on the predecessor node of the node.
[0064] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a fault-tolerant FPVA biochip physical design method based on DQN, which can generate FPVA biochip physical design schemes with good execution efficiency, improve the execution efficiency of FPVA biochips, and reduce the manufacturing cost of chips. Attached Figure Description
[0065] Figure 1 Example diagram of information mapping.
[0066] Figure 2 Example diagram of fault mapping.
[0067] Figure 3 Example diagrams of motion constraints; where (a) is a bioassay timing diagram; (b) is the first group layout; (c) is the second group layout; and (d) is the third group layout.
[0068] Figure 4 Neural network model. Detailed Implementation
[0069] The technical solution of the present invention will now be described in detail with reference to the accompanying drawings.
[0070] This invention provides a fault-tolerant FPVA biochip physical design method based on DQN. First, the layout of the FPVA biochip physical design is achieved by designing the chip's environment model, action decision model, reward function, and DQN model. Then, based on the layout, the routing of the FPVA biochip physical design is achieved using a fluid transport priority strategy and a breadth-first search algorithm. The method includes the following steps:
[0071] (1) Information mapping stage: The current state of the FPVA biochip is converted into a two-dimensional grid through information mapping. The position of the mixer is represented by the coordinates of the lower left cell of the mixer. The information mapping determines whether each cell on the FPVA biochip meets the layout requirements based on the current state of the FPVA biochip.
[0072] (2) Fault-tolerant physical design stage: Train the neural network model based on deep reinforcement learning algorithm to generate the layout timing and position information of the mixer, while ensuring that the layout of each mixer meets the fault-tolerant constraints;
[0073] (3) Fault-tolerant wiring stage: Based on the timing requirements given in the bioassay, realize the wiring plan for the fluid, and reduce the length of the fluid path under the premise of meeting the fault-tolerant constraints and not causing fluid conflicts.
[0074] The following is a detailed implementation process of the present invention.
[0075] 1. Fault mapping:
[0076] Based on the four different manifestations of faults, faults can be divided into three categories and mapped onto the chip, such as... Figure 2The diagram shows a fault unit caused by flow channel blockage and flow channel leakage; a blockage unit caused by valve blockage; and a fusion unit caused by valve leakage. The fault units and the fusion units connected to them cannot be used during layout and wiring.
[0077] 2. Information mapping:
[0078] In this invention, the position of the mixer is represented by the coordinates of the lower-left cell of the mixer. To reduce strategy complexity, we convert the current state of the FPVA biochip into a two-dimensional grid form through information mapping, such as... Figure 1 As shown. Information mapping determines whether each cell on the chip meets the layout requirements based on the chip's current state. This information mapping method reduces the complexity of environment updates from log(nm) to log(n). This invention uses a two-dimensional array to represent the state of the FPVA biochip:
[0079] state=s(FPVA[size][size]) (1)
[0080] Where size represents the chip size; FPVA[x][y] represents the state of the cell at position (x,y) in the FPVA biochip. When the cell is empty, the value of FPVA[x][y] is 0, otherwise it is a value greater than 0 (set to 10 in this article). The s() function iterates through and records the state of each cell as the state of the FPVA biochip.
[0081] 3. Action settings:
[0082] If the mixer only focuses on exploring new location layouts, i.e., completely random actions, most actions are worthless, resulting in a very slow learning speed for the policy network. If the actions for layout selection are entirely based on past experience, i.e., the mixer chooses the action with the highest reward, it may be limited by existing experience and unable to discover new, more valuable layouts. A balance between "exploration" and "exploitation" is achieved by using an ε-greedy algorithm to select appropriate action policies, where each action determines a mixer's position.
[0083]
[0084] Where action_MaxQ(s,a,ω) represents selecting the action with the highest reward value from the experience, action_random represents randomly generating a new action, s is the current usage state of the FPVA biochip, a is the layout position selected for the current state, ω is the weight parameter of the neural network, c is a random number in the range [0,1], and ε is a fixed value of 0.3.
[0085] 4. Motion constraints:
[0086] Since concurrently executing mixers cannot overlap, while non-concurrently executing mixers can overlap, this invention utilizes action constraints to maximize the overlap area between mixers by selecting actions that ensure the position of a mixer overlaps with its parent mixer as much as possible. First, mixers need to be classified according to whether they can be executed concurrently, such as... Figure 3 As shown in (a), M1, M2, M3, and M4 form the first group; M5 and M6 form the second group; and M7 forms the third group. Mixers within the same group cannot overlap. To maximize the overlap of transport-related mixers, mixers other than those in the first group are only allowed to be placed within the smallest rectangle containing all their parent mixers. Figure 3 (b) is the layout of the first group of mixers. Since M5 and M6 are the second group of mixers, and M1 and M2 are the parent mixers of M5; M3 and M4 are the parent mixers of M6, the positions of M5 and M6 can only be in R1 and R2 respectively. Figure 3 (c) shows the layout of the second set of mixers. Similarly, as... Figure 3 As shown in (d), M7 is located within R3.
[0087] 5. Reward function:
[0088] The objective of this invention during the layout phase is to achieve the most compact mixer layout possible while satisfying fault tolerance constraints and avoiding component conflicts, thereby reducing the path length of fluid transport and the completion time of bioassays. Therefore, the reward function of this invention is as follows:
[0089] reward=-α×S-β×Lk (3)
[0090] Where α and β are constant coefficients, both with a value of 0.5; S is the chip area occupied by the mixer layout, and its calculation formula is as follows:
[0091] S = 4 - res (4)
[0092] Where res represents the area of overlap between the placed mixer and its parent mixer. If the placed mixer is the first group of mixers, then res = 0.
[0093] L is the sum of the Manhattan distances between components with a transportation relationship, and its calculation formula is as follows:
[0094] L=∑ j∈father(i) len(i,j)+a×l (5)
[0095] Where len(i,j) represents the Manhattan distance between component i and component j; father(i) represents the set of components that need to be fed into component i; a is 1 when the action is for the last set of mixers, otherwise a = 0; l represents the Manhattan distance between the mixer and the output port.
[0096] k is the penalty term for violating layout constraints, and its definition formula is as follows:
[0097]
[0098] Where M is a constant, and since the layout cannot have component conflicts, M should be as large as possible, with a size of 1000; FPVA[x a ][y a The location of the mixer selected for the action on the FPVA biochip.
[0099] 6. Neural Network Model:
[0100] Deep reinforcement learning algorithms combine neural networks with Q-learning algorithms. Since the Q-table in Q-learning can only handle a limited number of states and actions, it cannot solve cases with relatively large state spaces. Therefore, we use deep neural networks instead of Q-tables to generate the Q-values corresponding to a given state and action, as shown below:
[0101] Q(s,a,ω)≈Q π (s,a) (7)
[0102] Where ω represents the weight parameters of the neural network, and π represents the policy of the neural network. Given the input state s, the policy π selects the action 'a' that maximizes the reward. The goal of training the network model is to find an optimal policy π* to maximize the overall reward. The specific formula is as follows:
[0103] π*=arg max π∈Π R π (8)
[0104] Where Π represents the set of strategies, and R π This represents the sum of rewards obtained under strategy π, and its calculation formula is as follows:
[0105]
[0106] Where T represents the total number of decisions required to complete the entire layout, and s t π(s) represents the state of the chip at the t-th decision of the neural network. t ) indicates in s tIn the given state, the action selected by policy π, reward(s) t ,π(s t )) indicates that in s t Take action π(s) in the state t The reward value.
[0107] This invention incorporates two network models: a value network and a target network.
[0108] The value network is equivalent to a value function and belongs to the category of nonlinear approximation models. The main tasks of the value network are twofold: firstly, to train the network based on samples generated from the agent's interaction with the environment, adjusting the network weight parameters and improving the value function; secondly, after the network training is complete, to output the placement position of the mixer based on the current state of the FPVA biochip. Its model is as follows: Figure 4 As shown.
[0109] This invention constructs a 5-layer neural network, including three convolutional layers and two fully connected layers. The size of the input 2D grid is fixed at 12×12×1 by padding. Each convolutional layer uses a 3×3 kernel with a stride of 1. The fourth fully connected layer consists of 256 units, and the last layer is a fully connected layer with 144 units. Each unit outputs a Q-value corresponding to an action, and the final action output by the network is selected based on the magnitude of the Q-value.
[0110] The target network is structurally identical to the value network, but its parameters may differ. After a certain number of iterations, the parameters of the value network are copied to the target network. The target network is used to calculate the target value, and then the parameters of the value network are updated using a loss function. The purpose is to reduce the possibility of the loss value oscillating and diverging during training, maintain the stability of the target value, and thus improve training stability and convergence speed.
[0111] To update the value network parameters ω, the mean squared error is used to define the loss function, as shown in the equation:
[0112] Loss(ω)=E((TarQ-Q(s,a,ω)) 2 (10)
[0113] Where E is the mean squared error; TarQ is the target value, and its calculation formula is as follows:
[0114] TarQ=reward+λmaxQ(s',a',ω - (11)
[0115] Where reward is the reward value for performing action a in state s; λ is 0.9; s' is the next state; a' is the next action; ω -These are the weight parameters of the neural network in the target network.
[0116] After obtaining the loss function from the above formula, the gradient descent algorithm can be directly used to solve for the weight parameter ω of the loss function Loss(ω) of the neural network model. The calculation formula is as follows:
[0117]
[0118] in, It can be computed by a deep neural network. After obtaining the gradient of equation (11), we use stochastic gradient descent to simplify the calculation process and obtain the optimal Q value.
[0119] 7. Fault-tolerant routing method:
[0120] During the routing phase, routing needs to reduce the length of the fluid path while satisfying fault tolerance constraints and avoiding fluid conflicts. To avoid fluid conflicts, this invention sets a priority for fluid transport. When a fluid conflict occurs, a low-priority fluid must wait for a high-priority fluid to leave the conflicting unit before it can continue transporting. Then, a fault-tolerant transport path is constructed through a breadth-first search.
[0121] (1) Fluid priority classification
[0122] Based on the types of components at the beginning and end of fluid transport, fluids are classified into the following three categories:
[0123] 1. Fluid transport from the input port to the mixer: Prioritize transporting fluids that will be mixed earlier; then, prioritize inputting fluids required by mixers that are further from the input port.
[0124] 2. Fluid transported from mixer to mixer: Prioritize transporting fluids that were mixed earlier.
[0125] 3. Fluid transported from the mixer to the output port: Prioritize outputting the fluid in the mixer that is closer to the output port.
[0126] Furthermore, fluid transported from the mixer to the mixer has higher priority than fluid transported from the input port to the mixer. Also, if fluid is transferred to a cell already occupied by another fluid, the fluid within that cell has priority.
[0127] (2) Local wiring based on breadth-first search
[0128] To facilitate wiring, this invention divides the overall wiring into end-to-end local wiring. The total fluid transport path is divided into local paths: fluid is transported from the input port to mixers M1 and M2; fluid is transported from mixers M1 and M2 to mixer M3; fluid is transported from the input port to mixer M3; and fluid is transported from mixer M3 to the output port. A breadth-first search is then performed on each local path, as follows:
[0129] First, initialize a queue and set the starting unit of the wiring as the head of the queue. Then, start traversing. Each traversal requires first taking out the head element of the queue, then inserting the adjacent units that can be wired and have not been visited into the queue, and marking their predecessor nodes as the head element. If the target unit is found, the traversal can be ended directly, and then the shortest path is found based on the predecessor node of the node.
[0130] The above are preferred embodiments of the present invention. Any changes made to the technical solution of the present invention that do not exceed the scope of the technical solution of the present invention shall fall within the protection scope of the present invention.
Claims
1. A fault-tolerant FPVA biochip physical design method based on DQN, characterized in that, First, the layout in the physical design of the FPVA biochip is realized by designing the chip's environment model, action decision model, reward function, and DQN model. Then, based on the layout, the wiring in the physical design of the FPVA biochip is realized using a fluid transport priority strategy and a breadth-first search algorithm. The method includes the following steps: (1) Information mapping stage: The current state of the FPVA biochip is converted into a two-dimensional grid through information mapping. The position of the mixer is represented by the coordinates of the lower left corner cell of the mixer. The information mapping determines whether each cell on the FPVA biochip meets the layout requirements based on the current state of the FPVA biochip. Specifically: Based on four different manifestations of faults, faults are classified into three categories and mapped onto the FPVA biochip. A two-dimensional array is set to represent the state of the FPVA biochip, and the position of the mixer is represented by the coordinates of the lower left corner cell of the mixer. An ε-greedy algorithm is used to select the action strategy, and each action determines the position of a mixer. Mixers are classified according to whether they can be executed concurrently, and the positions of mixers in the same group cannot overlap. A reward function is set to comprehensively consider the chip area occupied by the mixer layout, the Manhattan distance between components with transportation relationships, and the penalty for violating layout constraints, so as to make the mixer layout as compact as possible while satisfying fault tolerance constraints and avoiding component conflicts. (2) Fault-tolerant physical design stage: Based on deep reinforcement learning algorithm, train neural network model to generate the layout timing and position information of mixer, and at the same time ensure that the layout of each mixer satisfies fault-tolerant constraints; specifically: A deep neural network is used instead of a Q-table to generate Q-values corresponding to states and actions. The training objective is to find the optimal policy to maximize the overall reward. The neural network consists of three convolutional layers and two fully connected layers. The size of the input two-dimensional grid is fixed by padding. Each convolutional layer uses a 3×3 kernel. Each unit of the last fully connected layer outputs a Q-value corresponding to an action. The final action output by the network is selected based on the magnitude of the Q-value. The neural network consists of a value network and a target network. The value network is trained based on samples generated from the interaction between the agent and the environment, and the network weight parameters are adjusted. After training, the layout position of the mixer is output according to the current state of the FPVA biochip. The target network has the same structure as the value network. Every certain number of iterations, the parameters of the value network are copied to the target network. The target network is used to calculate the target value, and then the parameters of the value network are updated using a loss function. The loss function is defined using mean squared error, and the weight parameters of the value network are updated using the gradient descent algorithm. (3) Fault-tolerant wiring stage: Based on the timing requirements given in the bioassay, the wiring plan for the fluid is implemented, reducing the length of the fluid path while meeting fault-tolerant constraints and preventing fluid conflicts; specifically: Set priorities for fluid transport. When a fluid conflict occurs, a low-priority fluid must wait for a high-priority fluid to leave the conflicting unit before it can continue transporting. Classify fluids and assign transport priorities based on the component types at the beginning and end of the fluid transport process. Local routing based on breadth-first search: The overall routing is divided into end-to-end local routing, and the total fluid transport path is divided into local paths from the input port to the mixer, from the mixer to the mixer, and from the mixer to the output port. Breadth-first search is performed on each local routing by traversing the adjacent, routable, and unvisited cells of the starting cell until the target cell is found, and the shortest path is found based on the predecessor node of the node.
2. The fault-tolerant FPVA biochip physical design method based on DQN according to claim 1, characterized in that, The specific implementation of step (1) is as follows: (1.1) Fault mapping: Based on the four different manifestations of faults, faults are divided into three categories and mapped onto the FPVA biochip: fault units caused by flow channel blockage and flow channel leakage, blockage units caused by valve blockage, and fusion units caused by valve leakage. Among them, fault units and fusion units connected to fault units cannot be used during layout and wiring. (1.2) Information mapping: To reduce strategy complexity, the current state of the FPVA biochip is converted into a two-dimensional grid through information mapping. The position of the mixer is represented by the coordinates of the bottom-left cell of the mixer. The information mapping determines whether each cell on the FPVA biochip meets the layout requirements based on the current state of the FPVA biochip. This information mapping reduces the complexity of environment updates from log(nm) to log(n). A two-dimensional array is used to represent the state of the FPVA biochip. Where size represents the size of the FPVA biochip, FPVA[x][y] represents the state of the cell at position (x,y) in the FPVA biochip. When the cell is empty, the value of FPVA[x][y] is 0, otherwise it is a value greater than 0. The s() function iterates through and records the state of each cell as the state of the FPVA biochip. (1.3) Action settings: The ε-greedy algorithm is used to select the action policy, where each action determines the position of a mixer: Where action_MaxQ(s,a,ω) represents selecting the action with the largest reward value in the experience, action_random represents randomly generating a new action, s is the current usage state of the FPVA biochip, a is the layout position selected for the current state, ω is the weight parameter of the neural network, c is a random number in the range [0,1], and ε is a fixed value of 0.
3. (1.4) Motion constraints: Since concurrently executing mixers cannot overlap, while non-concurrently executing mixers can overlap, action constraints are used to maximize the overlap area of mixers by selecting actions to ensure that the position of a mixer overlaps with its parent mixer as much as possible. First, mixers are classified according to whether they can be executed concurrently, and mixers in the same group cannot overlap. To ensure that mixers with transport relationships overlap as much as possible, mixers other than those in the first group are only allowed to be placed within the smallest rectangle that contains all their parent mixers. (1.5) Reward function: The goal during the layout phase is to make the mixer layout as compact as possible while satisfying fault tolerance constraints and preventing component conflicts, thereby reducing the path length of fluid transport and the completion time of bioassays; therefore, the reward function is as follows: Where α and β are constant coefficients; S is the chip area occupied by the mixer layout, and its calculation formula is as follows: Where res represents the area of overlap between the layout mixer and its parent mixer. If the layout mixer is the first group of mixers, then res=0. L is the sum of the Manhattan distances between components with a transportation relationship, and its calculation formula is as follows: Where len(i,j) represents the Manhattan distance between component i and component j; father(i) represents the set of components that need to be fed into component i; g is 1 when the corresponding action is to lay out the last set of mixers, otherwise g=0; l represents the Manhattan distance between the mixer and the output port; k is the penalty term for violating layout constraints, and its definition formula is as follows: Where M is a constant with a value of 1000; FPVA[x a ][y a The location of the mixer selected for the action on the FPVA biochip.
3. The fault-tolerant FPVA biochip physical design method based on DQN according to claim 1, characterized in that, Step (2) is implemented as follows: A deep neural network is used instead of a Q-table to generate the Q-value corresponding to a given state and action, as shown below: Where π represents the policy of the neural network, which selects the action a that maximizes the reward value after inputting state s; the goal of training the neural network model is to find an optimal policy π* to maximize the overall reward; the specific formula is as follows: Where Π represents the set of strategies, and R π This represents the sum of rewards obtained under strategy π, and its calculation formula is as follows: Where T represents the total number of decisions required to complete the entire layout, and s t π(s) represents the state of the chip at the t-th decision of the neural network. t ) indicates in s t In the given state, the action selected by policy π, reward(s) t ,π(s t )) indicates that in s t Take action π(s) in the state t The reward value; The neural network consists of three convolutional layers and two fully connected layers; the size of the input two-dimensional grid is fixed at 12×12×1 by padding; each convolutional layer uses a 3×3 kernel with a stride of 1; the fourth fully connected layer consists of 256 units, and the last fully connected layer consists of 144 units. Each unit outputs a Q value corresponding to an action, and the final action output by the network is selected based on the magnitude of the Q value. Neural networks are divided into value networks and target networks. The value network is equivalent to a value function. On one hand, it is trained based on samples generated by the interaction between the agent and the environment, adjusting the network weight parameters and improving the value function. On the other hand, after the neural network is trained, it outputs the layout position of the mixer based on the current state of the FPVA biochip. The target network is a network with the same structure as the value network, but its parameters are not necessarily the same. After a certain number of iterations, the parameters of the value network are copied to the target network. The target network is used to calculate the target value and then update the parameters of the value network using a loss function. To update the value network parameters ω, the mean squared error is used to define the loss function, as shown in the following equation: Where E is the mean squared error; TarQ is the target value, and its calculation formula is as follows: Where reward is the reward value for performing action a in state s; λ is 0.9; s' is the next state; a' is the next action; ω - These are the weight parameters of the neural network in the target network; After obtaining the loss function, the gradient descent algorithm is directly used to solve for the weight parameter ω of the loss function Loss(ω) of the neural network model. The calculation formula is as follows: in, It can be computed by deep neural networks; after obtaining the gradient of TarQ, stochastic gradient descent is used to simplify the calculation process and obtain the optimal Q value.
4. The fault-tolerant FPVA biochip physical design method based on DQN according to claim 1, characterized in that, The specific implementation of step (3) is as follows: During the routing phase, routing needs to reduce the length of fluid paths while satisfying fault tolerance constraints and avoiding fluid conflicts. To avoid fluid conflicts, fluid transport priorities are set. When a fluid conflict occurs, low-priority fluids must wait for high-priority fluids to leave the conflicting cell before continuing transport. Then, a fault-tolerant transport path is constructed using a breadth-first search. Specifically: (3.1) Fluid priority classification Based on the types of components at the beginning and end of fluid transport, fluids are classified into the following three categories: 1) Fluid transported from the input port to the mixer: Prioritize transporting the fluid that performs the mixing operation earlier; based on this, prioritize inputting the fluid required by the mixer that is farther from the input port; 2) Fluid transported from mixer to mixer: Prioritize transporting fluids that were mixed earlier; 3) Fluid transported from the mixer to the output port: Prioritize outputting the fluid in the mixer that is closer to the output port; Fluid transported from the mixer to the mixer has higher priority than fluid transported from the input port to the mixer; at the same time, if fluid is transferred to a cell that is already occupied by another fluid, the fluid in that cell has priority to pass through. (3.2) Local wiring based on breadth-first search The overall wiring is divided into end-to-end local wiring. The total fluid transport path is divided into local paths: fluid transport from the input port to the mixer; fluid transport from the mixer to the mixer; and fluid transport from the mixer to the output port. Then, a breadth-first search is performed on each local path. The method flow is as follows: First, initialize a queue and set the starting unit of the wiring as the head of the queue. Then, start traversing. Each traversal requires first taking out the head element of the queue. Then, insert the adjacent units of the head element that can be wired and have not been visited into the queue and mark their predecessor nodes as the head element. If the target unit is found, end the traversal directly. Then, find the shortest path based on the predecessor node of the node.
