diff options
Diffstat (limited to 'help/en_US/scilab_en_US_help/fminbnd.html')
-rw-r--r-- | help/en_US/scilab_en_US_help/fminbnd.html | 139 |
1 files changed, 74 insertions, 65 deletions
diff --git a/help/en_US/scilab_en_US_help/fminbnd.html b/help/en_US/scilab_en_US_help/fminbnd.html index d60efaa..7e71531 100644 --- a/help/en_US/scilab_en_US_help/fminbnd.html +++ b/help/en_US/scilab_en_US_help/fminbnd.html @@ -16,7 +16,7 @@ </td> <td width="40%" class="center"> - <span class="top"><a href="section_031bbc67ce78762a40093bfdff4eaa3b.html">FOSSEE Optimization Toolbox</a></span> + <span class="top"><a href="section_44e1f57c5225357b5fe53cb5fad967e9.html">FOSSEE Optimization Toolbox</a></span> </td> <td width="30%" class="next"> @@ -29,7 +29,7 @@ - <span class="path"><a href="index.html">FOSSEE Optimization Toolbox</a> >> <a href="section_031bbc67ce78762a40093bfdff4eaa3b.html">FOSSEE Optimization Toolbox</a> > fminbnd</span> + <span class="path"><a href="index.html">FOSSEE Optimization Toolbox</a> >> <a href="section_44e1f57c5225357b5fe53cb5fad967e9.html">FOSSEE Optimization Toolbox</a> > fminbnd</span> <br /><br /> <div class="refnamediv"><h1 class="refname">fminbnd</h1> @@ -44,53 +44,58 @@ <span class="default">[</span><span class="default">xopt</span><span class="default">,</span><span class="default">fopt</span><span class="default">,</span><span class="default">exitflag</span><span class="default">,</span><span class="default">output</span><span class="default">]=</span><span class="functionid">fminbnd</span><span class="default">(.....)</span> <span class="default">[</span><span class="default">xopt</span><span class="default">,</span><span class="default">fopt</span><span class="default">,</span><span class="default">exitflag</span><span class="default">,</span><span class="default">output</span><span class="default">,</span><span class="default">lambda</span><span class="default">]=</span><span class="functionid">fminbnd</span><span class="default">(.....)</span></pre></div></div> -<div class="refsection"><h3 class="title">Parameters</h3> +<div class="refsection"><h3 class="title">Input Parameters</h3> <dl><dt><span class="term">f :</span> - <dd><p class="para">a function, representing the objective function of the problem</p></dd></dt> - <dt><span class="term">x1 :</span> - <dd><p class="para">a vector, containing the lower bound of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables, where n is number of Variables</p></dd></dt> - <dt><span class="term">x2 :</span> - <dd><p class="para">a vector, containing the upper bound of the variables of size (1 X n) or (n X 1) or (0 X 0) where 'n' is the number of Variables. If x2 is empty it means upper bound is +infinity</p></dd></dt> + <dd><p class="para">A function, representing the objective function of the problem.</p></dd></dt> + <dt><span class="term"><span><img src='./_LaTeX_fminbnd.xml_1.png' style='position:relative;top:5px;width:19px;height:14px'/></span> :</span> + <dd><p class="para">A vector, containing the lower bound of the variables of size (1 X n) or (n X 1) where n is number of variables. If it is empty it means that the lower bound is <span><img src='./_LaTeX_fminbnd.xml_2.png' style='position:relative;top:4px;width:33px;height:16px'/></span>.</p></dd></dt> + <dt><span class="term"><span><img src='./_LaTeX_fminbnd.xml_3.png' style='position:relative;top:5px;width:19px;height:14px'/></span> :</span> + <dd><p class="para">A vector, containing the upper bound of the variables of size (1 X n) or (n X 1) or (0 X 0) where n is the number of variables. If it is empty it means that the upper bound is <span><img src='./_LaTeX_fminbnd.xml_4.png' style='position:relative;top:2px;width:20px;height:11px'/></span>.</p></dd></dt> <dt><span class="term">options :</span> - <dd><p class="para">a list, containing the option for user to specify. See below for details.</p></dd></dt> - <dt><span class="term">xopt :</span> - <dd><p class="para">a vector of doubles, containing the the computed solution of the optimization problem.</p></dd></dt> + <dd><p class="para">A list, containing the options for user to specify. See below for details.</p></dd></dt></dl></div> + <div class="refsection"><h3 class="title">Outputs</h3> + <dl><dt><span class="term">xopt :</span> + <dd><p class="para">A vector of doubles, containing the computed solution of the optimization problem.</p></dd></dt> <dt><span class="term">fopt :</span> - <dd><p class="para">a scalar of double, containing the the function value at x.</p></dd></dt> + <dd><p class="para">A double, containing the the function value at x.</p></dd></dt> <dt><span class="term">exitflag :</span> - <dd><p class="para">a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.</p></dd></dt> + <dd><p class="para">An integer, containing the flag which denotes the reason for termination of algorithm. See below for details.</p></dd></dt> <dt><span class="term">output :</span> - <dd><p class="para">a structure, containing the information about the optimization. See below for details.</p></dd></dt> + <dd><p class="para">A structure, containing the information about the optimization. See below for details.</p></dd></dt> <dt><span class="term">lambda :</span> - <dd><p class="para">a structure, containing the Lagrange multipliers of lower bound and upper bound at the optimized point. See below for details.</p></dd></dt></dl></div> + <dd><p class="para">A structure, containing the Lagrange multipliers of lower bound, upper bound and constraints at the optimized point. See below for details.</p></dd></dt></dl></div> <div class="refsection"><h3 class="title">Description</h3> <p class="para">Search the minimum of a multi-variable function on bounded interval specified by : Find the minimum of f(x) such that</p> - <p class="para"><span><img src='./_LaTeX_fminbnd.xml_1.png' style='position:relative;top:20px;width:219px;height:48px'/></span></p> - <p class="para">The routine calls Ipopt for solving the Bounded Optimization problem, Ipopt is a library written in C++.</p> - <p class="para">The options allows the user to set various parameters of the Optimization problem. -It should be defined as type "list" and contains the following fields. -<ul class="itemizedlist"><li>Syntax : options= list("MaxIter", [---], "CpuTime", [---], TolX, [----]);</li> -<li>MaxIter : a Scalar, containing the Maximum Number of Iteration that the solver should take.</li> -<li>CpuTime : a Scalar, containing the Maximum amount of CPU Time that the solver should take.</li> -<li>TolX : a Scalar, containing the Tolerance value that the solver should take.</li> -<li>Default Values : options = list("MaxIter", [3000], "CpuTime", [600], TolX, [1e-4]);</li></ul></p> - <p class="para">The exitflag allows to know the status of the optimization which is given back by Ipopt. -<ul class="itemizedlist"><li>exitflag=0 : Optimal Solution Found</li> -<li>exitflag=1 : Maximum Number of Iterations Exceeded. Output may not be optimal.</li> -<li>exitflag=2 : Maximum CPU Time exceeded. Output may not be optimal.</li> -<li>exitflag=3 : Stop at Tiny Step.</li> -<li>exitflag=4 : Solved To Acceptable Level.</li> -<li>exitflag=5 : Converged to a point of local infeasibility.</li></ul></p> - <p class="para">For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/</p> + <p class="para"><span><img src='./_LaTeX_fminbnd.xml_5.png' style='position:relative;top:30px;width:179px;height:68px'/></span></p> + <p class="para">fminbnd calls Ipopt which is an optimization library written in C++, to solve the bound optimization problem.</p> + +<p class="para"><h3 class="title">Options</h3> +The options allow the user to set various parameters of the Optimization problem. The syntax for the options is given by:</p> + <p class="para">options= list("MaxIter", [---], "CpuTime", [---], "TolX", [---]);</p> + <p class="para">The options should be defined as type "list" and consist of the following fields: +<ul class="itemizedlist"><li>MaxIter : A scalar, specifying the maximum number of iterations that the solver should take.</li> +<li>CpuTime : A scalar, specifying the maximum amount of CPU Time in seconds that the solver should take.</li> +<li>TolX : A scalar, containing the tolerance value that the solver should take.</li></ul> +The default values for the various items are given as:</p> + <p class="para">options = list("MaxIter", [3000], "CpuTime", [600]);</p> + + <p class="para">The exitflag allows the user to know the status of the optimization which is returned by Ipopt. The values it can take and what they indicate is described below: +<ul class="itemizedlist"><li>0 : Optimal Solution Found</li> +<li>1 : Maximum Number of Iterations Exceeded. Output may not be optimal.</li> +<li>2 : Maximum amount of CPU Time exceeded. Output may not be optimal.</li> +<li>3 : Stop at Tiny Step.</li> +<li>4 : Solved To Acceptable Level.</li> +<li>5 : Converged to a point of local infeasibility.</li></ul></p> + <p class="para">For more details on exitflag, see the ipopt documentation which can be found on http://www.coin-or.org/Ipopt/documentation/</p> <p class="para">The output data structure contains detailed informations about the optimization process. -It has type "struct" and contains the following fields. -<ul class="itemizedlist"><li>output.Iterations: The number of iterations performed during the search</li> -<li>output.Cpu_Time: The total cpu-time spend during the search</li> -<li>output.Objective_Evaluation: The number of Objective Evaluations performed during the search</li> -<li>output.Dual_Infeasibility: The Dual Infeasiblity of the final soution</li> -<li>output.Message: The output message for the problem</li></ul></p> +It is of type "struct" and contains the following fields. +<ul class="itemizedlist"><li>output.Iterations: The number of iterations performed.</li> +<li>output.Cpu_Time : The total cpu-time taken.</li> +<li>output.Objective_Evaluation: The number of Objective Evaluations performed.</li> +<li>output.Dual_Infeasibility : The Dual Infeasiblity of the final soution.</li> +<li>output.Message: The output message for the problem.</li></ul></p> <p class="para">The lambda data structure contains the Lagrange multipliers at the end of optimization. In the current version the values are returned only when the the solution is optimal. It has type "struct" and contains the following fields. @@ -98,10 +103,30 @@ It has type "struct" and contains the following fields. <li>lambda.upper: The Lagrange multipliers for the upper bound constraints.</li></ul></p> <p class="para"></p></div> -<div class="refsection"><h3 class="title">Examples</h3> - <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Find x in R^6 such that it minimizes:</span> -<span class="scilabcomment">//f(x)= sin(x1) + sin(x2) + sin(x3) + sin(x4) + sin(x5) + sin(x6)</span> -<span class="scilabcomment">//-2 </span><span class="scilabcomment"><</span><span class="scilabcomment">= x1,x2,x3,x4,x5,x6 </span><span class="scilabcomment"><</span><span class="scilabcomment">= 2</span> + <p class="para">A few examples displaying the various functionalities of fminbnd have been provided below. You will find a series of problems and the appropriate code snippets to solve them.</p> +<div class="refsection"><h3 class="title">Example</h3> +<p class="para">Here we solve a simple non-linear objective function, bounded in the interval [0,1000].</p> + <p class="para">Find x in R such that it minimizes:</p> + <p class="para"><span><img src='./_LaTeX_fminbnd.xml_6.png' style='position:relative;top:7px;width:221px;height:88px'/></span></p> + <p class="para"></p> + <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabid">Example</span> <span class="scilabnumber">1</span><span class="scilabspecial">:</span> <span class="scilabid">Minimizing</span> <span class="scilabid">a</span> <span class="scilabid">bound</span> <span class="scilabfkeyword">function</span> <span class="scilabid">R</span><span class="scilaboperator">.</span> +<span class="scilabcomment">//Objective function to be minimised</span> +<span class="scilabfkeyword">function</span> <span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabfunctionid">f</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span> +<span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabnumber">1</span><span class="scilaboperator">/</span><span class="scilabinputoutputargs">x</span><span class="scilaboperator">^</span><span class="scilabnumber">2</span> +<span class="scilabfkeyword">endfunction</span> +<span class="scilabcomment">//Variable bounds</span> +<span class="scilabid">x1</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabid">x2</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1000</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> +<span class="scilabcomment">//Calling Ipopt</span> +<span class="scilabopenclose">[</span><span class="scilabid">x</span><span class="scilabdefault">,</span><span class="scilabid">fval</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span><span class="scilabid">fminbnd</span><span class="scilabopenclose">(</span><span class="scilabfunctionid">f</span><span class="scilabdefault">,</span> <span class="scilabid">x1</span><span class="scilabdefault">,</span> <span class="scilabid">x2</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> + + +<div class="refsection"><h3 class="title">Example</h3> +<p class="para">Here we solve a bounded objective function in R^6. We use this function to illustrate how we can further enhance the functionality of fminbnd by setting input options. We can pre-define the gradient of the objective function and/or the hessian of the lagrange function and thereby improve the speed of computation. This is elaborated on in example 2. We also set solver parameters using the options.</p> + <p class="para">Find x in R^6 such that it minimizes:</p> + <p class="para"><span><img src='./_LaTeX_fminbnd.xml_7.png' style='position:relative;top:8px;width:506px;height:73px'/></span></p> +<p class="para"></p> + <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Example 2: Solving an objective function in R^6.</span> <span class="scilabcomment">//Objective function to be minimised</span> <span class="scilabfkeyword">function</span> <span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabfunctionid">f</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span> <span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabnumber">0</span> @@ -115,29 +140,13 @@ It has type "struct" and contains the following fields. <span class="scilabcomment">//Options</span> <span class="scilabid">options</span><span class="scilaboperator">=</span><a class="scilabcommand" href="scilab://list">list</a><span class="scilabopenclose">(</span><span class="scilabstring">"</span><span class="scilabstring">MaxIter</span><span class="scilabstring">"</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabnumber">1500</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabstring">"</span><span class="scilabstring">CpuTime</span><span class="scilabstring">"</span><span class="scilabdefault">,</span> <span class="scilabopenclose">[</span><span class="scilabnumber">100</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabstring">"</span><span class="scilabstring">TolX</span><span class="scilabstring">"</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabnumber">1e-6</span><span class="scilabopenclose">]</span><span class="scilabopenclose">)</span> <span class="scilabcomment">//Calling Ipopt</span> -<span class="scilabopenclose">[</span><span class="scilabid">x</span><span class="scilabdefault">,</span><span class="scilabid">fval</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span><span class="scilabid">fminbnd</span><span class="scilabopenclose">(</span><span class="scilabfunctionid">f</span><span class="scilabdefault">,</span> <span class="scilabid">x1</span><span class="scilabdefault">,</span> <span class="scilabid">x2</span><span class="scilabdefault">,</span> <span class="scilabid">options</span><span class="scilabopenclose">)</span> -<span class="scilabcomment">// Press ENTER to continue</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> +<span class="scilabopenclose">[</span><span class="scilabid">x</span><span class="scilabdefault">,</span><span class="scilabid">fval</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span><span class="scilabid">fminbnd</span><span class="scilabopenclose">(</span><span class="scilabfunctionid">f</span><span class="scilabdefault">,</span> <span class="scilabid">x1</span><span class="scilabdefault">,</span> <span class="scilabid">x2</span><span class="scilabdefault">,</span> <span class="scilabid">options</span><span class="scilabopenclose">)</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> -<div class="refsection"><h3 class="title">Examples</h3> - <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Find x in R such that it minimizes:</span> -<span class="scilabcomment">//f(x)= 1/x^2</span> -<span class="scilabcomment">//0 </span><span class="scilabcomment"><</span><span class="scilabcomment">= x </span><span class="scilabcomment"><</span><span class="scilabcomment">= 1000</span> -<span class="scilabcomment">//Objective function to be minimised</span> -<span class="scilabfkeyword">function</span> <span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabfunctionid">f</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span> -<span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabnumber">1</span><span class="scilaboperator">/</span><span class="scilabinputoutputargs">x</span><span class="scilaboperator">^</span><span class="scilabnumber">2</span> -<span class="scilabfkeyword">endfunction</span> -<span class="scilabcomment">//Variable bounds</span> -<span class="scilabid">x1</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabid">x2</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">1000</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span> -<span class="scilabcomment">//Calling Ipopt</span> -<span class="scilabopenclose">[</span><span class="scilabid">x</span><span class="scilabdefault">,</span><span class="scilabid">fval</span><span class="scilabdefault">,</span><span class="scilabid">exitflag</span><span class="scilabdefault">,</span><span class="scilabid">output</span><span class="scilabdefault">,</span><span class="scilabid">lambda</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span><span class="scilabid">fminbnd</span><span class="scilabopenclose">(</span><span class="scilabfunctionid">f</span><span class="scilabdefault">,</span> <span class="scilabid">x1</span><span class="scilabdefault">,</span> <span class="scilabid">x2</span><span class="scilabopenclose">)</span> -<span class="scilabcomment">// Press ENTER to continue</span></pre></td><td valign="top"><a href="scilab://scilab.execexample/"><img src="ScilabExecute.png" border="0"/></a></td><td valign="top"><a href="scilab://scilab.editexample/"><img src="ScilabEdit.png" border="0"/></a></td><td></td></tr></table></div></div> - -<div class="refsection"><h3 class="title">Examples</h3> - <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//The below problem is an unbounded problem:</span> -<span class="scilabcomment">//Find x in R^2 such that it minimizes:</span> -<span class="scilabcomment">//f(x)= -[(x1-1)^2 + (x2-1)^2]</span> -<span class="scilabcomment">//-inf </span><span class="scilabcomment"><</span><span class="scilabcomment">= x1,x2 </span><span class="scilabcomment"><</span><span class="scilabcomment">= inf</span> +<div class="refsection"><h3 class="title">Example</h3> +<p class="para">Unbounded Problems: Find x in R^2 such that it minimizes:</p> + <p class="para"><span><img src='./_LaTeX_fminbnd.xml_8.png' style='position:relative;top:17px;width:237px;height:93px'/></span></p> + <p class="para"></p> + <div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabcomment">//Example 3: Unbounded objective function.</span> <span class="scilabcomment">//Objective function to be minimised</span> <span class="scilabfkeyword">function</span> <span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilabfunctionid">f</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span> <span class="scilabinputoutputargs">y</span><span class="scilaboperator">=</span><span class="scilaboperator">-</span><span class="scilabopenclose">(</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilaboperator">^</span><span class="scilabnumber">2</span><span class="scilaboperator">+</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span><span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilaboperator">^</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span> @@ -163,7 +172,7 @@ It has type "struct" and contains the following fields. </td> <td width="40%" class="center"> - <span class="top"><a href="section_031bbc67ce78762a40093bfdff4eaa3b.html">FOSSEE Optimization Toolbox</a></span> + <span class="top"><a href="section_44e1f57c5225357b5fe53cb5fad967e9.html">FOSSEE Optimization Toolbox</a></span> </td> <td width="30%" class="next"> |