# Optimizing the Heck-Matsuda Reaction in Flow with a Constraint-Adapted Direct Search Algorithm

Daniel Cortes-Borda, Ksenia V. Kutonova, Corentin Jamet, Marina E.

Trusova, Francoise Zammattio, Charlotte Truchet, Mireia Rodriguez-Zubiri,
Francois-Xavier Felpin

► To cite this version:

Daniel Cortes-Borda, Ksenia V. Kutonova, Corentin Jamet, Marina E. Trusova, Francoise Zammattio, et al. "Optimizing the Heck-Matsuda Reaction in Flow with a Constraint-Adapted Direct Search Algorithm." Organic Process Research and Development, 2016, 20 (11), pp.1979-1987. 10.1021/acs.oprd.6b00310. hal-02141343

HAL Id: hal-02141343

https://hal.science/hal-02141343

Submitted on 17 Jul 2019

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Optimizing the Heck-Matsuda Reaction in Flow with a Constraint-Adapted
Direct Search Algorithm

Daniel Cortés-Borda,ᵃᵇ Ksenia V. Kutonova,ᶜ Corentin Jamet,ª Marina, E. Trusova,ᶜ Françoise
Zammattio,ª Charlotte Truchet,ᵇ Mireia Rodriguez-Zubiri,ª François-Xavier Felpin*ª,d

ª Université de Nantes, UFR des Sciences et des Techniques, CNRS UMR 6241, LINA, 2 rue de la Houssinière, 44322 Nantes Cedex 3, France

ᵇ Université de Nantes, UFR des Sciences et des Techniques, CNRS UMR 6230, CEISAM, 2 rue de la Houssinière, 44322 Nantes Cedex 3, France

Department of Biotechnology and Organic Chemistry, National Research Tomsk Polytechnic
University, 634050 Tomsk, Russia

d Institut Universitaire de France, 1 rue Descartes, 75231 Paris Cedex 05, France

*Corresponding Author : fx.felpin@univ-nantes.fr
<figure><img src="image_2.png" /><figcaption>TOC graphic</figcaption></figure>
**Abstract**

The optimization of a palladium-catalyzed Heck-Matsuda reaction using an optimization algorithm is presented. We modified and implemented the Nelder-Mead method in order to perform constrained optimizations in a multidimensional space. We illustrated the power of our modified algorithm through the optimization of a multivariable reaction involving the arylation of a deactivated olefin with an arendiazonium salt. The great flexibility of our optimization method allows to fine-tune experimental conditions according to three different objective functions: maximum yield, highest throughput and lowest production cost. The beneficial properties of flow reactors associated to the power of intelligent algorithms for the fine-tuning of experimental parameters, allowed the reaction to proceed in astonishingly simple conditions unable to promote the coupling through traditional batch chemistry.

**Keywords**

Flow chemistry / Palladium / Heck reaction / Optimization algorithm / Diazonium salts
Introduction

For decades, chemists have mainly focused their creativity on chemical processes while paying little attention to the reaction vessel. As a consequence, the vast majority of synthetic work reported so far have been invented in batch, although many successful transpositions under flow conditions have been reported these last years.¹ Flow chemistry offers many significant improvements over batch chemistry such as better mass and heat transfer, efficient mixing, safety enhancement, reduced reaction time and waste, higher reproducibility, as well as benefits resulting from automation.² The miniaturization of flow devices makes them perfectly sized for the screening and optimization of reactions involving high added value compounds such as elaborated intermediates or expensive organometallic catalysts.

Traditional optimization studies are mainly based on the know-how of chemists and eventually use the principles of Design of Experiment (DoE) methods. While DoE can be automated to speed-up the screening of predetermined experimental conditions and allows response surface modelling, it requires a high number of experiments to locate an optimum.³ DoE has been also studied with flow reactors for the efficient optimization of chemical reactions.⁴ The facile automation of flow devices through the use of integrated software, enabling the programming of predetermined parameters, has allowed the development of solution-phase high throughput (HT) flow chemistry for the synthesis of small libraries⁵ or the simple optimization of reaction conditions.⁶ In order to enhance the throughput of flow devices, the creation of reaction zones, created by programmed delay between injection pulses and separated by fresh solvent, has been proposed.⁷ With these ingenious segmented-type systems, eventually featuring in-line analysis,⁷ᵃ,⁷ᵇ catalyst screening⁷ᵃ,⁷ᵇ and reaction discovery⁷ᶜ,⁷ᵈ have been successfully reported. However, the optimization of complex reactions requires a more rational approach not following predetermined parameters to attain a higher efficiency.

A much more appealing strategy consists in integrating a feedback with intelligent algorithms. This approach enables optimization systems to analyze previous reaction data in order to adapt and modify the following experiments in a short time frame.⁸ This research line has been pioneered by deMello and co-workers for the synthesis of CdSe nanoparticles,⁹ and up to now, the groups of Jensen,¹⁰ Poliakoff,¹¹ Cronin,¹² Ley¹³ Lapkin,¹⁴ and Bourne¹⁵ have contributed to this emerging but still unexplored research area. The challenge associated with
intelligent optimization systems results in the need to perform a constrained optimization without knowledge and *a priori* on the value of reaction parameters, making the optimization of complex reactions a challenge beyond classical optimization techniques.

Optimization of reactions involving organometallic catalysts are usually time-consuming since the optimal conditions depend not only on the value of well-known parameters including the temperature, time and concentration but also, in many examples, on the use of additives such as base and ligand among others. Our team has a long-standing interest for palladium-catalyzed Heck reactions involving arenediazonium salts as arylating agents¹⁶ and we developed several methodologies both in batch¹⁷ and flow¹⁸ modes following a traditional empirical approach for reactions optimization. While the Pd-catalyzed arylation of activated alkenes such as acrylates or styrenes with diazonium salts is now well mastered,¹⁹ the arylation of unactivated acyclic alkenes is one of the synthetic challenges in this research line that has been pioneered by the teams of Correia²⁰ and Sigman.²¹ We also recently reported our own contribution to this research area with the development of a simple catalytic system using 2-pyridinemethanol as inexpensive ligand.²² From these studies we learned that the arylation of acyclic alkenes (i) requires the use of a ligand for stabilizing Pd complexes and (ii) has only found success in batch mode while the use of flow conditions remain unknown. Therefore, we wondered if the better mass and heat transfer and efficient mixing offered by flow chemistry could allow Pd-catalyzed arylation of unactivated alkenes with diazonium salts without the use of any additive including base and ligand for the sake of waste reduction, experimental simplicity and environmental concerns. We reasoned that for tackling such a challenging task with uncertain chances of success, the use of an optimizing algorithm integrating a feedback into the optimization could speed-up the process and increase the opportunity of finding adequate experimental conditions.

