{"id":5939,"date":"2023-09-14T12:18:51","date_gmt":"2023-09-14T11:18:51","guid":{"rendered":"http:\/\/mosaic-modeling.de\/?page_id=5939"},"modified":"2024-07-14T15:28:21","modified_gmt":"2024-07-14T14:28:21","slug":"use-of-optimizations-i-nlp-example","status":"publish","type":"page","link":"https:\/\/mosaic-modeling.de\/?page_id=5939","title":{"rendered":"Use of Optimizations III &#8211; NLP Example"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">On this page<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Model-description\" >Model description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Modeling-Workflow\" >Modeling Workflow<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Notation-of-equation-system\" >Notation of equation system<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Base-names\" >Base names<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Indices\" >Indices<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Equations\" >Equations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Equation-system\" >Equation system<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Simulation-workflow\" >Simulation workflow<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/mosaic-modeling.de\/?page_id=5939\/#Optimization-workflow\" >Optimization workflow<\/a><\/li><\/ul><\/nav><\/div>\n<p>This tutorial explains how a nonlinear programming problem can be set up and solved.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Model-description\"><\/span>Model description<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This example minimizes the objective function <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-21f36758b04341c7980aa18b13ced720_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#80;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"12\" style=\"vertical-align: 0px;\"\/>, subject to an equality constraint and an inequality constraint as well as the bounds of the variables:<\/p>\n<p><p class=\"ql-left-displayed-equation\" style=\"line-height: 160px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-69a284b7c6c670865962776df08c43bf_l3.png\" height=\"160\" width=\"420\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#98;&#101;&#103;&#105;&#110;&#123;&#97;&#108;&#105;&#103;&#110;&#42;&#125;&#38;&#92;&#109;&#105;&#110;&#95;&#123;&#120;&#95;&#105;&#125;&#32;&#92;&#80;&#104;&#105;&#32;&#61;&#32;&#120;&#95;&#123;&#105;&#61;&#49;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#120;&#95;&#123;&#105;&#61;&#52;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#40;&#120;&#95;&#123;&#105;&#61;&#49;&#125;&#32;&#43;&#32;&#120;&#95;&#123;&#105;&#61;&#50;&#125;&#32;&#43;&#32;&#120;&#95;&#123;&#105;&#61;&#51;&#125;&#41;&#32;&#43;&#32;&#120;&#95;&#123;&#105;&#61;&#51;&#125;&#32;&#92;&#92;&#91;&#51;&#101;&#120;&#93;&#92;&#109;&#97;&#116;&#104;&#114;&#109;&#123;&#115;&#46;&#92;&#44;&#116;&#46;&#92;&#113;&#117;&#97;&#100;&#125;&#38;&#32;&#120;&#95;&#123;&#105;&#61;&#49;&#125;&#94;&#50;&#32;&#43;&#32;&#120;&#95;&#123;&#105;&#61;&#50;&#125;&#94;&#50;&#32;&#43;&#32;&#120;&#95;&#123;&#105;&#61;&#51;&#125;&#94;&#50;&#32;&#43;&#32;&#120;&#95;&#123;&#105;&#61;&#52;&#125;&#94;&#50;&#32;&#61;&#32;&#52;&#48;&#44;&#32;&#92;&#92;&#91;&#50;&#101;&#120;&#93;&#92;&#112;&#104;&#97;&#110;&#116;&#111;&#109;&#123;&#92;&#109;&#97;&#116;&#104;&#114;&#109;&#123;&#115;&#46;&#92;&#44;&#116;&#46;&#92;&#44;&#125;&#125;&#32;&#38;&#120;&#95;&#123;&#105;&#61;&#49;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#120;&#95;&#123;&#105;&#61;&#50;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#120;&#95;&#123;&#105;&#61;&#51;&#125;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#120;&#95;&#123;&#105;&#61;&#52;&#125;&#32;&#92;&#103;&#101;&#113;&#32;&#50;&#53;&#44;&#32;&#92;&#92;&#91;&#50;&#101;&#120;&#93;&#92;&#112;&#104;&#97;&#110;&#116;&#111;&#109;&#123;&#92;&#109;&#97;&#116;&#104;&#114;&#109;&#123;&#115;&#46;&#92;&#44;&#116;&#46;&#92;&#44;&#125;&#125;&#32;&#38;&#49;&#32;&#92;&#108;&#101;&#113;&#32;&#120;&#95;&#105;&#32;&#92;&#108;&#101;&#113;&#32;&#53;&#46;&#92;&#101;&#110;&#100;&#123;&#97;&#108;&#105;&#103;&#110;&#42;&#125;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p><\/p>\n<p>The example is known as Hock &amp; Schittkowski Problem #71.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Modeling-Workflow\"><\/span>Modeling Workflow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"Notation-of-equation-system\"><\/span>Notation of equation system<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>For the notation of the equation, we need to set up all base names, superscripts, and indices that appear in the equations, i.e.<\/p>\n<h5><span class=\"ez-toc-section\" id=\"Base-names\"><\/span>Base names<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ul>\n<li><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-7e5fbfa0bbbd9f3051cd156a0f1b5e31_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"10\" style=\"vertical-align: 0px;\"\/>, variable<\/li>\n<li><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-21f36758b04341c7980aa18b13ced720_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#80;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"12\" style=\"vertical-align: 0px;\"\/>, objective function value<\/li>\n<\/ul>\n<h5><span class=\"ez-toc-section\" id=\"Indices\"><\/span>Indices<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<ul>\n<li><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-31318c5dcb226c69e0818e5f7d2422b5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"6\" style=\"vertical-align: 0px;\"\/>, variable index 1..NI<\/li>\n<\/ul>\n<p>The resulting notation has ID 185950.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Equations\"><\/span>Equations<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Next, we can define the equations of the model. Therefore, we open the equation editor, load the notation we just created, and enter the equations as stated above in the model description. Note that inequalities can be expressed via the LaTeX commands \\leq and \\geq<\/p>\n<p>The formulated equations are available with the IDs 185951, 185952, and 185953.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Equation-system\"><\/span>Equation system<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Now we are able to construct our equation system:<\/p>\n<ol>\n<li>Go to &#8220;Equation System&#8221; and load the notation for the equations<\/li>\n<li>Add the eleven constraints and the objective function to your system in the Connected Elements tab<\/li>\n<li>Save your equation system<\/li>\n<\/ol>\n<p>This equation system is available with ID 185954.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Simulation-workflow\"><\/span>Simulation workflow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Your model is now complete and you can move on to the &#8220;Simulation&#8221; section of MOSAICmodeling.<\/p>\n<ol>\n<li>Enter a suitable description<\/li>\n<li>Select the tab Equation System and load the system created in the previous steps. Set the maximum value of the index <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-31318c5dcb226c69e0818e5f7d2422b5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"6\" style=\"vertical-align: 0px;\"\/> to 4 and click on Confirm Index Data<\/li>\n<li>Select the tab Specifications. In the list ALL VARIABLES, you will find the variables as defined in your model notation.<\/li>\n<li>Arbitrarily classify three variables as design variables and the remaining two as iteration values, respectively, by selecting the category from the dropdown menu in the Type column.<\/li>\n<\/ol>\n<p>After having assigned the initial guesses and the parameter values, you can save the variable specification and then the simulation. The simulation is available in MOSAICmodeling with ID 185955. The respective variable specification that may serve as initialization for the optimization has ID 185956. The solution for both iteration variables and both cases is also given in Table 1. In this case, the solution is equal to the initial guesses, which basically shows that the system is well initialized for optimization.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Optimization-workflow\"><\/span>Optimization workflow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Now go to the &#8220;Optimization&#8221; section of MOSAICmodeling and load the simulation. Then, go to the Variable Specification tab and assign <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-21f36758b04341c7980aa18b13ced720_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#80;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"12\" style=\"vertical-align: 0px;\"\/> as OBJECTIVE_VAR and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-dad27a9703483183e1afd245f5232b83_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#95;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/> as OPTIMIZATION_VAR. One of the <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-dad27a9703483183e1afd245f5232b83_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#95;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/> is arbitrarily assigned as ITERATION_VALUE. Assign the bounds given in the model description to the four variables and solve the optimization problem by exporting it to your local environment or by solving it via the NEOS server (description in example &#8220;Use of Optimizations I &#8211; MINLP Example&#8221;). Both initial guesses and solution are given in Table 1.<\/p>\n<p>The optimization has ID 185958 and the associated variable specification has ID 185959.<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes has-small-font-size\"><table><thead><tr><th class=\"has-text-align-center\" data-align=\"center\">Name<\/th><th class=\"has-text-align-left\" data-align=\"left\">Description<\/th><th class=\"has-text-align-left\" data-align=\"left\">Initial guess<\/th><th class=\"has-text-align-left\" data-align=\"left\">Solution<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-21f36758b04341c7980aa18b13ced720_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#80;&#104;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"12\" style=\"vertical-align: 0px;\"\/><\/td><td class=\"has-text-align-left\" data-align=\"left\">Objective<\/td><td class=\"has-text-align-left\" data-align=\"left\">0.0<\/td><td class=\"has-text-align-left\" data-align=\"left\">17.014<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-5f82b7b0a49514733976c2fdbd97b4fb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#95;&#123;&#105;&#61;&#49;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"32\" style=\"vertical-align: -3px;\"\/><\/td><td class=\"has-text-align-left\" data-align=\"left\">Variable 1<\/td><td class=\"has-text-align-left\" data-align=\"left\">1.0<\/td><td class=\"has-text-align-left\" data-align=\"left\">1.0<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-516a5a8e71d8e4b2e6a9cd57061f4e31_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#95;&#123;&#105;&#61;&#50;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"33\" style=\"vertical-align: -3px;\"\/><\/td><td class=\"has-text-align-left\" data-align=\"left\">Variable 2<\/td><td class=\"has-text-align-left\" data-align=\"left\">5.0<\/td><td class=\"has-text-align-left\" data-align=\"left\">4.74<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-068db2075b672b151cc8c7824a3e6831_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#95;&#123;&#105;&#61;&#51;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"33\" style=\"vertical-align: -3px;\"\/><\/td><td class=\"has-text-align-left\" data-align=\"left\">Variable 3<\/td><td class=\"has-text-align-left\" data-align=\"left\">5.0<\/td><td class=\"has-text-align-left\" data-align=\"left\">3.82<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mosaic-modeling.de\/wp-content\/ql-cache\/quicklatex.com-3332420d7c356ab7362c9f6b05ae3cf4_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#95;&#123;&#105;&#61;&#52;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"33\" style=\"vertical-align: -3px;\"\/><\/td><td class=\"has-text-align-left\" data-align=\"left\">Variable 4<\/td><td class=\"has-text-align-left\" data-align=\"left\">1.0<\/td><td class=\"has-text-align-left\" data-align=\"left\">1.38<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Table 1: Initialization and results of the optimization.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial explains how a nonlinear programming problem can be set up and solved. Model description This example minimizes the objective function , subject to an equality constraint and an inequality constraint as well as the bounds of the variables: &nbsp; &nbsp; The example is known as Hock &amp; Schittkowski Problem #71. Modeling Workflow Notation [&hellip;]<\/p>\n","protected":false},"author":252,"featured_media":0,"parent":5203,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5939","page","type-page","status-publish","czr-hentry"],"_links":{"self":[{"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/pages\/5939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/users\/252"}],"replies":[{"embeddable":true,"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5939"}],"version-history":[{"count":10,"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/pages\/5939\/revisions"}],"predecessor-version":[{"id":6173,"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/pages\/5939\/revisions\/6173"}],"up":[{"embeddable":true,"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=\/wp\/v2\/pages\/5203"}],"wp:attachment":[{"href":"https:\/\/mosaic-modeling.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}