{"id":2506,"date":"2023-06-28T14:53:59","date_gmt":"2023-06-28T14:53:59","guid":{"rendered":"https:\/\/nag.com\/?page_id=2506"},"modified":"2024-02-21T14:18:05","modified_gmt":"2024-02-21T14:18:05","slug":"solving-convex-problems-with-second-order-cone-programming-socp","status":"publish","type":"page","link":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/","title":{"rendered":"Solving Convex Problems with Second-order Cone Programming (SOCP)"},"content":{"rendered":"\n<div class=\"gbc-title-banner ta ta-lg ta-xl\" style='background-color: #082d48ff; color: #ffffffff; border-radius: 0px; '>\n    <div class=\"container\" style='border-radius: 0px; '>\n        <div class=\"row justify-content--center\" style='color: #ffffffff;'>\n            <div class=\"col-12\"  >\n                <div class=\"wrap pv-4 \" style=\"0px\">\n                                <div class=\"col-12 col-md-12 col-lg-10 col-xl-8  banner-content\"  >\n    \n                                             <h1>Solving Convex Problems with Second-order Cone Programming (SOCP)<\/h1>\n                    \n                    <div class=\"mt-1 mb-1 content\"><\/div>\n\n                    \n                                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<!-- Spacer -->\n<div class=\"pt-4 pt-lg-4 pt-xl-4\" ><\/div>\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <div class=\"paragraph--color--transparent paragraph--alignment--left paragraph paragraph--type--text paragraph--view-mode--default\">\n<div class=\"field field--name-field-paragraph-text field--type-text-long field--label-hidden field--item\">Second-order cone programming (SOCP) offers a robust and efficient way of solving several types of convex problems, including convex quadratically constrained quadratic programming (QCQP) problems. That is the reason why it can be highly utilized in a broad range of\u2000fields, like \u2000finance. At Mark 29.3 of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library, <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG introduces a performance update to the SOCP solver (<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/clhtml\/e04\/e04ptc.html\">nag_opt_handle_solve_socp_ipm<\/a>) which has been shown to be particularly effective for portfolio optimization.<\/div>\n<div>\u00a0<\/div>\n<div class=\"field field--name-field-paragraph-text field--type-text-long field--label-hidden field--item\">\n<h3 class=\"field field--name-field-paragraph-title field--type-string field--label-hidden field--item\">1. SOCP in the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library Introduction<\/h3>\n<p><span style=\"font-size: 1.6rem; letter-spacing: 0.03em;\">Second-order cone programming is one of the main methods for solving QCQP problems, which arises in applications such as portfolio construction. The standard form convex QCQP problem is:<\/span><\/p>\n<\/div>\n<\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math class='equation' display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n <mtable align='axis' class='array' columnlines='none' displaystyle='true' equalcolumns='false' equalrows='false' style=''> <mtr class='array-row'><mtd class='array-td' columnalign='left'><munder><mrow><mstyle class='mbox'><mtext>minimize<\/mtext><\/mstyle><\/mrow><mrow><mi>x<\/mi> <mo class='MathClass-rel' stretchy='false'>\u2208<\/mo> <msup><mrow><mi>\u211d<\/mi><\/mrow><mrow><mi>n<\/mi><\/mrow><\/msup><\/mrow><\/munder><\/mtd><mtd class='array-td' columnalign='left'><mfrac><mrow><mn>1<\/mn><\/mrow>\n<mrow><mn>2<\/mn><\/mrow><\/mfrac><msup><mrow><mi>x<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><msub><mrow><mi>Q<\/mi><\/mrow><mrow>\n<mn>0<\/mn><\/mrow><\/msub><mi>x<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <msubsup><mrow><mi>r<\/mi><\/mrow><mrow><mn>0<\/mn><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msubsup><mi>x<\/mi>                        <\/mtd>\n<\/mtr> <mtr class='array-vspace' style='font-size:2.58334pt'><\/mtr> <mtr class='array-row'><mtd class='array-td' columnalign='left'><mstyle class='mbox'><mtext>subject to<\/mtext><\/mstyle>        <\/mtd><mtd class='array-td' columnalign='left'><mfrac><mrow><mn>1<\/mn><\/mrow>\n<mrow><mn>2<\/mn><\/mrow><\/mfrac><msup><mrow><mi>x<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><msub><mrow><mi>Q<\/mi><\/mrow><mrow>\n<mi>i<\/mi><\/mrow><\/msub><mi>x<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <msubsup><mrow><mi>r<\/mi><\/mrow><mrow><mi>i<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msubsup><mi>x<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <msub><mrow><mi>s<\/mi><\/mrow><mrow>\n<mi>i<\/mi><\/mrow><\/msub> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mn>0<\/mn><mspace class='quad' width='1em'><\/mspace><mstyle mathvariant='normal'><mi>for<\/mi><\/mstyle><mspace class='nbsp' width='0.33em'><\/mspace><mi>i<\/mi> <mo class='MathClass-rel' stretchy='false'>=<\/mo> <mn>1<\/mn><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi>\u2026<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi>m<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo><\/mtd>\n<\/mtr> <mtr class='array-vspace' style='font-size:2.58334pt'><\/mtr> <mtr class='array-row'><mtd class='array-td' columnalign='left'>                  <\/mtd><mtd class='array-td' columnalign='left'><mi mathvariant='italic'>Ax<\/mi> <mo class='MathClass-rel' stretchy='false'>=<\/mo> <mi>b<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p style=\"text-align: left;\">where \\(Q_{o},&#8230;, Q_{m} \\) are positive semidefinite \\(n\\) x \\(n\\) matrices.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5679 size-medium\" src=\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/socp_feas-300x225.png\" alt=\"\" width=\"300\" height=\"225\" \/><\/p>\n<p class=\"para-sm\" style=\"text-align: center;\"><span class=\"id\">Figure\u00a01:\u00a0<\/span><span class=\"content\">Feasible region of an SOCP problem with three variables.<\/span><\/p>\n<p class=\"indent\">The feasible region of an SOCP problem (which may, for instance, be a transformed QCQP problem) can be seen in Figure\u00a01. The feasible region here is the intersection of the green polyhedron and a cone. The curve represents the added quadratic information which makes SOCP more complicated, but at the same time more powerful than LP.<\/p>\n<p class=\"indent\">In terms of the implementation of <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG\u2019s SOCP solver, a path-following homogeneous self-dual algorithm is used. This is both robust and efficient and can detect infeasibility and unboundedness of the model. Also, <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG exploits the sparsity pattern of the problem thoroughly which makes the solver efficient, especially on large and sparse problems. For more details on implementation, see the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library routine documentation for <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG SOCP solver <a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/clhtml\/e04\/e04ptc.html\"><span class=\"cmtt-10\">nag_opt_handle_solve_socp_ipm<\/span><\/a>\u00a0<span class=\"cite\">[1]<\/span>.<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n<!-- Spacer -->\n<div class=\"pt-2 pt-lg-2 pt-xl-2\" ><\/div>\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <h3 id=\"usage-of-socp-in-portfolio-optimization\" class=\"sectionHead\"><span class=\"titlemark\">2. <\/span>Usage of SOCP in Portfolio Optimization<\/h3>\n<p>It is rare that a second-order cone (SOC) would appear naturally in the model, yet through a model reformulation, many portfolio optimization problems and constraints can be handled by SOCP. We discuss several of these below, for more examples see\u00a0<span class=\"cite\">[2]<\/span>.<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n<!-- Spacer -->\n<div class=\"pt-2 pt-lg-2 pt-xl-2\" ><\/div>\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <h4 id=\"optimization-with-norms\" class=\"subsectionHead\"><span class=\"titlemark\">2.1\u00a0<\/span>Optimization with norms<\/h4>\n<p class=\"noindent\">The leverage constraint:<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n     <mo class='MathClass-rel' stretchy='false'>\u2225<\/mo><mi>x<\/mi><msub><mrow><mtext class='MathClass-rel' stretchy='false'>\u2225<\/mtext><\/mrow><mrow><mn>1<\/mn><\/mrow><\/msub> <mo class='MathClass-rel' stretchy='false'>=<\/mo><munderover accent='false' accentunder='false'><mrow><mo> \u2211<\/mo>\n  <\/mrow><mrow><mi>i<\/mi><mo class='MathClass-rel' stretchy='false'>=<\/mo><mn>1<\/mn><\/mrow><mrow><mi>n<\/mi><\/mrow><\/munderover><mo class='MathClass-rel' stretchy='false'>|<\/mo><msub><mrow><mi>x<\/mi><\/mrow><mrow>\n<mi>i<\/mi><\/mrow><\/msub><mo class='MathClass-rel' stretchy='false'>|<\/mo><mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mi>L<\/mi><mspace class='quad' width='1em'><\/mspace><mo class='MathClass-rel' stretchy='false'>\u27fa<\/mo><mspace class='quad' width='1em'><\/mspace><munderover accent='false' accentunder='false'><mrow><mo>\u2211<\/mo>\n  <\/mrow><mrow><mi>i<\/mi><mo class='MathClass-rel' stretchy='false'>=<\/mo><mn>1<\/mn><\/mrow><mrow><mi>n<\/mi><\/mrow><\/munderover><msub><mrow><mi>s<\/mi><\/mrow><mrow>\n<mi>i<\/mi><\/mrow><\/msub> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mi>L<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi> <\/mi> <mrow><mo fence='true' form='prefix'> (<\/mo><mrow><msub><mrow><mi>s<\/mi><\/mrow><mrow><mi>i<\/mi><\/mrow><\/msub><mo class='MathClass-punc' stretchy='false'>,<\/mo><msub><mrow><mi>x<\/mi><\/mrow><mrow><mi>i<\/mi><\/mrow><\/msub><\/mrow><mo fence='true' form='postfix'>)<\/mo><\/mrow> <mo class='MathClass-rel' stretchy='false'>\u2208<\/mo><msubsup><mrow><mstyle mathvariant='script'><mi>K<\/mi><\/mstyle><\/mrow><mrow><mi>q<\/mi><\/mrow><mrow><mn>2<\/mn><\/mrow><\/msubsup><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi mathvariant='italic'> i<\/mi> <mo class='MathClass-rel' stretchy='false'>=<\/mo> <mn>1<\/mn><mo class='MathClass-punc' stretchy='false'>,<\/mo><mo>\u2026<\/mo><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi>n<\/mi><mo class='MathClass-punc' stretchy='false'>.<\/mo>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p>\u00a0<\/p>\n<p>The above norm constraint can be viewed as a special case of general\u00a0<span class=\"cmti-10\">p<\/span>-norm constraint on a vector <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi>x<\/mi> <mo>\u2208<\/mo> <msup><mrow><mi>\u211d<\/mi><\/mrow><mrow><mi>n<\/mi><\/mrow><\/msup><\/mrow><\/math> defined as <math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><\/mrow><\/math><\/p>\n<p>\u00a0<\/p>\n<p><!-- l. 95 --><\/p>\n<p><math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mi>\u00a0<\/mi><\/mrow><\/math><\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math class='equation' display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                   <mstyle class='label' id='x1-3001r1'><\/mstyle><!-- endlabel --><mo class='MathClass-rel' stretchy='false'>\u2225<\/mo><mi>x<\/mi><msub><mrow><mtext class='MathClass-rel' stretchy='false'>\u2225<\/mtext><\/mrow><mrow><mi>p<\/mi><\/mrow><\/msub> <mo class='MathClass-punc' stretchy='false'>:<\/mo><mo class='MathClass-rel' stretchy='false'>=<\/mo><msup><mrow><mrow><mo class='MathClass-open' fence='true' mathsize='2.03em'>(<\/mo><mrow><munderover accent='false' accentunder='false'><mrow><mo>\u2211<\/mo>\n  <\/mrow><mrow><mi>i<\/mi><mo class='MathClass-rel' stretchy='false'>=<\/mo><mn>1<\/mn><\/mrow><mrow><mi>n<\/mi><\/mrow><\/munderover><mo class='MathClass-rel' stretchy='false'>|<\/mo><msub><mrow><mi>x<\/mi><\/mrow><mrow>\n<mi>i<\/mi><\/mrow><\/msub><msup><mrow><mtext class='MathClass-rel' stretchy='false'>|<\/mtext><\/mrow><mrow><mi>p<\/mi><\/mrow><\/msup><\/mrow><mo class='MathClass-close' fence='true' mathsize='2.03em'>)<\/mo><\/mrow><\/mrow><mrow><mspace class='negthinspace' width='-0.17em'><\/mspace><mn>1<\/mn><mo class='MathClass-bin' stretchy='false'>\u2215<\/mo><mi>p<\/mi><\/mrow><\/msup> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mi>t<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p style=\"text-align: right;\">(1)<\/p>\n<p>Where \\(p = l \/ m \\) is a positive rational number with \\( l \u2265 m \\). Inequality constraints (1) have SOC representation since they are equivalent to inequalities involving rational powers.<\/p>\n<h4 id=\"quadratic-constraint\" class=\"subsectionHead\"><span class=\"titlemark\">2.2\u00a0<\/span>Quadratic constraint<\/h4>\n<p>The tracking error constraint<\/p>\n<p>\u00a0<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math class='equation' display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                        <mstyle class='label' id='x1-4001r2'><\/mstyle><!-- endlabel --><mfrac><mrow><mn>1<\/mn><\/mrow>\n<mrow><mn>2<\/mn><\/mrow><\/mfrac><msup><mrow><mi>x<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><mi mathvariant='italic'>Px<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <msup><mrow><mi>q<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><mi>x<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <mi>r<\/mi> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mn>0<\/mn>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p style=\"text-align: right;\">(2)<\/p>\n<p>where \\(P\\) <mo>\u2208 \\(S^n\\) is a positive semidefinite matrix is common in portfolio optimization. Using routines <a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/clhtml\/e04\/e04rsc.html\"><span class=\"cmtt-10\">handle_set_qconstr<\/span><\/a>\u00a0(<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/flhtml\/e04\/e04rsf.html\">e04rs<\/a>) and\u00a0<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/clhtml\/e04\/e04rtc.html\"><span class=\"cmtt-10\">handle_set_qconstr_fac<\/span><\/a>\u00a0(<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/flhtml\/e04\/e04rtf.html\">e04rt<\/a>) introduced at Mark 27.1 of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library, users can easily define quadratic objective functions and\/or constraints and seamlessly integrate them with other constraints. Then what will happen under the hood is as follows. Assume the matrix \\( P \\) has factorization \\( P = F^TF \\), (2) has an equivalent SOC representation as<\/mo><\/p>\n<p>\u00a0<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                  <mi>t<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <msup><mrow><mi>q<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><mi>x<\/mi> <mo class='MathClass-bin' stretchy='false'>+<\/mo> <mi>r<\/mi> <mo class='MathClass-rel' stretchy='false'>=<\/mo> <mn>0<\/mn><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi> <\/mi> <mrow><mo fence='true' form='prefix'> (<\/mo><mrow><mi>t<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo><mn>1<\/mn><mo class='MathClass-punc' stretchy='false'>,<\/mo><mi mathvariant='italic'>Fx<\/mi><\/mrow><mo fence='true' form='postfix'>)<\/mo><\/mrow> <mo class='MathClass-rel' stretchy='false'>\u2208<\/mo><msubsup><mrow><mi>K<\/mi><\/mrow><mrow>\n<mi>r<\/mi><\/mrow><mrow><mi>n<\/mi><mo class='MathClass-bin' stretchy='false'>+<\/mo><mn>2<\/mn><\/mrow><\/msubsup>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p>\u00a0<\/p>\n<p>since \\( (1 \/ 2)x^TPx \u2264\u00a0 t \\) is equivalent to \\( || Fx||^2_{2} \u2264 2t\\). Thus, adding auxiliary variables \\( y = Fx \\) will transform the quadratic constraint into a standard cone constraint.<math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><msubsup><mrow><mn><br \/><\/mn><\/mrow><\/msubsup><\/mrow><\/math><\/p>\n<p class=\"indent\">For more details, see our\u00a0<a href=\"https:\/\/www.nag.com\/content\/solving-quadratically-constrained-quadratic-programming-qcqp-problems\">mini article on QCQP<\/a>\u00a0and\u00a0<a href=\"https:\/\/github.com\/numericalalgorithmsgroup\/NAGPythonExamples\/tree\/master\/local_optimization\/SOCP\">the python examples on portfolio optimization<\/a>\u00a0involving quadratic functions.<\/p>\n<h4 id=\"more-secondorder-cone-representable-functions\" class=\"subsectionHead\"><span class=\"titlemark\">2.3\u00a0<\/span>More second-order cone representable functions<\/h4>\n<p class=\"noindent\">We have mentioned important SOC-representable functions above yet many more problems and constraints from portfolio optimization are SOC-representable. We list some below.<\/p>\n<ul>\n<li class=\"noindent\"><span style=\"font-size: 1.6rem; letter-spacing: 0.03em;\">Maximize Sharpe ratio:<\/span><\/li>\n<\/ul>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                                           <mi class='qopname'>max<\/mi><mo> \u2061<!-- FUNCTION APPLICATION --> <\/mo>   <mfrac><mrow><msup><mrow><mi>\u03bc<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><mi>x<\/mi><\/mrow> \n<mrow><msqrt><mrow><msup><mrow><mi>x<\/mi><\/mrow><mrow><mi>T<\/mi> <\/mrow> <\/msup> <mi mathvariant='normal'>\u03a3<\/mi> <mi>x<\/mi><\/mrow><\/msqrt><\/mrow><\/mfrac><mo class='MathClass-punc' stretchy='false'>.<\/mo>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <ul>\n<li class=\"noindent\">Holding and budget constraints:<\/li>\n<\/ul>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<!-- tex4ht:inline --><\/p><!-- l. 124 --><math display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                                       <mn>0<\/mn> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mi>x<\/mi> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mi>u<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo><mspace class='quad' width='1em'><\/mspace><msup><mrow><mi>e<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><mi>x<\/mi> <mo class='MathClass-rel' stretchy='false'>=<\/mo> <mi>b<\/mi><mo class='MathClass-punc' stretchy='false'>,<\/mo>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p class=\"noindent\">\u00a0 \u00a0 \u00a0where \\(e\\) is the vector of all ones.<\/p>\n<ul>\n<li>Maximum position constraint:<\/li>\n<\/ul>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                                           <mi class='qopname'>max<\/mi><mo> \u2061<!-- FUNCTION APPLICATION --> <\/mo><mo class='MathClass-rel' stretchy='false'>|<\/mo><mi>x<\/mi><mo class='MathClass-rel' stretchy='false'>|<\/mo><mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <mi>m<\/mi><mo class='MathClass-punc' stretchy='false'>.<\/mo>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <ul>\n<li class=\"noindent\">Market impact cost:<\/li>\n<\/ul>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<math display='block' xmlns='http:\/\/www.w3.org\/1998\/Math\/MathML'><mrow>\n                                       <msup><mrow><mi>w<\/mi><\/mrow><mrow><mi>T<\/mi><\/mrow><\/msup><mo class='MathClass-rel' stretchy='false'>|<\/mo><mi>x<\/mi> <mo class='MathClass-bin' stretchy='false'>\u2212<\/mo> <msub><mrow><mi>x<\/mi><\/mrow><mrow>\n<mn>0<\/mn><\/mrow><\/msub><msup><mrow><mtext class='MathClass-rel' stretchy='false'>|<\/mtext><\/mrow><mrow><mi>\u03b7<\/mi><\/mrow><\/msup> <mo class='MathClass-rel' stretchy='false'>\u2264<\/mo> <msub><mrow><mi>u<\/mi><\/mrow><mrow>\n<mi>M<\/mi><\/mrow><\/msub><mo class='MathClass-punc' stretchy='false'>.<\/mo>\n<\/mrow><\/math>\n\n\n<div class=\"container content-area-default \">\n    <div class=\"row justify-content--center\">\n        <div class=\"col-12 col-md-12 col-lg-10 col-xl-8\">\n            <p>\u00a0<\/p>\n<p class=\"indent\">We encourage users to exploit their models thoroughly to reach a SOC-equivalent problem, thereby making the most of the versatility and practical performance of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG SOCP solver\u00a0<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/clhtml\/e04\/e04ptc.html\"><span class=\"cmtt-10\">nag_opt_handle_solve_socp_ipm<\/span><\/a>.<\/p>\n<p>\u00a0<\/p>\n<h3 id=\"performance-of-nag-socp-solver\" class=\"sectionHead\"><span class=\"titlemark\">3. <\/span>Performance of <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG SOCP solver<\/h3>\n<p class=\"noindent\">In this section, we show the performance of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG SOCP solver from the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library for Python together with the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG SOCP solver called from CVXPY and the default solver in CVXPY. While we used Python, the same <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG SOCP solver is available in many other environments (C, Java, Fortran, etc.). All solvers were at default settings with accuracy at\u00a0<math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>1<\/mn><msup><mrow><mn>0<\/mn><\/mrow><mrow><mo>\u2212<\/mo><mn>8<\/mn><\/mrow><\/msup><\/mrow><\/math>\u00a0and in single-threaded mode.<\/p>\n<p class=\"indent\">The solvers were used on\u00a0<math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>10<\/mn><\/mrow><\/math>\u00a0classic portfolio optimization problems ranging from 1100 to 2900 assets. Randomly generated data was used in a Markowitz model whose objective involved a large covariance matrix and was subject to a long-only constraint and a budget constraint.<\/p>\n<p class=\"indent\">The computational time comparison can be found in Figure\u00a02. Here it can be seen that the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG solver called from CVXPY is faster than the standard CVXPY solver. Further, for smaller problems, the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG solver called from Python is at least twice as fast as standard CVXPY, becoming as much as five times faster for larger problems.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5674 size-full\" src=\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/qp_cvxpy_nag_vs_cvxpyecos_1_2_24-1.png\" alt=\"\" width=\"640\" height=\"480\" \/><\/p>\n<p class=\"center para-sm\" style=\"text-align: center;\"><span class=\"id\">Figure\u00a02:\u00a0<\/span><span class=\"content\">Comparison of time on\u00a0<math xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\" display=\"inline\"><mrow><mn>10<\/mn><\/mrow><\/math>\u00a0portfolio optimization problems.<\/span><\/p>\n<p class=\"indent\">In conclusion, SOCP is widely used in finance due to its powerful nature. At Mark 29.3, <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG introduces an updated SOCP solver (<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/clhtml\/e04\/e04ptc.html\"><span class=\"cmtt-10\">nag_opt_handle_solve_socp_ipm<\/span><\/a>) that is highly performant on portfolio optimization problems. In some cases, reformulation of your problem is required, yet it is worth the effort. For further examples and reading visit our\u00a0<a href=\"https:\/\/github.com\/numericalalgorithmsgroup\/NAGPythonExamples\/tree\/master\/local_optimization\">GitHub Local optimization<\/a> page.<\/p>\n<p>The solver is available for multiple languages and environments including C and C++, Python, Java, .NET and Fortran, on Windows, Linux and MacOS. See the\u00a0<a href=\"https:\/\/support.nag.com\/content\/getting-started-nag-library\">Getting Started<\/a>\u00a0page for how to download and install.<\/p>\n        <\/div>\n    <\/div>\n<\/div>\n\n<!-- Spacer -->\n<div class=\"pt-2 pt-lg-2 pt-xl-2\" ><\/div>\n\n\n<div class=\"gbc-title-banner ta ta-lg ta-xl\" style='background-color: #082d48ff; color: #ffffffff; border-radius: 0px; '>\n    <div class=\"container\" style='border-radius: 0px; '>\n        <div class=\"row justify-content--center\" style='color: #ffffffff;'>\n            <div class=\"col-12\"  >\n                <div class=\"wrap pv-4 \" style=\"0px\">\n                                <div class=\"col-12 col-md-12 col-lg-10 col-xl-8  banner-content\"  >\n    \n                                             <h3 class=\"field field--name-field-paragraph-title field--type-string field--label-hidden field--item\">References<\/h3>\n<p>\u00a0<\/p>\n<div class=\"field field--name-field-paragraph-text field--type-text-long field--label-hidden field--item\">\n<p class=\"bibitem\"><span class=\"biblabel\">[1]<span class=\"bibsp\"> \u00a0<\/span><\/span>The <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library Manual, Mark 29.3 routine documentation for e04pt.\u00a0<a class=\"url\" href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/flhtml\/e04\/e04ptf.html\"><span class=\"cmtt-10\">https:\/\/support.<span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>ag.com\/numeric\/nl\/nagdoc_latest\/flhtml\/e04\/e04ptf.html<\/span><\/a>.<\/p>\n<p>\u00a0<\/p>\n<p class=\"bibitem\"><span class=\"biblabel\">[2]<span class=\"bibsp\"> \u00a0<\/span><\/span>Miguel\u00a0Sousa Lobo, Lieven Vandenberghe, Stephen Boyd, and Herv\u00e9 Lebret. Applications of second-order cone programming.\u00a0<span class=\"cmti-10\">Linear algebra and\u00a0<\/span><span class=\"cmti-10\">its applications<\/span>, 284(1-3):193\u2013228, 1998.<\/p>\n<\/div>\n                    \n                    <div class=\"mt-1 mb-1 content\"><\/div>\n\n                    \n                                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>At Mark 29.3 of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library, <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG introduces a performance update to the SOCP solver (nag_opt_handle_solve_socp_ipm) which has been shown to be particularly effective for portfolio optimization. The SOCP solver is available via the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library Optimization Modelling Suite.<\/p>\n","protected":false},"author":3,"featured_media":5602,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"content-type":"","footnotes":""},"class_list":["post-2506","page","type-page","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Solving Convex Problems with Second-order Cone Programming (SOCP) - nAG<\/title>\n<meta name=\"description\" content=\"NAG introduces a performance update to the SOCP solver which has been shown to be particularly effective for portfolio optimization.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Solving Convex Problems with Second-order Cone Programming (SOCP) - nAG\" \/>\n<meta property=\"og:description\" content=\"NAG introduces a performance update to the SOCP solver which has been shown to be particularly effective for portfolio optimization.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/\" \/>\n<meta property=\"og:site_name\" content=\"nAG\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-21T14:18:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297-1024x683.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"683\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@NAGTalk\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/\",\"url\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/\",\"name\":\"Solving Convex Problems with Second-order Cone Programming (SOCP) - nAG\",\"isPartOf\":{\"@id\":\"https:\/\/nag.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297.jpg\",\"datePublished\":\"2023-06-28T14:53:59+00:00\",\"dateModified\":\"2024-02-21T14:18:05+00:00\",\"description\":\"NAG introduces a performance update to the SOCP solver which has been shown to be particularly effective for portfolio optimization.\",\"breadcrumb\":{\"@id\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#primaryimage\",\"url\":\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297.jpg\",\"contentUrl\":\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297.jpg\",\"width\":6000,\"height\":4000,\"caption\":\"Building Exterior, Built Structure, Glass - Material, Metal, Light - Natural Phenomenon,\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/nag.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Solving Convex Problems with Second-order Cone Programming (SOCP)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/nag.com\/#website\",\"url\":\"https:\/\/nag.com\/\",\"name\":\"NAG\",\"description\":\"Robust, trusted numerical software and computational expertise.\",\"publisher\":{\"@id\":\"https:\/\/nag.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/nag.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/nag.com\/#organization\",\"name\":\"Numerical Algorithms Group\",\"alternateName\":\"NAG\",\"url\":\"https:\/\/nag.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/nag.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png\",\"contentUrl\":\"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png\",\"width\":1244,\"height\":397,\"caption\":\"Numerical Algorithms Group\"},\"image\":{\"@id\":\"https:\/\/nag.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/NAGTalk\",\"https:\/\/www.linkedin.com\/company\/nag\/\",\"https:\/\/www.youtube.com\/user\/NumericalAlgorithms\",\"https:\/\/github.com\/numericalalgorithmsgroup\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Solving Convex Problems with Second-order Cone Programming (SOCP) - nAG","description":"NAG introduces a performance update to the SOCP solver which has been shown to be particularly effective for portfolio optimization.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/","og_locale":"en_US","og_type":"article","og_title":"Solving Convex Problems with Second-order Cone Programming (SOCP) - nAG","og_description":"NAG introduces a performance update to the SOCP solver which has been shown to be particularly effective for portfolio optimization.","og_url":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/","og_site_name":"nAG","article_modified_time":"2024-02-21T14:18:05+00:00","og_image":[{"width":1024,"height":683,"url":"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297-1024x683.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@NAGTalk","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/","url":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/","name":"Solving Convex Problems with Second-order Cone Programming (SOCP) - nAG","isPartOf":{"@id":"https:\/\/nag.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#primaryimage"},"image":{"@id":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#primaryimage"},"thumbnailUrl":"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297.jpg","datePublished":"2023-06-28T14:53:59+00:00","dateModified":"2024-02-21T14:18:05+00:00","description":"NAG introduces a performance update to the SOCP solver which has been shown to be particularly effective for portfolio optimization.","breadcrumb":{"@id":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#primaryimage","url":"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297.jpg","contentUrl":"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/iStock-1331397297.jpg","width":6000,"height":4000,"caption":"Building Exterior, Built Structure, Glass - Material, Metal, Light - Natural Phenomenon,"},{"@type":"BreadcrumbList","@id":"https:\/\/nag.com\/solving-convex-problems-with-second-order-cone-programming-socp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nag.com\/"},{"@type":"ListItem","position":2,"name":"Solving Convex Problems with Second-order Cone Programming (SOCP)"}]},{"@type":"WebSite","@id":"https:\/\/nag.com\/#website","url":"https:\/\/nag.com\/","name":"NAG","description":"Robust, trusted numerical software and computational expertise.","publisher":{"@id":"https:\/\/nag.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nag.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/nag.com\/#organization","name":"Numerical Algorithms Group","alternateName":"NAG","url":"https:\/\/nag.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/nag.com\/#\/schema\/logo\/image\/","url":"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png","contentUrl":"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png","width":1244,"height":397,"caption":"Numerical Algorithms Group"},"image":{"@id":"https:\/\/nag.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/NAGTalk","https:\/\/www.linkedin.com\/company\/nag\/","https:\/\/www.youtube.com\/user\/NumericalAlgorithms","https:\/\/github.com\/numericalalgorithmsgroup"]}]}},"_links":{"self":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages\/2506","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/comments?post=2506"}],"version-history":[{"count":102,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages\/2506\/revisions"}],"predecessor-version":[{"id":5731,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages\/2506\/revisions\/5731"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/media\/5602"}],"wp:attachment":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/media?parent=2506"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}