In this paper we describe our recent findings on the use of a modified Simplex algorithm for the optimization of a Heck-Matsuda reaction in a flow device, involving the arylation of buten-1,4-diol. Our work culminated with the optimization of the coupling with astonishingly simple experimental conditions not requiring any additive including base and ligand. Moreover, the modified simplex algorithm showed great flexibility since the experimental conditions could be tuned according to the nature of the objective function which could be either the yield, the productivity (mg/h) or the unitary cost (€/g).
## Results and discussion

We recently studied the arylation of *cis*-2-buten-1,4-diol (2) with arendiazonium salts in batch. These studies revealed the need of a ligand for attaining high conversion due to the high susceptibility of Pd complexes to form Pd nanoparticles in MeOH (Scheme 1). With the aim of developing a more practical and sustainable procedure, we reasoned that kinetic enhancements usually observed in flow reactors over conventional batch equipment could allow to simplify drastically the experimental procedure, through the suppression of both ligand and base. In order to address this challenge, we studied a benchmark reaction involving the coupling of *cis*-2-buten-1,4-diol (2) with 4-chlorobenzene diazonium tetrafluoroborate (1).

<figure><img src="image_3.png" /><figcaption>**Scheme 1.** General scheme of the strategy with respect to literature precedents</figcaption></figure>

Little attention has been paid to the Heck-Matsuda reaction in flow conditions.<sup>18,23</sup> However, from these studies and others related to the use of diazonium salts in flow,<sup>24</sup> it became obvious that the high crystallinity of diazonium salts and the rapid decomposition of Pd complexes into Pd NPs depositing on the side of the tubing often led to clogging issues. Therefore, before starting the optimization procedure in flow, a variety of solvents were screened and we found that a mixture of DMF/MeOH (5/1) solubilizes diazonium salt **1** while stabilizing Pd(TFA)<sub>2</sub> with no apparent formation of Pd NPs after 30 min of stirring. The experimental setup consisted in two ways equipped with 1 mL loops (Scheme 2). *Loop A* was loaded with a solution of **1** and **2** in DMF/MeOH with a concentration of 0.1 M and *loop B* was filled with a solution of Pd(TFA)<sub>2</sub> in
DMF/MeOH with the required loading. Each way was pumped with two independent pumps and the flow streams met at a T-shaped mixer (3 µL). The resulting mixture was introduced in a PEEK reactor (5 mL) placed in an oven and finally collected into a fraction collector for offline analysis by GC-MS. The optimization algorithm was fed with the GC yield and proposed a new set of conditions according to the objective function.

<figure><img src="image_4.png" /><figcaption>**Scheme 2.** Overview of the equipment configuration.</figcaption></figure>

**Implementation of the optimization algorithm.** Since there is no *a priori* reaction and gradient information, the objective function must be treated as a “black box” and optimized with an algorithm belonging to the category of direct search methods. We selected the Nelder-Mead Simplex method (see supporting information for details) due to its simplicity, robustness and to its low requirement of function evaluations (experiments) compared to other optimization methods (e.g. gradient-based methods and metaheuristics), making it particularly well suited for expensive-to-evaluate optimization problems.²⁵ Since the Nelder-Mead method is designed for smooth functions, we assume smoothness on the experimental domain of the functions to be optimized. The Nelder-Mead method minimizes (or maximizes) an objective function by exploring the feasible domain of the function with a general simplex (a convex polyhedron formed by $n+1$ vertices, being $n$ the number of independent variables, and each of the vertices a function evaluation). The method successively makes geometrical modifications to the simplex (size and shape) in order to replace the vertex with the worst result by a better point until
convergence on a local optimum. The five possible geometrical modifications of the simplex (reflection, expansion, inside contraction, outside contraction, and shrink) are schematically represented, for two dimensions, in Figure 1. Remarkably, the five geometrical transformations are extrapolated to higher dimensions. For details on how the Nelder-Mead method selects the geometrical transformations of the simplex, please refer to the original publication of the Nelder-Mead method.²⁵ The number of function evaluations of the Nelder-Mead method depends on the number of variables, the nature of the objective function, the distance between the initial simplex and the optimum, the size of the initial simplex, and the geometrical coefficients of the method (reflection, expansion and contraction coefficients). An example of optimization is provided in supporting information.

<figure><img src="image_5.png" /><figcaption>**Figure 1.** Geometrical transformations of the simplex: a) reflection b) expansion c) inside contraction d) outside contraction e) shrink.</figcaption></figure>

Since the Nelder-Mead algorithm has not been initially developed for the specificities of chemical reactions, it was modified and implemented in Matlab to (i) handle the restrictions imposed by the upper and lower bounds of variables and (ii) diversify the search to escape from local optima and find better optima (potentially the global optimum) in multi-optima functions. The flow diagram of the modified method is given in Figure 2.
<figure><img src="image_6.png" /><figcaption>**Figure 2.** Flow diagram of the adapted Nelder-Mead optimization algorithm.</figcaption></figure>

In this work, we attributed four variables to the objective functions, e.g., temperature, residence time, reagents stoichiometry and catalyst loading, leading to a four-dimensional space which cannot be graphically represented. As neither the nature of the objective function nor an expected location of the optimum are known, the starting simplex was randomly located in the feasible domain of the reaction. The modifications to the original Nelder-Mead algorithm that we implemented through Matlab for optimizing the benchmark Heck-Matsuda reaction are discussed below.

