summaryrefslogtreecommitdiff
path: root/help
diff options
context:
space:
mode:
authorHarpreet2015-08-27 12:21:29 +0530
committerHarpreet2015-08-27 12:21:29 +0530
commit1019e3a021f5a51a8f7f052ffe499c3ef8aa5136 (patch)
treeb7b2d4bf4119de6b08dee0a4b4b19aa4a597f72f /help
parent5f6cc4e3a2437a3952761991bcdf67f5c0212cd5 (diff)
downloadFOSSEE-Optimization-toolbox-1019e3a021f5a51a8f7f052ffe499c3ef8aa5136.tar.gz
FOSSEE-Optimization-toolbox-1019e3a021f5a51a8f7f052ffe499c3ef8aa5136.tar.bz2
FOSSEE-Optimization-toolbox-1019e3a021f5a51a8f7f052ffe499c3ef8aa5136.zip
unit_tests complete
Diffstat (limited to 'help')
-rw-r--r--help/en_US/scilab_en_US_help/index.html4
-rw-r--r--help/en_US/scilab_en_US_help/index.html~283
-rw-r--r--help/en_US/scilab_en_US_help/symphony.html0
-rw-r--r--help/en_US/scilab_en_US_help/symphony.html~318
4 files changed, 603 insertions, 2 deletions
diff --git a/help/en_US/scilab_en_US_help/index.html b/help/en_US/scilab_en_US_help/index.html
index 3aaf941..1b0fe8c 100644
--- a/help/en_US/scilab_en_US_help/index.html
+++ b/help/en_US/scilab_en_US_help/index.html
@@ -30,8 +30,8 @@
<br /><br />
<h3 class="book-title">Symphony Toolbox</h3>
<ul class="list-part"><a name="symphony_toolbox_manual"></a><div class="info"></div>
-
-<li><a href="section_19f4f1e5726c01d683e8b82be0a7e910.html" class="part">Symphony Toolbox</a>
+<li><a href="symphony.html" class="part">Symphony</a>
+<li><a href="section_19f4f1e5726c01d683e8b82be0a7e910.html" class="part">Symphony API Functions</a>
<ul class="list-chapter"><li><a href="sym_addConstr.html" class="refentry">sym_addConstr</a> &#8212; <span class="refentry-description">Add a new constraint</span></li>
diff --git a/help/en_US/scilab_en_US_help/index.html~ b/help/en_US/scilab_en_US_help/index.html~
new file mode 100644
index 0000000..3aaf941
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/index.html~
@@ -0,0 +1,283 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title></title>
+ <style type="text/css" media="all">
+ @import url("scilab_code.css");
+ @import url("xml_code.css");
+ @import url("c_code.css");
+ @import url("style.css");
+ </style>
+ </head>
+ <body>
+ <div class="manualnavbar">
+ <table width="100%"><tr>
+ <td width="30%">
+
+ </td>
+ <td width="40%" class="center">
+
+ </td>
+ <td width="30%" class="next">
+
+ </td>
+ </tr></table>
+ <hr />
+ </div>
+
+
+
+
+ <br /><br />
+ <h3 class="book-title">Symphony Toolbox</h3>
+<ul class="list-part"><a name="symphony_toolbox_manual"></a><div class="info"></div>
+
+<li><a href="section_19f4f1e5726c01d683e8b82be0a7e910.html" class="part">Symphony Toolbox</a>
+<ul class="list-chapter"><li><a href="sym_addConstr.html" class="refentry">sym_addConstr</a> &#8212; <span class="refentry-description">Add a new constraint</span></li>
+
+
+
+<li><a href="sym_addVar.html" class="refentry">sym_addVar</a> &#8212; <span class="refentry-description">Add a new variable</span></li>
+
+
+
+<li><a href="sym_close.html" class="refentry">sym_close</a> &#8212; <span class="refentry-description">Close the Symphony environment</span></li>
+
+
+
+<li><a href="sym_deleteConstrs.html" class="refentry">sym_deleteConstrs</a> &#8212; <span class="refentry-description">This routine is used to delete rows from the original constraint matrix.</span></li>
+
+
+
+<li><a href="sym_deleteVars.html" class="refentry">sym_deleteVars</a> &#8212; <span class="refentry-description">This routine is used to delete columns from the original problem description.</span></li>
+
+
+
+<li><a href="sym_getConstrActivity.html" class="refentry">sym_getConstrActivity</a> &#8212; <span class="refentry-description">Get the activity of the constraints in the solution</span></li>
+
+
+
+<li><a href="sym_getConstrLower.html" class="refentry">sym_getConstrLower</a> &#8212; <span class="refentry-description">To get the lower bounds of the constraints.</span></li>
+
+
+
+<li><a href="sym_getConstrRange.html" class="refentry">sym_getConstrRange</a> &#8212; <span class="refentry-description">To to get the constraint ranges.</span></li>
+
+
+
+<li><a href="sym_getConstrSense.html" class="refentry">sym_getConstrSense</a> &#8212; <span class="refentry-description">To get the row senses.</span></li>
+
+
+
+<li><a href="sym_getConstrUpper.html" class="refentry">sym_getConstrUpper</a> &#8212; <span class="refentry-description">To get the upper bounds of the constraints.</span></li>
+
+
+
+<li><a href="sym_getDblParam.html" class="refentry">sym_getDblParam</a> &#8212; <span class="refentry-description">This routine is used to get the value of a double type parameter.</span></li>
+
+
+
+<li><a href="sym_getInfinity.html" class="refentry">sym_getInfinity</a> &#8212; <span class="refentry-description">Get Symphony&#0039;s infinity value</span></li>
+
+
+
+<li><a href="sym_getIntParam.html" class="refentry">sym_getIntParam</a> &#8212; <span class="refentry-description">This routine is used to get the value of an integer type parameter.</span></li>
+
+
+
+<li><a href="sym_getIterCount.html" class="refentry">sym_getIterCount</a> &#8212; <span class="refentry-description">To get the number of the analyzed nodes of the branching tree after solving the problem.</span></li>
+
+
+
+<li><a href="sym_getMatrix.html" class="refentry">sym_getMatrix</a> &#8212; <span class="refentry-description">To get the constraint matrix.</span></li>
+
+
+
+<li><a href="sym_getNumConstr.html" class="refentry">sym_getNumConstr</a> &#8212; <span class="refentry-description">To get the number of the constraints of the current problem.</span></li>
+
+
+
+<li><a href="sym_getNumElements.html" class="refentry">sym_getNumElements</a> &#8212; <span class="refentry-description">To get the number of non-zero entries of the constraint matrix of the current problem.</span></li>
+
+
+
+<li><a href="sym_getNumVar.html" class="refentry">sym_getNumVar</a> &#8212; <span class="refentry-description">To get the number of the variables of the current problem.</span></li>
+
+
+
+<li><a href="sym_getObjCoeff.html" class="refentry">sym_getObjCoeff</a> &#8212; <span class="refentry-description">To get the objective vector.</span></li>
+
+
+
+<li><a href="sym_getObjSense.html" class="refentry">sym_getObjSense</a> &#8212; <span class="refentry-description">Get the objective sense</span></li>
+
+
+
+<li><a href="sym_getObjVal.html" class="refentry">sym_getObjVal</a> &#8212; <span class="refentry-description">Get the optimized objective value</span></li>
+
+
+
+<li><a href="sym_getPrimalBound.html" class="refentry">sym_getPrimalBound</a> &#8212; <span class="refentry-description">Get the primal bound of the problem</span></li>
+
+
+
+<li><a href="sym_getRhs.html" class="refentry">sym_getRhs</a> &#8212; <span class="refentry-description">To to get the right hand side vector(column vector).</span></li>
+
+
+
+<li><a href="sym_getStatus.html" class="refentry">sym_getStatus</a> &#8212; <span class="refentry-description">To get status of the problem solver.</span></li>
+
+
+
+<li><a href="sym_getStrParam.html" class="refentry">sym_getStrParam</a> &#8212; <span class="refentry-description">This routine is used to get the value of a string type parameter.</span></li>
+
+
+
+<li><a href="sym_getVarLower.html" class="refentry">sym_getVarLower</a> &#8212; <span class="refentry-description">To get the lower bounds of the variables.</span></li>
+
+
+
+<li><a href="sym_getVarSoln.html" class="refentry">sym_getVarSoln</a> &#8212; <span class="refentry-description">Get the solution for the problem</span></li>
+
+
+
+<li><a href="sym_getVarUpper.html" class="refentry">sym_getVarUpper</a> &#8212; <span class="refentry-description">To get the upper bounds of the variables.</span></li>
+
+
+
+<li><a href="sym_isAbandoned.html" class="refentry">sym_isAbandoned</a> &#8212; <span class="refentry-description">To check whether the problem was abandoned for some reason.</span></li>
+
+
+
+<li><a href="sym_isBinary.html" class="refentry">sym_isBinary</a> &#8212; <span class="refentry-description">Check if a variable is constrained to be binary</span></li>
+
+
+
+<li><a href="sym_isContinuous.html" class="refentry">sym_isContinuous</a> &#8212; <span class="refentry-description">Check if a variable is continuous</span></li>
+
+
+
+<li><a href="sym_isEnvActive.html" class="refentry">sym_isEnvActive</a> &#8212; <span class="refentry-description">Check if Symphony environment is active</span></li>
+
+
+
+<li><a href="sym_isInfeasible.html" class="refentry">sym_isInfeasible</a> &#8212; <span class="refentry-description">To check whether the problem was proven to be infeasible.</span></li>
+
+
+
+<li><a href="sym_isInteger.html" class="refentry">sym_isInteger</a> &#8212; <span class="refentry-description">Check if a variable is constrained to be an integer</span></li>
+
+
+
+<li><a href="sym_isIterLimitReached.html" class="refentry">sym_isIterLimitReached</a> &#8212; <span class="refentry-description">To know whether the iteration limit (node limit) was reached.</span></li>
+
+
+
+<li><a href="sym_isOptimal.html" class="refentry">sym_isOptimal</a> &#8212; <span class="refentry-description">To check whether the problem was solved to optimality.</span></li>
+
+
+
+<li><a href="sym_isTargetGapAchieved.html" class="refentry">sym_isTargetGapAchieved</a> &#8212; <span class="refentry-description">To know whether the target gap was reached.</span></li>
+
+
+
+<li><a href="sym_isTimeLimitReached.html" class="refentry">sym_isTimeLimitReached</a> &#8212; <span class="refentry-description">To know whether the time limit was reached.</span></li>
+
+
+
+<li><a href="sym_loadMPS.html" class="refentry">sym_loadMPS</a> &#8212; <span class="refentry-description">This routine is used to load an instance from an MPS file.</span></li>
+
+
+
+<li><a href="sym_loadProblem.html" class="refentry">sym_loadProblem</a> &#8212; <span class="refentry-description">Load a problem into Symphony</span></li>
+
+
+
+<li><a href="sym_loadProblemBasic.html" class="refentry">sym_loadProblemBasic</a> &#8212; <span class="refentry-description">Load a problem into Symphony (basic version)</span></li>
+
+
+
+<li><a href="sym_open.html" class="refentry">sym_open</a> &#8212; <span class="refentry-description">Open the Symphony environment</span></li>
+
+
+
+<li><a href="sym_resetParams.html" class="refentry">sym_resetParams</a> &#8212; <span class="refentry-description">This routine sets all the environment variables and parameters to their default values.</span></li>
+
+
+
+<li><a href="sym_setConstrLower.html" class="refentry">sym_setConstrLower</a> &#8212; <span class="refentry-description">Set the lower bound of a constraint</span></li>
+
+
+
+<li><a href="sym_setConstrType.html" class="refentry">sym_setConstrType</a> &#8212; <span class="refentry-description">Set the type of a constraint</span></li>
+
+
+
+<li><a href="sym_setConstrUpper.html" class="refentry">sym_setConstrUpper</a> &#8212; <span class="refentry-description">Set the upper bound of a constraint</span></li>
+
+
+
+<li><a href="sym_setContinuous.html" class="refentry">sym_setContinuous</a> &#8212; <span class="refentry-description">This routine is used to set the type of a variable to be continuous.</span></li>
+
+
+
+<li><a href="sym_setDblParam.html" class="refentry">sym_setDblParam</a> &#8212; <span class="refentry-description">This routine is used to set a double type parameter.</span></li>
+
+
+
+<li><a href="sym_setIntParam.html" class="refentry">sym_setIntParam</a> &#8212; <span class="refentry-description">This routine is used to set an integer type parameter.</span></li>
+
+
+
+<li><a href="sym_setInteger.html" class="refentry">sym_setInteger</a> &#8212; <span class="refentry-description">This routine is used to set the type of a variable to be integer.</span></li>
+
+
+
+<li><a href="sym_setObjCoeff.html" class="refentry">sym_setObjCoeff</a> &#8212; <span class="refentry-description">Set coefficient of a variable in the objective</span></li>
+
+
+
+<li><a href="sym_setObjSense.html" class="refentry">sym_setObjSense</a> &#8212; <span class="refentry-description">Set the objective sense</span></li>
+
+
+
+<li><a href="sym_setPrimalBound.html" class="refentry">sym_setPrimalBound</a> &#8212; <span class="refentry-description">Set the primal bound of the problem</span></li>
+
+
+
+<li><a href="sym_setStrParam.html" class="refentry">sym_setStrParam</a> &#8212; <span class="refentry-description">This routine is used to set a string type parameter.</span></li>
+
+
+
+<li><a href="sym_setVarLower.html" class="refentry">sym_setVarLower</a> &#8212; <span class="refentry-description">Set lower bound of a variable</span></li>
+
+
+
+<li><a href="sym_setVarSoln.html" class="refentry">sym_setVarSoln</a> &#8212; <span class="refentry-description">Set a solution for the problem</span></li>
+
+
+
+<li><a href="sym_setVarUpper.html" class="refentry">sym_setVarUpper</a> &#8212; <span class="refentry-description">Set upper bound of a variable</span></li>
+
+
+
+<li><a href="sym_solve.html" class="refentry">sym_solve</a> &#8212; <span class="refentry-description">To solve the currently loaded MILP problem from scratch.</span></li></ul></li></ul>
+ <br />
+
+ <div class="manualnavbar">
+ <table width="100%">
+ <tr><td colspan="3" class="next"><a href="http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab%20software&component=Documentation%20pages" class="ulink">Report an issue</a></td></tr>
+<tr>
+ <td width="30%">
+
+ </td>
+ <td width="40%" class="center">
+
+ </td>
+ <td width="30%" class="next">
+
+ </td>
+ </tr></table>
+ <hr />
+ </div>
+ </body>
+</html>
diff --git a/help/en_US/scilab_en_US_help/symphony.html b/help/en_US/scilab_en_US_help/symphony.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/symphony.html
diff --git a/help/en_US/scilab_en_US_help/symphony.html~ b/help/en_US/scilab_en_US_help/symphony.html~
new file mode 100644
index 0000000..0b78b0d
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/symphony.html~
@@ -0,0 +1,318 @@
+<html><head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>fmincon</title>
+ <style type="text/css" media="all">
+ @import url("scilab_code.css");
+ @import url("xml_code.css");
+ @import url("c_code.css");
+ @import url("style.css");
+ </style>
+ </head>
+ <body>
+ <div class="manualnavbar">
+ <table width="100%"><tr>
+ <td width="30%">
+ <span class="previous"><a href="section_ed3c614d9a2555a6802170ca29940f55.html">&lt;&lt; Fmincon Toolbox</a></span>
+
+ </td>
+ <td width="40%" class="center">
+ <span class="top"><a href="section_ed3c614d9a2555a6802170ca29940f55.html">Fmincon Toolbox</a></span>
+
+ </td>
+ <td width="30%" class="next">
+ <span class="next"><a href="optimget.html">optimget &gt;&gt;</a></span>
+
+ </td>
+ </tr></table>
+ <hr />
+ </div>
+
+
+
+ <span class="path"><a href="index.html">Fmincon Toolbox</a> &gt;&gt; <a href="section_ed3c614d9a2555a6802170ca29940f55.html">Fmincon Toolbox</a> &gt; fmincon</span>
+
+ <br /><br />
+ <div class="info"></div>
+
+ <div class="refnamediv"><h1 class="refname">fmincon</h1><p class="refpurpose">Solves a nonlinearily constrained optimization problem.</p></div>
+
+
+
+<div class="refsynopsisdiv"><h3 class="title">Calling Sequence</h3>
+ <div class="synopsis"><pre><span class="default">x</span><span class="default"> = </span><span class="functionid">fmincon</span><span class="default">(</span><span class="default">fun</span><span class="default">,</span><span class="default">x0</span><span class="default">)</span>
+<span class="default">x</span><span class="default"> = </span><span class="functionid">fmincon</span><span class="default">(</span><span class="default">fun</span><span class="default">,</span><span class="default">x0</span><span class="default">,</span><span class="default">A</span><span class="default">,</span><span class="default">b</span><span class="default">)</span>
+<span class="default">x</span><span class="default"> = </span><span class="functionid">fmincon</span><span class="default">(</span><span class="default">fun</span><span class="default">,</span><span class="default">x0</span><span class="default">,</span><span class="default">A</span><span class="default">,</span><span class="default">b</span><span class="default">,</span><span class="default">Aeq</span><span class="default">,</span><span class="default">beq</span><span class="default">)</span>
+<span class="default">x</span><span class="default"> = </span><span class="functionid">fmincon</span><span class="default">(</span><span class="default">fun</span><span class="default">,</span><span class="default">x0</span><span class="default">,</span><span class="default">A</span><span class="default">,</span><span class="default">b</span><span class="default">,</span><span class="default">Aeq</span><span class="default">,</span><span class="default">beq</span><span class="default">,</span><span class="default">lb</span><span class="default">,</span><span class="default">ub</span><span class="default">)</span>
+<span class="default">x</span><span class="default"> = </span><span class="functionid">fmincon</span><span class="default">(</span><span class="default">fun</span><span class="default">,</span><span class="default">x0</span><span class="default">,</span><span class="default">A</span><span class="default">,</span><span class="default">b</span><span class="default">,</span><span class="default">Aeq</span><span class="default">,</span><span class="default">beq</span><span class="default">,</span><span class="default">lb</span><span class="default">,</span><span class="default">ub</span><span class="default">,</span><span class="default">nonlcon</span><span class="default">)</span>
+<span class="default">x</span><span class="default"> = </span><span class="functionid">fmincon</span><span class="default">(</span><span class="default">fun</span><span class="default">,</span><span class="default">x0</span><span class="default">,</span><span class="default">A</span><span class="default">,</span><span class="default">b</span><span class="default">,</span><span class="default">Aeq</span><span class="default">,</span><span class="default">beq</span><span class="default">,</span><span class="default">lb</span><span class="default">,</span><span class="default">ub</span><span class="default">,</span><span class="default">nonlcon</span><span class="default">,</span><span class="default">options</span><span class="default">)</span>
+<span class="default">[</span><span class="default">x</span><span class="default">,</span><span class="default">fval</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="default">grad</span><span class="default">,</span><span class="default">hessian</span><span class="default">] = </span><span class="functionid">fmincon</span><span class="default"> ( ... )</span></pre></div></div>
+
+<div class="refsection"><h3 class="title">Parameters</h3>
+ <dl><dt><span class="term">fun:</span>
+ <dd><p class="para">a function, the function to minimize. See below for the complete specifications.</p></dd></dt>
+ <dt><span class="term">x0:</span>
+ <dd><p class="para">a nx1 or 1xn matrix of doubles, where n is the number of variables. The initial guess for the optimization algorithm.</p></dd></dt>
+ <dt><span class="term">A:</span>
+ <dd><p class="para">a nil x n matrix of doubles, where n is the number of variables and nil is the number of linear inequalities. If A==[] and b==[], it is assumed that there is no linear inequality constraints. If (A==[] &amp; b&lt;&gt;[]), fmincon generates an error (the same happens if (A&lt;&gt;[] &amp; b==[])).</p></dd></dt>
+ <dt><span class="term">b:</span>
+ <dd><p class="para">a nil x 1 matrix of doubles, where nil is the number of linear inequalities.</p></dd></dt>
+ <dt><span class="term">Aeq:</span>
+ <dd><p class="para">a nel x n matrix of doubles, where n is the number of variables and nel is the number of linear equalities. If A==[] and b==[], it is assumed that there is no linear equality constraints. If (Aeq==[] &amp; beq&lt;&gt;[]), fmincon generates an error (the same happens if (Aeq&lt;&gt;[] &amp; beq==[])).</p></dd></dt>
+ <dt><span class="term">beq:</span>
+ <dd><p class="para">a nel x 1 matrix of doubles, where nel is the number of linear inequalities.</p></dd></dt>
+ <dt><span class="term">lb:</span>
+ <dd><p class="para">a nx1 or 1xn matrix of doubles, where n is the number of variables. The lower bound for x. If lb==[], then the lower bound is automatically set to -inf.</p></dd></dt>
+ <dt><span class="term">ub:</span>
+ <dd><p class="para">a nx1 or 1xn matrix of doubles, where n is the number of variables. The upper bound for x. If lb==[], then the upper bound is automatically set to +inf.</p></dd></dt>
+ <dt><span class="term">nonlcon:</span>
+ <dd><p class="para">a function, the nonlinear constraints. See below for the complete specifications.</p></dd></dt>
+ <dt><span class="term">x:</span>
+ <dd><p class="para">a nx1 matrix of doubles, the computed solution of the optimization problem</p></dd></dt>
+ <dt><span class="term">fval:</span>
+ <dd><p class="para">a 1x1 matrix of doubles, the function value at x</p></dd></dt>
+ <dt><span class="term">exitflag:</span>
+ <dd><p class="para">a 1x1 matrix of floating point integers, the exit status. See below for details.</p></dd></dt>
+ <dt><span class="term">output:</span>
+ <dd><p class="para">a struct, the details of the optimization process. See below for details.</p></dd></dt>
+ <dt><span class="term">lambda:</span>
+ <dd><p class="para">a struct, the Lagrange multipliers at optimum. See below for details.</p></dd></dt>
+ <dt><span class="term">grad:</span>
+ <dd><p class="para">a nx1 matrix of doubles, the gradient of the objective function at optimum</p></dd></dt>
+ <dt><span class="term">hessian:</span>
+ <dd><p class="para">a nxn matrix of doubles, the Hessian of the objective function at optimum</p></dd></dt>
+ <dt><span class="term">options:</span>
+ <dd><p class="para">an optional struct, as provided by optimset</p></dd></dt></dl></div>
+
+<div class="refsection"><h3 class="title">Description</h3>
+ <p class="para">Search the minimum of a constrained optimization problem specified by :
+find the minimum of f(x) such that</p>
+ <p class="para">c(x)&lt;=0, ceq(x)&lt;=0, A*x&lt;=b, Aeq*x=beq and lb&lt;=x&lt;=ub.</p>
+ <p class="para"><span><img src='./_LaTeX_fmincon.xml_1.png' style='position:relative;top:64px;width:186px;height:136px'/></span></p>
+ <p class="para">Currently, we use ipopt for the actual solver of fmincon.</p>
+ <p class="para">See the demonstrations for additionnal examples.</p>
+ <p class="para">The objective function must have header :
+<div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabid">f</span> <span class="scilaboperator">=</span> <span class="scilabid">objfun</span> <span class="scilabopenclose">(</span> <span class="scilabid">x</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>
+where x is a n x 1 matrix of doubles and f is a 1 x 1 matrix of doubles.
+On input, the variable x contains the current point and, on output,
+the variable f must contain the objective function value.</p>
+ <p class="para">By default, fmincon uses finite differences with order 2 formulas and
+optimum step size in order to compute a numerical gradient of the
+objective function.
+If we can provide exact gradients, we should do so since it improves
+the convergence speed of the optimization algorithm.
+In order to use exact gradients, we must update the header of the
+objective function to :
+<div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabopenclose">[</span><span class="scilabid">f</span><span class="scilabdefault">,</span><span class="scilabid">G</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">objfungrad</span> <span class="scilabopenclose">(</span> <span class="scilabid">x</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>
+where x is a n x 1 matrix of doubles, f is a 1 x 1 matrix of doubles
+and G is a n x 1 matrix of doubles.
+On input, the variable x contains the current point and, on output,
+the variable f must contain the objective function value and the variable
+G must contain the gradient of the objective function.
+Furthermore, we must enable the &#0034;GradObj&#0034; option with the statement :
+<div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabid">options</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="optimset.html">optimset</a><span class="scilabopenclose">(</span><span class="scilabstring">&#0034;</span><span class="scilabstring">GradObj</span><span class="scilabstring">&#0034;</span><span class="scilabdefault">,</span><span class="scilabstring">&#0034;</span><span class="scilabstring">on</span><span class="scilabstring">&#0034;</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</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>
+This will let fmincon know that the exact gradient of the objective
+function is known, so that it can change the calling sequence to the
+objective function.</p>
+ <p class="para">The constraint function must have header :
+<div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabopenclose">[</span><span class="scilabid">c</span><span class="scilabdefault">,</span> <span class="scilabid">ceq</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">confun</span><span class="scilabopenclose">(</span><span class="scilabid">x</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>
+where x is a n x 1 matrix of doubles, c is a nni x 1 matrix of doubles and
+ceq is a nne x 1 matrix of doubles (nni : number of nonlinear inequality
+constraints, nne : number of nonlinear equality constraints).
+On input, the variable x contains the current point and, on output,
+the variable c must contain the nonlinear inequality constraints and ceq must contain the
+nonlinear equality constraints.</p>
+ <p class="para">By default, fmincon uses finite differences with order 2 formulas and
+optimum step size in order to compute a numerical gradient of the
+constraint function.
+In order to use exact gradients, we must update the header of the
+constraint function to :
+<div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabopenclose">[</span><span class="scilabid">c</span><span class="scilabdefault">,</span><span class="scilabid">ceq</span><span class="scilabdefault">,</span><span class="scilabid">DC</span><span class="scilabdefault">,</span><span class="scilabid">DCeq</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabid">confungrad</span><span class="scilabopenclose">(</span><span class="scilabid">x</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>
+where x is a n x 1 matrix of doubles, c is a nni x 1 matrix of doubles,
+ceq is a nne x 1 matrix of doubles, DC is a n x nni matrix of doubles and
+DCeq is a n x nne matrix of doubles.
+On input, the variable x contains the current point and, on output,
+the variable c must contain the nonlinear inequality constraint function value,
+the variable ceq must contain the nonlinear equality constraint function value,
+the variable DC must contain the Jacobian matrix of the nonlinear inequality constraints
+and the variable DCeq must contain the Jacobian matrix of the nonlinear equality constraints.
+The i-th nonlinear inequality constraint is associated to the i-th column of
+the matrix DC, i.e, it is stored in DC(:,i) (same for DCeq).
+Furthermore, we must enable the &#0034;GradObj&#0034; option with the statement :
+<div class="programlisting"><table border="0" width="100%"><tr><td width="98%"><pre class="scilabcode"><span class="scilabid">options</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="optimset.html">optimset</a><span class="scilabopenclose">(</span><span class="scilabstring">&#0034;</span><span class="scilabstring">GradConstr</span><span class="scilabstring">&#0034;</span><span class="scilabdefault">,</span><span class="scilabstring">&#0034;</span><span class="scilabstring">on</span><span class="scilabstring">&#0034;</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</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></p>
+ <p class="para">By default, fmincon uses a L-BFGS formula to compute an
+approximation of the Hessian of the Lagrangian.
+Notice that this is different from Matlab&#0039;s fmincon, which
+default is to use a BFGS.</p>
+ <p class="para">The exitflag variable allows to know the status of the optimization.
+<ul class="itemizedlist"><li>exitflag=0 : Number of iterations exceeded options.MaxIter or number of function evaluations exceeded options.FunEvals.</li>
+<li>exitflag=1 : First-order optimality measure was less than options.TolFun, and maximum constraint violation was less than options.TolCon.</li>
+<li>exitflag=-1 : The output function terminated the algorithm.</li>
+<li>exitflag=-2 : No feasible point was found.</li>
+<li>exitflag=%nan : Other type of termination.</li></ul></p>
+ <p class="para">The output data structure contains detailed informations about the
+optimization process.
+It has type &#0034;struct&#0034; and contains the following fields.
+<ul class="itemizedlist"><li>output.iterations: the number of iterations performed during the search</li>
+<li>output.funcCount: the number of function evaluations during the search</li>
+<li>output.stepsize: an empty matrix</li>
+<li>output.algorithm : the string containing the name of the algorithm. In the current version, algorithm=&#0034;ipopt&#0034;.</li>
+<li>output.firstorderopt: the max-norm of the first-order KKT conditions.</li>
+<li>output.constrviolation: the max-norm of the constraint violation.</li>
+<li>output.cgiterations: the number of preconditionned conjugate gradient steps. In the current version, cgiterations=0.</li>
+<li>output.message: a string containing a message describing the status of the optimization.</li></ul></p>
+ <p class="para">The lambda data structure contains the Lagrange multipliers at the
+end of optimization.
+It has type &#0034;struct&#0034; and contains the following
+fields.
+<ul class="itemizedlist"><li>lambda.lower: the Lagrange multipliers for the lower bound constraints. In the current version, an empty matrix.</li>
+<li>lambda.upper: the Lagrange multipliers for the upper bound constraints. In the current version, an empty matrix.</li>
+<li>lambda.eqlin: the Lagrange multipliers for the linear equality constraints.</li>
+<li>lambda.eqnonlin: the Lagrange multipliers for the nonlinear equality constraints.</li>
+<li>lambda.ineqlin: the Lagrange multipliers for the linear inequality constraints.</li>
+<li>lambda.ineqnonlin: the Lagrange multipliers for the nonlinear inequality constraints.</li></ul></p>
+ <p class="para">TODO : exitflag=2 : Change in x was less than options.TolX and maximum constraint violation was less than options.TolCon.
+TODO : exitflag=-3 : Current point x went below options.ObjectiveLimit and maximum constraint violation was less than options.TolCon.
+TODO : fill lambda.lower and lambda.upper consistently. See ticket #111 : http://forge.scilab.org/index.php/p/sci-ipopt/issues/111/
+TODO : test with A, b
+TODO : test with Aeq, beq
+TODO : test with ceq
+TODO : avoid using global for ipopt_data
+TODO : implement Display option
+TODO : implement FinDiffType option
+TODO : implement MaxFunEvals option
+TODO : implement DerivativeCheck option
+TODO : implement MaxIter option
+TODO : implement OutputFcn option
+TODO : implement PlotFcns option
+TODO : implement TolFun option
+TODO : implement TolCon option
+TODO : implement TolX option
+TODO : implement Hessian option
+TODO : check that the hessian output argument is Hessian of f only
+TODO : test all exitflag values</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">// A basic case :</span>
+<span class="scilabcomment">// we provide only the objective function and the nonlinear constraint</span>
+<span class="scilabcomment">// function : we let fmincon compute the gradients by numerical</span>
+<span class="scilabcomment">// derivatives.</span>
+<span class="scilabfkeyword">function</span> <span class="scilabinputoutputargs">f</span><span class="scilaboperator">=</span><span class="scilabfunctionid">objfun</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span>
+<span class="scilabinputoutputargs">f</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://exp">exp</a><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabopenclose">)</span><span class="scilaboperator">*</span><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilaboperator">*</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">2</span> <span class="scilaboperator">+</span> <span class="scilabnumber">2</span><span class="scilaboperator">*</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">2</span> <span class="scilaboperator">+</span> <span class="scilabnumber">4</span><span class="scilaboperator">*</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">+</span> <span class="scilabnumber">2</span><span class="scilaboperator">*</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="scilabfkeyword">endfunction</span>
+<span class="scilabfkeyword">function</span> <span class="scilabopenclose">[</span><span class="scilabinputoutputargs">c</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">ceq</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabfunctionid">confun</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span>
+<span class="scilabcomment">// Nonlinear inequality constraints</span>
+<span class="scilabinputoutputargs">c</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span>
+<span class="scilabnumber">1.5</span> <span class="scilaboperator">+</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">-</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span>
+<span class="scilaboperator">-</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">-</span> <span class="scilabnumber">10</span>
+<span class="scilabopenclose">]</span>
+<span class="scilabcomment">// Nonlinear equality constraints</span>
+<span class="scilabinputoutputargs">ceq</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabopenclose">]</span>
+<span class="scilabfkeyword">endfunction</span>
+<span class="scilabcomment">// The initial guess</span>
+<span class="scilabid">x0</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span>
+<span class="scilabcomment">// The expected solution : only 4 digits are guaranteed</span>
+<span class="scilabid">xopt</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">9.547345885974547</span> <span class="scilabnumber">1.047408305349257</span><span class="scilabopenclose">]</span>
+<span class="scilabid">fopt</span> <span class="scilaboperator">=</span> <span class="scilabnumber">0.023551460139148</span>
+<span class="scilabcomment">// Run fmincon</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="scilabdefault">,</span><span class="scilabid">grad</span><span class="scilabdefault">,</span><span class="scilabid">hessian</span><span class="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabspecial">..</span>
+<span class="scilabid">fmincon</span> <span class="scilabopenclose">(</span> <span class="scilabfunctionid">objfun</span><span class="scilabdefault">,</span><span class="scilabid">x0</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span> <span class="scilabfunctionid">confun</span> <span class="scilabstring">)</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">// A case where we provide the gradient of the objective</span>
+<span class="scilabcomment">// function and the Jacobian matrix of the constraints.</span>
+<span class="scilabcomment">// The objective function and its gradient</span>
+<span class="scilabfkeyword">function</span> <span class="scilabopenclose">[</span><span class="scilabinputoutputargs">f</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">G</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabfunctionid">objfungrad</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span>
+<span class="scilabopenclose">[</span><span class="scilabid">lhs</span><span class="scilabdefault">,</span><span class="scilabid">rhs</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><a class="scilabcommand" href="scilab://argn">argn</a><span class="scilabopenclose">(</span><span class="scilabopenclose">)</span>
+<span class="scilabinputoutputargs">f</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://exp">exp</a><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabopenclose">)</span><span class="scilaboperator">*</span><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilaboperator">*</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">2</span><span class="scilaboperator">+</span><span class="scilabnumber">2</span><span class="scilaboperator">*</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">2</span><span class="scilaboperator">+</span><span class="scilabnumber">4</span><span class="scilaboperator">*</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span><span class="scilaboperator">+</span><span class="scilabnumber">2</span><span class="scilaboperator">*</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="scilabskeyword">if</span> <span class="scilabopenclose">(</span> <span class="scilabid">lhs</span> <span class="scilaboperator">&#0062;</span> <span class="scilabnumber">1</span> <span class="scilabopenclose">)</span> <span class="scilabskeyword">then</span>
+<span class="scilabinputoutputargs">G</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span>
+<span class="scilabinputoutputargs">f</span> <span class="scilaboperator">+</span> <a class="scilabcommand" href="scilab://exp">exp</a><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabopenclose">)</span> <span class="scilaboperator">*</span> <span class="scilabopenclose">(</span><span class="scilabnumber">8</span><span class="scilaboperator">*</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">4</span><span class="scilaboperator">*</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span><span class="scilabopenclose">)</span>
+<a class="scilabcommand" href="scilab://exp">exp</a><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabopenclose">)</span><span class="scilaboperator">*</span><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilaboperator">*</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">4</span><span class="scilaboperator">*</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">2</span><span class="scilabopenclose">)</span>
+<span class="scilabopenclose">]</span>
+<span class="scilabskeyword">end</span>
+<span class="scilabfkeyword">endfunction</span>
+<span class="scilabcomment">// The nonlinear constraints and the Jacobian</span>
+<span class="scilabcomment">// matrix of the constraints</span>
+<span class="scilabfkeyword">function</span> <span class="scilabopenclose">[</span><span class="scilabinputoutputargs">c</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">ceq</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">DC</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">DCeq</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabfunctionid">confungrad</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span>
+<span class="scilabcomment">// Inequality constraints</span>
+<span class="scilabinputoutputargs">c</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span> <span class="scilaboperator">=</span> <span class="scilabnumber">1.5</span> <span class="scilaboperator">+</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">-</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span>
+<span class="scilabinputoutputargs">c</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">=</span> <span class="scilaboperator">-</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span><span class="scilaboperator">-</span><span class="scilabnumber">10</span>
+<span class="scilabcomment">// No nonlinear equality constraints</span>
+<span class="scilabinputoutputargs">ceq</span><span class="scilaboperator">=</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span>
+<span class="scilabopenclose">[</span><span class="scilabid">lhs</span><span class="scilabdefault">,</span><span class="scilabid">rhs</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><a class="scilabcommand" href="scilab://argn">argn</a><span class="scilabopenclose">(</span><span class="scilabopenclose">)</span>
+<span class="scilabskeyword">if</span> <span class="scilabopenclose">(</span> <span class="scilabid">lhs</span> <span class="scilaboperator">&#0062;</span> <span class="scilabnumber">2</span> <span class="scilabopenclose">)</span> <span class="scilabskeyword">then</span>
+<span class="scilabcomment">// DC(:,i) = gradient of the i-th constraint</span>
+<span class="scilabcomment">// DC = [</span>
+<span class="scilabcomment">// Dc1/Dx1 Dc2/Dx1</span>
+<span class="scilabcomment">// Dc1/Dx2 Dc2/Dx2</span>
+<span class="scilabcomment">// ]</span>
+<span class="scilabinputoutputargs">DC</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="scilabdefault">,</span> <span class="scilaboperator">-</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</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="scilabdefault">,</span> <span class="scilaboperator">-</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span>
+<span class="scilabopenclose">]</span>
+<span class="scilabinputoutputargs">DCeq</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabopenclose">]</span>
+<span class="scilabskeyword">end</span>
+<span class="scilabfkeyword">endfunction</span>
+<span class="scilabcomment">// Test with both gradient of objective and gradient of constraints</span>
+<span class="scilabid">options</span> <span class="scilaboperator">=</span> <a class="scilabmacro" href="optimset.html">optimset</a><span class="scilabopenclose">(</span><span class="scilabstring">&#0034;</span><span class="scilabstring">GradObj</span><span class="scilabstring">&#0034;</span><span class="scilabdefault">,</span><span class="scilabstring">&#0034;</span><span class="scilabstring">on</span><span class="scilabstring">&#0034;</span><span class="scilabdefault">,</span><span class="scilabstring">&#0034;</span><span class="scilabstring">GradConstr</span><span class="scilabstring">&#0034;</span><span class="scilabdefault">,</span><span class="scilabstring">&#0034;</span><span class="scilabstring">on</span><span class="scilabstring">&#0034;</span><span class="scilabopenclose">)</span><span class="scilabdefault">;</span>
+<span class="scilabcomment">// The initial guess</span>
+<span class="scilabid">x0</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span>
+<span class="scilabcomment">// The expected solution : only 4 digits are guaranteed</span>
+<span class="scilabid">xopt</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">9.547345885974547</span> <span class="scilabnumber">1.047408305349257</span><span class="scilabopenclose">]</span>
+<span class="scilabid">fopt</span> <span class="scilaboperator">=</span> <span class="scilabnumber">0.023551460139148</span>
+<span class="scilabcomment">// Run fmincon</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="scilabopenclose">]</span> <span class="scilaboperator">=</span> <span class="scilabspecial">..</span>
+<span class="scilabid">fmincon</span><span class="scilabopenclose">(</span><span class="scilabfunctionid">objfungrad</span><span class="scilabdefault">,</span><span class="scilabid">x0</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span> <span class="scilabfunctionid">confungrad</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">// A case where we set the bounds of the optimization.</span>
+<span class="scilabcomment">// By default, the bounds are set to infinity.</span>
+<span class="scilabfkeyword">function</span> <span class="scilabinputoutputargs">f</span><span class="scilaboperator">=</span><span class="scilabfunctionid">objfun</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span>
+<span class="scilabinputoutputargs">f</span> <span class="scilaboperator">=</span> <a class="scilabcommand" href="scilab://exp">exp</a><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">1</span><span class="scilabopenclose">)</span><span class="scilabopenclose">)</span><span class="scilaboperator">*</span><span class="scilabopenclose">(</span><span class="scilabnumber">4</span><span class="scilaboperator">*</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">2</span> <span class="scilaboperator">+</span> <span class="scilabnumber">2</span><span class="scilaboperator">*</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">2</span> <span class="scilaboperator">+</span> <span class="scilabnumber">4</span><span class="scilaboperator">*</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">+</span> <span class="scilabnumber">2</span><span class="scilaboperator">*</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="scilabfkeyword">endfunction</span>
+<span class="scilabfkeyword">function</span> <span class="scilabopenclose">[</span><span class="scilabinputoutputargs">c</span><span class="scilabdefault">, </span><span class="scilabinputoutputargs">ceq</span><span class="scilabopenclose">]</span><span class="scilaboperator">=</span><span class="scilabfunctionid">confun</span><span class="scilabopenclose">(</span><span class="scilabinputoutputargs">x</span><span class="scilabopenclose">)</span>
+<span class="scilabcomment">// Nonlinear inequality constraints</span>
+<span class="scilabinputoutputargs">c</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span>
+<span class="scilabnumber">1.5</span> <span class="scilaboperator">+</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">-</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span>
+<span class="scilaboperator">-</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="scilabinputoutputargs">x</span><span class="scilabopenclose">(</span><span class="scilabnumber">2</span><span class="scilabopenclose">)</span> <span class="scilaboperator">-</span> <span class="scilabnumber">10</span>
+<span class="scilabopenclose">]</span>
+<span class="scilabcomment">// Nonlinear equality constraints</span>
+<span class="scilabinputoutputargs">ceq</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabopenclose">]</span>
+<span class="scilabfkeyword">endfunction</span>
+<span class="scilabcomment">// The initial guess</span>
+<span class="scilabid">x0</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilaboperator">-</span><span class="scilabnumber">1</span><span class="scilabdefault">,</span><span class="scilabnumber">1</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span>
+<span class="scilabcomment">// The expected solution</span>
+<span class="scilabid">xopt</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span> <span class="scilabnumber">1.5</span><span class="scilabopenclose">]</span>
+<span class="scilabid">fopt</span> <span class="scilaboperator">=</span> <span class="scilabnumber">8.5</span>
+<span class="scilabcomment">// Make sure that x(1)</span><span class="scilabcomment">&#0062;</span><span class="scilabcomment">=0, and x(2)</span><span class="scilabcomment">&#0062;</span><span class="scilabcomment">=0</span>
+<span class="scilabid">lb</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span><span class="scilabnumber">0</span><span class="scilabdefault">,</span><span class="scilabnumber">0</span><span class="scilabopenclose">]</span><span class="scilabdefault">;</span>
+<span class="scilabid">ub</span> <span class="scilaboperator">=</span> <span class="scilabopenclose">[</span> <span class="scilabopenclose">]</span><span class="scilabdefault">;</span>
+<span class="scilabcomment">// Run fmincon</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">fmincon</span> <span class="scilabopenclose">(</span> <span class="scilabfunctionid">objfun</span> <span class="scilabdefault">,</span> <span class="scilabid">x0</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabopenclose">[</span><span class="scilabopenclose">]</span><span class="scilabdefault">,</span><span class="scilabid">lb</span><span class="scilabdefault">,</span><span class="scilabid">ub</span><span class="scilabdefault">,</span><span class="scilabfunctionid">confun</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">Authors</h3>
+ <ul class="itemizedlist"><li class="member">Michael Baudin, DIGITEO, 2010</li></ul></div>
+ <br />
+
+ <div class="manualnavbar">
+ <table width="100%">
+ <tr><td colspan="3" class="next"><a href="http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab%20software&component=Documentation%20pages" class="ulink">Report an issue</a></td></tr>
+<tr>
+ <td width="30%">
+ <span class="previous"><a href="section_ed3c614d9a2555a6802170ca29940f55.html">&lt;&lt; Fmincon Toolbox</a></span>
+
+ </td>
+ <td width="40%" class="center">
+ <span class="top"><a href="section_ed3c614d9a2555a6802170ca29940f55.html">Fmincon Toolbox</a></span>
+
+ </td>
+ <td width="30%" class="next">
+ <span class="next"><a href="optimget.html">optimget &gt;&gt;</a></span>
+
+ </td>
+ </tr></table>
+ <hr />
+ </div>
+ </body>
+</html>