**Size of the simplex.** Selecting the adequate size for the initial simplex is not a straightforward task since the vertices must be sufficiently spaced to ensure significantly different results of their function values and let the method establishing the direction of the search. However, very large
simplexes are also not suitable since the search might be interrupted prematurely when it reaches the boundary of the feasible domain of the function. Typically, the initial simplex is given by fixing one of the vertices of the simplex as a random point $X_o$ in the feasible domain of the objective function, and generating the $n$ equidistant vertices as the adjacent points, increasing (or decreasing) one variable at a time by a magnitude $d$, as shown in eq 1. Since the responsiveness of our objective function differs significantly from one variable to another, we selected a specific magnitude $d$ for each variable; the points of our initial simplex being not equidistantly spaced. The value of $d$ was empirically fixed by the minimum change that could be expected in the objective function. The selected values of $d$ were 10 °C, 10 min, -0.33 equiv and 1 mol% for the temperature, residence time, equivalent of diazonium salt **1** with respect to diol **2** and catalyst loading respectively. Due to physical, chemical and economic constraints, we fixed upper and lower bounds for each of the four variables as depicted in the Table 1. With regard to the geometrical coefficients, we selected the reflection coefficient (alpha) = 1, the contraction coefficient (beta) = 0.5, and the expansion coefficient (gamma) = 2.

$$ \begin{bmatrix} X1_o & X2_o & \dots & Xn_o \\ X1_o + d & X2_o & \dots & Xn_o \\ X1_o & X2_o + d & \dots & Xn_o \\ \vdots & \vdots & \ddots & \vdots \\ X1_o & X2_o & \dots & Xn_o + d \end{bmatrix} \quad (1) $$

<table><caption>**Table 1.** Values of the variables in the feasible domain.</caption><thead><tr><th>Variable</th><th>Lower bound</th><th>Upper bound</th></tr></thead><tbody><tr><td>Temperature (°C)</td><td>25</td><td>70</td></tr><tr><td>Residence time (min)</td><td>5</td><td>45</td></tr><tr><td>Equivalent of 1</td><td>0.5</td><td>2</td></tr><tr><td>Catalyst loading (mol%)</td><td>1</td><td>5</td></tr></tbody></table>

**Constraint adaptations.** The Nelder-Mead Simplex method is a direct search optimization algorithm for unconstrained problems. However, the variables of chemical reactions are limited by physical, chemical and economic factors requiring to restrict the search space. The usual strategy to restrict the research space consists in imposing penalties on the points violating the
restrictions,²⁵ forcing the simplex to remain within the delimited domain. However, when the optimum lies on the boundary (which is very likely in our case), the method requires successive contractions and numerous evaluation functions to place the point on the border (see Figure S2). In order to reduce the number of costly experiments, we modified the algorithm to contract the simplex by projecting the point falling out of the feasible domain on the boundary, as shown in Figure 3 on a simplified 2-dimension example.

<figure><img src="image_7.png" /><figcaption>**Figure 3.** Modification of the Nelder-Mead method to project the points falling out of the feasible domain on the boundary. The reflected point *A'* leads to an expansion *A'''* out of the feasible domain, which is projected on the boundary at *A''*.</figcaption></figure>

**Dimensionality reduction of the search.** It is worth mentioning that in an *n*-dimension problem, only up to *n* points of the simplex can be projected on the boundary since projecting the *n*+1 points on the boundary would (i) prevent the simplex from escaping from the boundary if required, and (ii) affect the convexity of the simplex (Figure S3). To prevent the method from projecting more than *n* points of the simplex on the boundary, we modified the algorithm to
reduce the dimension of the search and explore the boundary where the *n* points are projected.
Our modification consists in stopping the *n*-dimension Nelder-Mead search when the method
attempts to project the *n+1*th points on the boundary, and starting a new (*n-1*)-dimension search
over the boundary where the *n* points of the simplex are projected (see supporting information for
details, Figures S4-S5).

**Dimension recovery.** Reducing the dimension of the search results in a reduction of the number of function evaluations, as long as the optimum belongs to the boundary in which the search is performed. However, when the global optimum is located outside of the boundary the algorithm is required to explore more exhaustively the feasible domain. Therefore, this point is a good candidate to start a new *n*-dimension search since the global optimum could likely be found in its vicinity. To restore the original dimension search, we replicated the geometry of the last simplex generated before the dimension reduction and translated it on the constrained optimum found on the boundary (see a 2-dimension example in Figure 4). We prevented the method from exploring sections of the boundary that were already explored using penalties. If no better points are found in the vicinity of the new *n*-dimensional simplex, the method returns to the boundary by performing successive contractions of the simplex and stops the search.
<figure><img src="image_8.png" /><figcaption>**Figure 4.** 2-Dimension representation of the translation of the reflected simplex in order to recover the dimension of the search. The simplex *A'*-*B'*-*C* is reflected perpendicularly to the upper bound of variable 1 and translated towards the optimum found on the boundary (constrained optimum). The 2-dimension search re-starts with the simplex *M*-*N*-*O*. The penalties on the explored regions of the boundary force the reflected point *N'*\* to contract towards *N*'.</figcaption></figure>

***Stopping criteria.*** Typically, the Nelder-Mead search is terminated (i) when either the simplex gets small enough around the optimum or (ii) the standard deviation of the function values at the vertices are very small,²⁶ requiring an extensive number of experiments. With the aim of reducing the number of expensive experiments, we additionally implemented the following stopping criteria, considering that the search stops when any of the stopping criteria is reached.

(iii) If the objective function is bounded by a known/expected value (e.g., 100% of reaction yield) the search stops without performing further experiments.

(iv) The method stops after having performed a predefined maximum number of function evaluations. The best point obtained along the exploration is considered as the optimum but the
user might consider it useful to re-start the method from a new random point to find other potential optima in the unexplored domain.

(v) Nearby an optimum, the simplex contracts and shrinks until all the vertices of the simplex approach to the optimum. As this process costs numerous function evaluations, we stop the search when the best result obtained is not improved after $n+1$ consecutive simplexes (the number of simplexes is different from the number of experiments, for details please refer to the supporting information). The number of allowed attempts to replace the optimum ($n+1$) corresponds to the number of the vertices of the simplex, meaning that each point has at least one opportunity to be replaced. This shortcut stopping criterion is meant to reach near optimal (or optimal) results within a low number of function evaluations. It is activated in two cases: either when the simplex falls in a valley of the objective function without improving the result, or when the search is focused in the neighborhood of an optima with asymptotical improvement of the result. In both cases, the user (in the feedback stage) could still decide to continue via diversification (in case of falling in a valley of the objective function) or via intensification (in case of falling in the neighborhood of an optima.

**User decision: Intensification, diversification and termination.** Optimization problems treated as a “black box” require a tradeoff between the quality of the result obtained and the number of function evaluations being under the responsibility of the user for prioritizing the best alternative. In our modified Nelder-Mead Simplex method we implemented a feedback stage for a dialogue between the user and the optimization algorithm, simplifying the decision-making process. After finding one of the stopping criteria described above, the method proposes to the user three different alternatives: (i) continue with the Nelder-Mead search (intensification), (ii) start a new Nelder-Mead search from a new random point (diversification) or (iii) terminate the optimization algorithm (Figure 2).

(i) Intensification. While the Nelder-Mead method improves rapidly the result at the beginning of the exploration, upon increasing the number of experiments the result improves asymptotically, meaning that it requires several function evaluations to attain the optimum. When the method locates a potential optimum without spending numerous function evaluations, the user can decide to continue with the Nelder-Mead search and improve the result at expenses of performing extra experiments. This approach is particularly helpful to overcome premature termination of the exploration.
(ii) Diversification. The Nelder-Mead method is a direct search optimization algorithm, which is not able to escape from a local optimum. In order to escape from a local optimum and diversify the search, the user can decide to re-start the Nelder-Mead method from a random point outside of the explored domain while using penalties to prevent the algorithm from falling in already explored regions. This multi-start strategy is suitable to tackle multi-optima objective functions.

(iii) Termination. The user can decide to stop the method without performing any further experiment when either the number of evaluations is too high or the result obtained fills the expectations.

It is worth mentioning that the algorithm is able to run automatically without user interaction. We consider, however, that the user feedback is certainly a guarantee for obtaining the best possible result in a minimum number of experiments.

**Optimization of the Heck-Matsuda reaction.** The modified Nelder-Mead algorithm was used for the optimization of three different objective function, e.g., (i) maximization of the yield, (ii) maximization of the productivity expressed as mg/h and (iii) minimization of the production cost expressed as €/g of product 3. The three optimizations started from the same initial simplex, constructed with the point $X_o$ at 30 °C, 5 min of residence time, 1 equiv of diazonium salt 1 and 1 mol% of Pd(TFA)₂, and using the values of *d* given in the methodology (vide supra). Since the optimization was carried out with four variables, the initial simplex is formed by 5 points (Table 2). While multi-optima might exist in the optimized functions, we considered useless to perform a multi-start search (diversification) at the user feedback stage since we already obtained high quality optima in a low number of experiments.

<table><caption>**Table 2.** Parameters of the initial simplex and optimal conditions for the three objective functions</caption><thead><tr><th>Run</th><th>Temp. (°C)</th><th>Residence time (min)</th><th>Equiv. 1</th><th>Catalyst loading (mol%)</th><th>Yield (%)</th><th>Objective Function</th></tr></thead><tbody><tr><td>1</td><td>30</td><td>5</td><td>1</td><td>1</td><td>6</td><td>--</td></tr><tr><td>2</td><td>40</td><td>5</td><td>1</td><td>1</td><td>9</td><td>--</td></tr><tr><td>3</td><td>30</td><td>15</td><td>1</td><td>1</td><td>6</td><td>--</td></tr><tr><td>4</td><td>30</td><td>5</td><td>0.67</td><td>1</td><td>3</td><td>--</td></tr><tr><td>5</td><td>30</td><td>5</td><td>1</td><td>2</td><td>24</td><td>--</td></tr><tr><td>Optimum (i)</td><td>52.5</td><td>31.3</td><td>1.33</td><td>5</td><td>92</td><td>92%</td></tr></tbody></table>
<table><tr><td>Optimum (ii)</td><td>63.3</td><td>5</td><td>2</td><td>4.3</td><td>67</td><td>427.1 mg/h</td></tr><tr><td>Optimum (iii)</td><td>54.5</td><td>11.4</td><td>1.43</td><td>2.1</td><td>77</td><td>8.51 €/g</td></tr></table>

(i) *Maximization of the yield.* From the 5 initial experiments forming the first simplex, the best yield (24%) was obtained when the catalyst loading was increased from 1 to 2 mol% (Table 2, run 5), revealing the high impact of this variable on the optimization. Having constructed the initial simplex, the method started the optimization of the reaction yield. The 4-dimension optimization required 14 experiments to improve the yield from 6% to 92% (Figure 5). This result is very impressive as this excellent yield was reached with a limited number of experiments and neither a base, nor a ligand were required for the coupling while the same benchmark reaction conducted in batch reached only 24% yield in the absence of ligand.²⁷ The 4-dimension search stopped at the 14th experiment (optimum i, Table 2), since continuing the search would result in deforming the simplex by projecting all of its vertices on the boundary where the catalyst loading reaches its upper bound (5 mol%). According to the flow diagram depicted in Figure 2, the algorithm performed a 3-dimension Nelder-Mead search over the boundary by fixing the catalyst loading to 5 mol%, but unfortunately, without finding better results. Therefore, the 14th experiment (92% yield) was considered as the optimum since we reached a stopping criterion after n+1 consecutive simplexes without improving the result. We should mention that the optimum was found in the 14th experiment but the algorithm took 20 experiments to reach the stopping criterion (see Table S1 in Supporting Information for details on the 20 experiments).
<figure><img src="image_9.png" /></figure>

<figure><img src="image_10.png" /><figcaption>**Figure 5.** (a) Results of the maximization of the yield in 4-dimension. (b) Representation of the 4-dimension experimental conditions of the maximization of the yield.</figcaption></figure>

(ii) *Maximization of the throughput (mg/h)*. While in batch the maximization of the yield is usually one of the most important objectives of synthetic chemists, this parameter is less relevant for continuous flow chemistry whose efficiency is more adequately described by the throughput expressed as the number of mole of the product per time unit. The method started with the same initial simplex in 4 dimensions, and immediately after, the method reduced the search into a 3-dimension space by fixing the residence time to its lower bound (5 min). After 7 experiments (Figure 6a), including the initial simplex, the throughput increased by one order of magnitude with respect to the first point, from 38.3 mg/h to 427.1 mg/h (Table 2). The 3-dimensional search was stopped after generating *n+1* simplexes without improving the result. The 4-dimension search was recovered after 7 experiments to explore the vicinity of the potential optimum. Since no better results were found, the 7th experiment was considered as the optimum and we decided
to stop the optimization (in the feedback stage of the algorithm). The algorithm required only 13 experiments (Figure 6b) (including the dimension reduction and dimension recovery) to reach the stopping criterion (see Table S2 in Supporting Information for details on the 13 experiments).

<figure><img src="image_11.png" /><figcaption>**Figure 6.** (a) Results of the maximization of the throughput. The initial simplex corresponds to the 4-dimension search and points 6-7 to the 3-dimension search. (b) Representation of the 4-dimension experimental conditions of the maximization of the throughput.</figcaption></figure>

(iii) *Minimization of the production cost of product 3 (€/g).* While the maximization of the throughput is an important parameter related to the reaction efficiency, it does not consider the cost of the product synthesis. In the industrial environment both the throughput and the cost are crucial parameters for evaluating the economic viability of a synthesis. The maximization of the yield or the throughput of a catalytic reaction are often plagued by a high loading of the catalyst which is usually an expensive reagent. Our optimizations are no exception, since our conditions
related to the best yield and highest throughput require 5 and 4.3 mol% Pd respectively. Therefore, we decided to optimize the production cost (PC) of product **3** which is given by equation 2 where *E* is the power consumption (electricity) and *C* is the cost of chemicals (starting materials and catalyst) per gram of compound **3** produced. *E* was computed as the power consumption of two pumps (*E*<sub>p</sub>) and an oven (*E*<sub>o</sub>) while *C* is the addition of the cost of diazonium salt **1** (*C*<sub>ds</sub>), diol **2** (*C*<sub>d</sub>) and Pd catalyst (*C*<sub>Pd</sub>). The power consumption of the pumps and oven are given as a function of time in equations 3 and 4 respectively, where *W*<sub>p</sub> and *W*<sub>o</sub> is the average power of the pumps and oven respectively, *t* is the time and *Ce* is the cost of electricity (0.15 €/kWh) for France in 2016. With flow rates ranging from 0.05 to 0.5 ml/min, the power consumption *W*<sub>p</sub> was measured as 0.026 kW per pump while the average power consumption of the oven (in kW) is given by a linear function of the temperature in equation 5 in the operational range of 25 to 70 °C.

$$PC = E + C \qquad (2)$$

$$E_p^i = W_p \cdot t \cdot C_e \qquad (3)$$

$$E_o = W_o \cdot t \cdot C_e \qquad (4)$$

$$W_o = 0.0017T - 0.0339 \qquad (5)$$

Regarding the cost of chemicals, we neglected the solvents and the cost of starting materials and catalyst materials was established as follow: diazonium salt **1** = 1.42 €/g, diol **2** = 0.11 €/g and Pd catalyst = 131.80 €/g. The objective of this study was to show the power of algorithm to help chemists in minimizing the cost of a chemical synthesis, but we were aware that the values computed reflected an incomplete part of the cost since several parameters including isolation, purification, transportation and salary expenses were not considered.

After the initial simplex, the optimization started without falling in the boundaries of the feasible domain and no dimensionality reduction was required. After 11 experiments, the algorithm found a potential optimum corresponding to *ca.* 9.91 €/g (Figure 7a). The algorithm continued the search and generated *n*+1 simplexes (corresponding to 6 experiments) but unfortunately without improving the result. Since this value was considered unacceptable, we decided to continue the search (via the feedback stage) to improve the result at the expense of new experiments (intensification). A new optimum point corresponding to *ca.* 8.51 €/g was
located at the 18th experiment and the method search stopped because the exploration reached the pre-defined maximum number of experiments accepted by the user (25 experiments). Figure 7b shows the experimental conditions of the 25 points, noting that the major improvements on the results are attained in the first 8 experiments (see Table S3 in Supporting Information for details). Remarkably, in this study we were able to reduce the production cost by a factor of approximately 7, from ca. 60.63 to 8.51 €/g in only 18 experiments.

<figure><img src="image_12.png" /><figcaption>**Figure 7.** (a) Representation of the 4-dimension experimental conditions of the minimization of the production cost of 3. (b) Results of the minimization of the production cost of product 3 with a 4-dimension search.</figcaption></figure>
**Conclusion**

In summary, we demonstrated that the use of an intelligent algorithm speed-up and simplifies optimization processes in flow. We implemented the Nelder-Mead optimization algorithm to perform multivariable reaction optimizations in a 4-dimension space with a variety of objective functions. Through the study of a benchmark reaction involving the palladium-catalyzed coupling of an arenediazonium salt with an allylic diol, we were able to fine-tune experimental conditions according to the objective functions which can be the (i) maximum yield, (ii) highest throughput or (iii) lowest production cost. Remarkably, the combination of flow reactors with intelligent algorithms allowed transformations that are not possible with traditional batch reactors. This technology can certainly be applied for optimizations having a higher number of variables and exciting advancements in the near future will consist in using more sophisticated flow setups for the optimization of multicatalytic or multistep processes. Our current studies are focusing on these promising developments and will be communicated in due course.

**Experimental section**

**Materials.** All commercial reagents were used as received from Sigma-Aldrich, Fischer Scientific Ltd and Alfa Aesar. Extra pure methanol and DMF were used without further purification.

**Methods.** Purification of product 3 was carried out by flash column chromatography using silica gel (40–30 mm). Analytical thin layer chromatography (TLC) was performed on 0.25 mm silica gel 60-F254 plates. Visualization was accomplished using a UV lamp (254 nm). ¹H and ¹³C NMR spectra were recorded at 300 MHz and 75 MHz respectively, and they are reported as *δ* values (ppm) relative to residual CDCl₃ *δ* H (7.26 ppm) and CDCl₃ *δ* C (77.00 ppm) as internal standards. Low resolution mass spectroscopy (LRMS) was performed using chemical ionization (CI). High resolution mass spectroscopy (HRMS) was recorded on an orbitrap spectrometer. The GC analyses were performed on a GC-FID Agilent 7820A chromatograph equipped with a 30 m HP5 capillary column. The GC-MS analyses were recorded on a TRACE GC Ultra (ThermoScientific) apparatus equipped with a 30 m TR-5MS silica capillary column and a DSQII
quadrupole analyser (ThermoScientific). Sample loops and reactors were made out of PEEK with a 0.75 mm internal diameter. T-mixers were made out of PEEK with an internal volume of 3 µL, and connecting tubing was made out of PFA with a 0.75 mm internal diameter.

**Reaction setup for the Optimization of the Heck–Matsuda Reaction Using a Flow Device.**

The experimental setup consisted in two ways equipped with 1 mL loops. A DMF/MeOH (5/1) solution of buten-1,4-diol (0.1 M) and the required amount of 4-chlorobenzene diazonium tetrafluoroborate were loaded in loop *A* (1 mL) at 25 °C. A solution of the required amount of Pd(TFA)₂ in DMF/MeOH (5/1) was loaded in loop *B* (1 mL) at 25 °C. Each way was pumped with two independent pumps at the required flow rate and the resulting flow streams went through a T-shaped mixer (3 µL). The resulting mixture was introduced in a PEEK reactor (5 mL) placed in an oven. The reaction is conducted at the corresponding temperature and finally collected into a fraction collector for offline analysis by GC-MS. The collected fraction was diluted with DMF/MeOH (5/1) in a 25 mL volumetric flask. An aliquot of the diluted crude mixture (1 mL) was transferred to a chromatography vial containing a known amount of internal standard (*n*-dodecane) and analyzed by GC-MS. The optimization algorithm was fed with the GC yield (calibrated in the presence of *n*-dodecane as internal standard) and proposed new values of temperature, flow rate, amount of 4-chlorobenzene diazonium tetrafluoroborate and Pd(TFA)₂ loading. The process was repeated until reaching the termination criterion of the optimization algorithm.

Product **3** was obtained as a mixture of diastereomers (58:42). The NMR data are consistent with literature precedent.²⁰ᵃ *Major diastereomer:* ¹H NMR (300 MHz, CDCl₃) *δ* (ppm) 7.25-7.28 (m, 2H), 7.14-7.17 (m, 2H), 5.14 (dd, 1H, *J* = 2.5, 5.8 Hz), 4.29 (t, 1H, *J* = 8.3 Hz), 3.79 (dd, 1H, *J* = 6.9, 8.4 Hz), 3.54-3.62 (m, 1H), 3.38 (s, 3H), 2.32 (dd, 1H, *J* = 7.7, 12.9 Hz), 2.04 (ddd, 1H, *J* = 5.1, 9.3, 13.1 Hz); *Minor diastereomer:* ¹H NMR (300 MHz, CDCl₃) *δ* 7.25-7.28 (m, 4H), 5.16 (d, 1H, *J* = 4.4 Hz), 4.17 (t, 1H, *J* = 8.1 Hz), 3.72 (dd, 1H, *J* = 8.5, 9.7 Hz), 3.42 (s, 3H), 3.32-3.36 (m, 1H), 2.59 (ddd, 1H, *J* = 5.5, 10.3, 13.7 Hz), 1.91 (ddd, 1H, *J* = 2.4, 7.7, 10.2 Hz); ¹³C NMR (75 MHz, CDCl₃) *δ* (ppm) 141.4, 140.0, 132.4, 132.3, 129.1, 128.7, 128.7, 128.5, 105.7, 105.4, 73.7, 73.0, 54.9, 54.7, 43.6, 42.1, 41.4, 41.1.
**Acknowledgment**

This work was supported by the "Région des Pays de la Loire" in the framework of the "Paris Scientifique Régionaux." DCB gratefully acknowledge the "Région des Pays de la Loire" for a grant. FXF is member of the "Institut Universitaire de France, IUF."

**Supporting Information**

Preliminary simulations of the algorithm, additional descriptions of the simplex method optimization, values of the variables for all experiments, NMR and GC-MS spectra of the product are provided.

**References**

(1) (a) Ley, S. V. *Chem. Rec.* **2012**, *12*, 378. (b) Protasova, L. N.; Bulut, M.; Ormerod, D.; Buekenhoudt, A.; Berton, J.; Stevens, C. V. *Org. Process Res. Dev.* **2013**, *17*, 760. (c) Chinnusamy, T.; Yudha S, S.; Hager, M.; Kreitmeier, P.; Reiser, O. *ChemSusChem* **2012**, *5*, 247. (d) Noel, T.; Buchwald, S. L. *Chem. Soc. Rev.* **2011**, *40*, 5010. (e) McQuade, D. T.; Seeberger, P. H. *J. Org. Chem.* **2013**, *78*, 6384. (f) Sipos, G.; Gyollai, V.; Sipőcz, T.; Dormán, G.; Kocsis, L.; Jones, R.; Darvas, F. *J. Flow Chem.* **2013**, *3*, 51. (g) Plouffe, P.; Macchi, A.; Roberge, D. M. *Org. Process Res. Dev.* **2014**, *18*, 1286. (h) Porta, R.; Benaglia, M.; Puglisi, A. *Org. Process Res. Dev.* **2016**, *20*, 2.

(2) (a) Wegner, J.; Ceylan, S.; Kirschning, A. *Chem. Commun.* **2011**, 4583. (b) Poechlauer, P.; Colberg, J.; Fisher, E.; Jansen, M.; Johnson, M. D.; Koenig, S. G.; Lawler, M.; Laporte, T.; Manley, J.; Martin, B.; O'Kearney-McMullan, A. *Org. Process Res. Dev.* **2013**, *17*, 1472. (c) Vaccaro, L.; Lanari, D.; Marrocchi, A.; Strappaveccia, G. *Green Chem.* **2014**, *16*, 3680. (d) Brzozowski, M.; O'Brien, M.; Ley, S. V.; Polyzos, A. *Acc. Chem. Res.* **2015**, *48*, 349. (e) Gutmann, B.; Cantillo, D.; Kappe, C. O. *Angew. Chem. Int. Ed.* **2015**, *54*, 6688. (f) Ley, S. V.; Fitzpatrick, D. E.; Ingham, R. J.; Myers, R. M. *Angew. Chem. Int. Ed.* **2015**, *54*, 3449. (g)
Movsisyan, M.; Delbeke, E. I. P.; Berton, J. K. E. T.; Battilocchio, C.; Ley, S. V.; Stevens, C. V. *Chem. Soc. Rev.* **2016**, *45*, 4892.

(3) (a) Gooding, O. W. *Curr. Opin. Chem. Biol.* **2004**, *8*, 297. (b) Tye, H. *Drug Discovery Today* **2004**, *9*, 485.

(4) (a) Koch, K.; van Weerdenburg, B. J. A.; Verkade, J. M. M.; Nieuwland, P. J.; Rutjes, F. P. J. T.; van Hest, J. C. M. *Org. Process Res. Dev.* **2009**, *13*, 1003. (b) Nieuwland, P. J.; Koch, K.; van Harskamp, N.; Wehrens, R.; van Hest, J. C. M.; Rutjes, F. P. J. T. *Chem. Asia. J.* **2010**, *5*, 799.

(5) Herath, A.; Dahl, R.; Cosford, N. D. P. *Org. Lett.* **2010**, *12*, 412.

(6) (a) Sugimoto, A.; Fukuyama, T.; Rahman, M. T.; Ryu, I. *Tetrahedron Lett.* **2009**, *50*, 6364.

(b) Fukuyama, T.; Kawamoto, T.; Kobayashi, M.; Ryu, I. *Beilstein J. Org. Chem.* **2013**, *9*, 1791.

(c) Wiles, C.; Watts, P. *Beilstein J. Org. Chem.* **2011**, *7*, 1360. (d) Mohamed, D. K. B.; Yu, X.; Li, J.; Wu, J. *Tetrahedron Lett.* **2016**, *57*, 3965.

(7) (a) Shi, G.; Hong, F.; Liang, Q.; Fang, H.; Nelson, S.; Weber, S. G. *Anal. Chem.* **2006**, *78*, 1972. (b) Fang, H.; Xiao, Q.; Wu, F.; Floreancig, P. E.; Weber, S. G. *J. Org. Chem.* **2010**, *75*, 5619. (c) Goodell, J. R.; McMullen, J. P.; Zaborenko, N.; Maloney, J. R.; Ho, C.-X.; Jensen, K. F.; Porco, J. A.; Beeler, A. B. *J. Org. Chem.* **2009**, *74*, 6169. (d) Treece, J. L.; Goodell, J. R.; Velde, D. V.; Porco, J. A.; Aubé, J. *J. Org. Chem.* **2010**, *75*, 2028.

(8) (a) Rasheed, M.; Wirth, T. *Angew. Chem. Int. Ed.* **2011**, *50*, 357. (b) Fabry, D. C.; Sugiono, E.; Rueping, M. *Isr. J. Chem.* **2014**, *54*, 341. (c) Fabry, D. C.; Sugiono, E.; Rueping, M. *React. Chem. Eng.* **2016**, *1*, 129. (d) Sans, V.; Cronin, L. *Chem. Soc. Rev.* **2016**, *45*, 2032. (e) Reizman, B. J.; Jensen, K. F. *Acc. Chem. Res.* **2016**, *49*, 1786.

(9) Krishnadasan, S.; Brown, R. J. C.; deMello, A. J.; deMello, J. C. *Lab on a Chip* **2007**, *7*, 1434.

(10) (a) McMullen, J. P.; Jensen, K. F. *Org. Process Res. Dev.* **2010**, *14*, 1169. (b) McMullen, J. P.; Stone, M. T.; Buchwald, S. L.; Jensen, K. F. *Angew. Chem. Int. Ed.* **2010**, *49*, 7076. (c) Moore, J. S.; Jensen, K. F. *Org. Process Res. Dev.* **2012**, *16*, 1409. (d) Reizman, B. J.; Jensen, K. F. *Chem. Commun.* **2015**, *51*, 13290.

(11) (a) Bourne, R. A.; Skilton, R. A.; Parrott, A. J.; Irvine, D. J.; Poliakoff, M. *Org. Process Res. Dev.* **2011**, *15*, 932. (b) Parrott, A. J.; Bourne, R. A.; Akien, G. R.; Irvine, D. J.; Poliakoff, M. *Angew. Chem. Int. Ed.* **2011**, *50*, 3788. (c) Amara, Z.; Streng, E. S.; Skilton, R. A.; Jin, J.; George, M. W.; Poliakoff, M. *Eur. J. Org. Chem.* **2015**, 6141.
(12) Sans, V.; Porwol, L.; Dragone, V.; Cronin, L. *Chem. Sci.* **2015**, *6*, 1258.

(13) Fitzpatrick, D. E.; Battilocchio, C.; Ley, S. V. *Org. Process Res. Dev.* **2016**, *20*, 386.

(14) Houben, C.; Peremezhney, N.; Zubov, A.; Kosek, J.; Lapkin, A. A. *Org. Process Res. Dev.* **2015**, *19*, 1049.

(15) (a) Holmes, N.; Akien, G. R.; Blacker, A. J.; Woodward, R. L.; Meadows, R. E.; Bourne, R. A. *React. Chem. Eng.* **2016**, *1*, 366. (b) Holmes, N.; Akien, G. R.; Savage, R. J. D.; Stanetty, C.; Baxendale, I. R.; Blacker, A. J.; Taylor, B. A.; Woodward, R. L.; Meadows, R. E.; Bourne, R. A. *React. Chem. Eng.* **2016**, *1*, 96.

(16) (a) Felpin, F.-X.; Nassar-Hardy, L.; Le Callonnec, F.; Fouquet, E. *Tetrahedron* **2011**, *67*, 2815. (b) Oger, N.; d'Halluin, M.; Le Grognec, E.; Felpin, F.-X. *Org. Process Res. Dev.* **2014**, *18*, 1786. (c) Oger, N.; Le Grognec, E.; Felpin, F.-X. *Org. Chem. Front.* **2015**, *2*, 590.

(17) (a) Le Callonnec, F.; Fouquet, E.; Felpin, F.-X. *Org. Lett.* **2011**, *13*, 2646. (b) Susperregui, N.; Miqueu, K.; Sotiropoulos, J.-M.; Le Callonnec, F.; Fouquet, E.; Felpin, F.-X. *Chem. Eur. J.* **2012**, *18*, 7210. (c) Felpin, F.-X.; Miqueu, K.; Sotiropoulos, J.-M.; Fouquet, E.; Ibarguren, O.; Laudien, J. *Chem. Eur. J.* **2010**, *16*, 5191. (d) Oger, N.; Le Callonnec, F.; Jacquemin, D.; Fouquet, E.; Le Grognec, E.; Felpin, F.-X. *Adv. Synth. Catal.* **2014**, *356*, 1065. (e) Oger, N.; Le Grognec, E.; Felpin, F.-X. *ChemCatChem* **2015**, *7*, 2085. (f) Kutonova, K. V.; Trusova, M. E.; Stankevich, A. V.; Postnikov, P. S.; Filimonov, V. D. *Beilstein J. Org. Chem.* **2015**, *11*, 358.

(18) Oger, N.; Le Grognec, E.; Felpin, F.-X. *J. Org. Chem.* **2014**, *79*, 8255.

(19) (a) Taylor, J. G.; Moro, A. V.; Correia, C. R. D. *Eur. J. Org. Chem.* **2011**, 1403. (b) Roglans, A.; Pla-Quintana, A.; Moreno-Mañas, M. *Chem. Rev.* **2006**, *106*, 4622. (c) Schmidt, B.; Elizarov, N. *Chem. Commun.* **2012**, *48*, 4350. (d) Schmidt, B.; Elizarov, N.; Berger, R.; Hölter, F. *Org. Biomol. Chem.* **2013**, *11*, 3674. (e) Schmidt, B.; Wolf, F.; Brunner, H. *Eur. J. Org. Chem.* **2016**, 2972.

(20) (a) Oliveira, C. C.; Angnes, R. A.; Correia, C. R. D. *J. Org. Chem.* **2013**, *78*, 4373. (b) Oliveira, C. C.; Pfaltz, A.; Correia, C. R. D. *Angew. Chem. Int. Ed.* **2015**, *54*, 14036.

(21) Werner, E. W.; Mei, T.-S.; Burckle, A. J.; Sigman, M. S. *Science* **2012**, *338*, 1455.

(22) Khodja, W.; Leclair, A.; Rull-Barrull, J.; Zammattio, F.; Kutonova, K. V.; Trusova, M. E.; Felpin, F.-X.; Rodriguez-Zubiri, M. *New J. Chem.* **2016**, *40*, 8855.
(23) (a) Ahmed, B.; Barrow, D.; Wirth, T. *Adv. Synth. Catal.* **2006**, *348*, 1043. (b) Ahmed-Omer, B.; Barrow, D. A.; Wirth, T. *Tetrahedron Lett.* **2009**, *50*, 3352. (c) Nalivela, K. S.; Tilley, M.; McGuire, M. A.; Organ, M. G. *Chem. Eur. J.* **2014**, *20*, 6603.

(24) (a) Malet-Sanz, L.; Madrzak, J.; Ley, S. V.; Baxendale, I. R. *Org. Biomol. Chem.* **2010**, *8*, 5324. (b) Smith, C. J.; Nikbin, N.; Ley, S. V.; Lange, H.; Baxendale, I. R. *Org. Biomol. Chem.* **2011**, *9*, 1938. (c) Smith, C. J.; Smith, C. D.; Nikbin, N.; Ley, S. V.; Baxendale, I. R. *Org. Biomol. Chem.* **2011**, *9*, 1927. (d) Chernyak, N.; Buchwald, S. L. *J. Am. Chem. Soc.* **2012**, *134*, 12466. (e) Hu, D. X.; O'Brien, M.; Ley, S. V. *Org. Lett.* **2012**, *14*, 4246. (f) Li, B.; Widlicka, D.; Boucher, S.; Hayward, C.; Lucas, J.; Murray, J. C.; O'Neil, B. T.; Pfisterer, D.; Samp, L.; VanAlsten, J.; Xiang, Y.; Young, J. *Org. Process Res. Dev.* **2012**, *16*, 2031. (g) Yu, Z.; Lv, Y.; Yu, C. *Org. Process Res. Dev.* **2012**, *16*, 1669. (h) Chen, M.; Buchwald, S. L. *Angew. Chem. Int. Ed.* **2013**, *52*, 4247. (i) Wang, X.; Cuny, G. D.; Noël, T. *Angew. Chem. Int. Ed.* **2013**, *52*, 7860.

(j) Bhaya, V.; Joshi, R.; Kulkarni, A. *J. Flow Chem.* **2014**, *4*, 210. (k) Shukla, C. A.; Kulkarni, A. A.; Ranade, V. V. *React. Chem. Eng.* **2016**, *1*, 387.

(25) Nelder, J. A.; Mead, R. *Comput. J.* **1965**, *7*, 308.

(26) Ravindran, A.; Ragsdell, K. M.; Reklaitis, G. V. *Engineering Optimization: Methods and Applications*; John Wiley & Sons, Inc., 2007.

(27) Khodja, W.; Leclair, A.; Rull-Barrull, J.; Zammattio, F.; Kutonova, K. V.; Trusova, M. E.; Felpin, F.-X.; Rodriguez-Zubiri, M. *New J. Chem.* **2016**, *10.1039/c6nj01717g*.