From 03241d180c9d65fa1e75ceac4c257df44438a1ce Mon Sep 17 00:00:00 2001
From: Harpreet
Date: Wed, 24 Feb 2016 16:22:06 +0530
Subject: fmincon examples added
---
help/en_US/master_help.xml | 164 ++++++++++
help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS | Bin 0 -> 6704 bytes
.../scilab_en_US_help/JavaHelpSearch/DOCS.TAB | Bin 0 -> 917 bytes
.../en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS | Bin 0 -> 256 bytes
.../scilab_en_US_help/JavaHelpSearch/POSITIONS | Bin 0 -> 36126 bytes
help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA | 2 +
help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP | Bin 0 -> 16384 bytes
help/en_US/scilab_en_US_help/ScilabCaution.png | Bin 0 -> 513 bytes
help/en_US/scilab_en_US_help/ScilabEdit.png | Bin 0 -> 414 bytes
help/en_US/scilab_en_US_help/ScilabExecute.png | Bin 0 -> 535 bytes
help/en_US/scilab_en_US_help/ScilabImportant.png | Bin 0 -> 637 bytes
help/en_US/scilab_en_US_help/ScilabNote.png | Bin 0 -> 687 bytes
help/en_US/scilab_en_US_help/ScilabTip.png | Bin 0 -> 687 bytes
help/en_US/scilab_en_US_help/ScilabWarning.png | Bin 0 -> 513 bytes
.../scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png | Bin 0 -> 4343 bytes
.../scilab_en_US_help/_LaTeX_fminbnd.xml_1.png | Bin 0 -> 1792 bytes
.../scilab_en_US_help/_LaTeX_fmincon.xml_1.png | Bin 0 -> 3781 bytes
.../scilab_en_US_help/_LaTeX_fminimax.xml_1.png | Bin 0 -> 5367 bytes
.../scilab_en_US_help/_LaTeX_fminimax.xml_2.png | Bin 0 -> 1295 bytes
.../scilab_en_US_help/_LaTeX_fminunc.xml_1.png | Bin 0 -> 714 bytes
.../scilab_en_US_help/_LaTeX_linprog.xml_1.png | Bin 0 -> 2509 bytes
.../scilab_en_US_help/_LaTeX_lsqlin.xml_1.png | Bin 0 -> 3046 bytes
.../scilab_en_US_help/_LaTeX_lsqnonneg.xml_1.png | Bin 0 -> 1456 bytes
.../scilab_en_US_help/_LaTeX_qpipopt.xml_1.png | Bin 0 -> 3304 bytes
.../scilab_en_US_help/_LaTeX_qpipoptmat.xml_1.png | Bin 0 -> 3148 bytes
.../scilab_en_US_help/_LaTeX_symphony.xml_1.png | Bin 0 -> 3383 bytes
.../scilab_en_US_help/_LaTeX_symphonymat.xml_1.png | Bin 0 -> 3140 bytes
help/en_US/scilab_en_US_help/c_code.css | 54 ++++
help/en_US/scilab_en_US_help/fgoalattain.html | 187 +++++++++++
help/en_US/scilab_en_US_help/fminbnd.html | 176 +++++++++++
help/en_US/scilab_en_US_help/fmincon.html | 305 ++++++++++++++++++
help/en_US/scilab_en_US_help/fminimax.html | 237 ++++++++++++++
help/en_US/scilab_en_US_help/fminunc.html | 180 +++++++++++
help/en_US/scilab_en_US_help/index.html | 352 +++++++++++++++++++++
help/en_US/scilab_en_US_help/jhelpidx.xml | 3 +
help/en_US/scilab_en_US_help/jhelpmap.jhm | 77 +++++
help/en_US/scilab_en_US_help/jhelpset.hs | 28 ++
help/en_US/scilab_en_US_help/jhelptoc.xml | 80 +++++
help/en_US/scilab_en_US_help/linprog.html | 192 +++++++++++
help/en_US/scilab_en_US_help/lsqlin.html | 175 ++++++++++
help/en_US/scilab_en_US_help/lsqnonneg.html | 129 ++++++++
help/en_US/scilab_en_US_help/qpipopt.html | 175 ++++++++++
help/en_US/scilab_en_US_help/qpipoptmat.html | 171 ++++++++++
help/en_US/scilab_en_US_help/scilab_code.css | 96 ++++++
.../section_19f4f1e5726c01d683e8b82be0a7e910.html | 352 +++++++++++++++++++++
.../section_508f0b211d17ea6769714cc144e6b731.html | 285 +++++++++++++++++
help/en_US/scilab_en_US_help/style.css | 350 ++++++++++++++++++++
help/en_US/scilab_en_US_help/sym_addConstr.html | 91 ++++++
help/en_US/scilab_en_US_help/sym_addVar.html | 93 ++++++
help/en_US/scilab_en_US_help/sym_close.html | 84 +++++
.../en_US/scilab_en_US_help/sym_deleteConstrs.html | 81 +++++
help/en_US/scilab_en_US_help/sym_deleteVars.html | 81 +++++
.../scilab_en_US_help/sym_getConstrActivity.html | 83 +++++
.../scilab_en_US_help/sym_getConstrLower.html | 83 +++++
.../scilab_en_US_help/sym_getConstrRange.html | 83 +++++
.../scilab_en_US_help/sym_getConstrSense.html | 83 +++++
.../scilab_en_US_help/sym_getConstrUpper.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getDblParam.html | 81 +++++
help/en_US/scilab_en_US_help/sym_getInfinity.html | 82 +++++
help/en_US/scilab_en_US_help/sym_getIntParam.html | 81 +++++
help/en_US/scilab_en_US_help/sym_getIterCount.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getMatrix.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getNumConstr.html | 82 +++++
.../scilab_en_US_help/sym_getNumElements.html | 82 +++++
help/en_US/scilab_en_US_help/sym_getNumVar.html | 82 +++++
help/en_US/scilab_en_US_help/sym_getObjCoeff.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getObjSense.html | 82 +++++
help/en_US/scilab_en_US_help/sym_getObjVal.html | 83 +++++
.../scilab_en_US_help/sym_getPrimalBound.html | 82 +++++
help/en_US/scilab_en_US_help/sym_getRhs.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getStatus.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getStrParam.html | 81 +++++
help/en_US/scilab_en_US_help/sym_getVarLower.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getVarSoln.html | 83 +++++
help/en_US/scilab_en_US_help/sym_getVarUpper.html | 83 +++++
help/en_US/scilab_en_US_help/sym_isAbandoned.html | 83 +++++
help/en_US/scilab_en_US_help/sym_isBinary.html | 83 +++++
help/en_US/scilab_en_US_help/sym_isContinuous.html | 83 +++++
help/en_US/scilab_en_US_help/sym_isEnvActive.html | 82 +++++
help/en_US/scilab_en_US_help/sym_isInfeasible.html | 83 +++++
help/en_US/scilab_en_US_help/sym_isInteger.html | 77 +++++
.../scilab_en_US_help/sym_isIterLimitReached.html | 84 +++++
help/en_US/scilab_en_US_help/sym_isOptimal.html | 84 +++++
.../scilab_en_US_help/sym_isTargetGapAchieved.html | 83 +++++
.../scilab_en_US_help/sym_isTimeLimitReached.html | 83 +++++
help/en_US/scilab_en_US_help/sym_loadMPS.html | 82 +++++
help/en_US/scilab_en_US_help/sym_loadProblem.html | 102 ++++++
.../scilab_en_US_help/sym_loadProblemBasic.html | 103 ++++++
help/en_US/scilab_en_US_help/sym_open.html | 84 +++++
help/en_US/scilab_en_US_help/sym_resetParams.html | 80 +++++
.../scilab_en_US_help/sym_setConstrLower.html | 85 +++++
.../en_US/scilab_en_US_help/sym_setConstrType.html | 91 ++++++
.../scilab_en_US_help/sym_setConstrUpper.html | 85 +++++
.../en_US/scilab_en_US_help/sym_setContinuous.html | 81 +++++
help/en_US/scilab_en_US_help/sym_setDblParam.html | 83 +++++
help/en_US/scilab_en_US_help/sym_setIntParam.html | 83 +++++
help/en_US/scilab_en_US_help/sym_setInteger.html | 81 +++++
help/en_US/scilab_en_US_help/sym_setObjCoeff.html | 85 +++++
help/en_US/scilab_en_US_help/sym_setObjSense.html | 83 +++++
.../scilab_en_US_help/sym_setPrimalBound.html | 83 +++++
help/en_US/scilab_en_US_help/sym_setStrParam.html | 83 +++++
help/en_US/scilab_en_US_help/sym_setVarLower.html | 85 +++++
help/en_US/scilab_en_US_help/sym_setVarSoln.html | 84 +++++
help/en_US/scilab_en_US_help/sym_setVarUpper.html | 85 +++++
help/en_US/scilab_en_US_help/sym_solve.html | 81 +++++
help/en_US/scilab_en_US_help/symphony.html | 224 +++++++++++++
help/en_US/scilab_en_US_help/symphonymat.html | 213 +++++++++++++
help/en_US/scilab_en_US_help/xml_code.css | 94 ++++++
108 files changed, 9162 insertions(+)
create mode 100644 help/en_US/master_help.xml
create mode 100644 help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS
create mode 100644 help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB
create mode 100644 help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS
create mode 100644 help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS
create mode 100644 help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA
create mode 100644 help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP
create mode 100644 help/en_US/scilab_en_US_help/ScilabCaution.png
create mode 100644 help/en_US/scilab_en_US_help/ScilabEdit.png
create mode 100644 help/en_US/scilab_en_US_help/ScilabExecute.png
create mode 100644 help/en_US/scilab_en_US_help/ScilabImportant.png
create mode 100644 help/en_US/scilab_en_US_help/ScilabNote.png
create mode 100644 help/en_US/scilab_en_US_help/ScilabTip.png
create mode 100644 help/en_US/scilab_en_US_help/ScilabWarning.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fgoalattain.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fminbnd.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fmincon.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fminimax.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fminimax.xml_2.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_fminunc.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_linprog.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_lsqlin.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_lsqnonneg.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_qpipopt.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_qpipoptmat.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_symphony.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/_LaTeX_symphonymat.xml_1.png
create mode 100644 help/en_US/scilab_en_US_help/c_code.css
create mode 100644 help/en_US/scilab_en_US_help/fgoalattain.html
create mode 100644 help/en_US/scilab_en_US_help/fminbnd.html
create mode 100644 help/en_US/scilab_en_US_help/fmincon.html
create mode 100644 help/en_US/scilab_en_US_help/fminimax.html
create mode 100644 help/en_US/scilab_en_US_help/fminunc.html
create mode 100644 help/en_US/scilab_en_US_help/index.html
create mode 100644 help/en_US/scilab_en_US_help/jhelpidx.xml
create mode 100644 help/en_US/scilab_en_US_help/jhelpmap.jhm
create mode 100644 help/en_US/scilab_en_US_help/jhelpset.hs
create mode 100644 help/en_US/scilab_en_US_help/jhelptoc.xml
create mode 100644 help/en_US/scilab_en_US_help/linprog.html
create mode 100644 help/en_US/scilab_en_US_help/lsqlin.html
create mode 100644 help/en_US/scilab_en_US_help/lsqnonneg.html
create mode 100644 help/en_US/scilab_en_US_help/qpipopt.html
create mode 100644 help/en_US/scilab_en_US_help/qpipoptmat.html
create mode 100644 help/en_US/scilab_en_US_help/scilab_code.css
create mode 100644 help/en_US/scilab_en_US_help/section_19f4f1e5726c01d683e8b82be0a7e910.html
create mode 100644 help/en_US/scilab_en_US_help/section_508f0b211d17ea6769714cc144e6b731.html
create mode 100644 help/en_US/scilab_en_US_help/style.css
create mode 100644 help/en_US/scilab_en_US_help/sym_addConstr.html
create mode 100644 help/en_US/scilab_en_US_help/sym_addVar.html
create mode 100644 help/en_US/scilab_en_US_help/sym_close.html
create mode 100644 help/en_US/scilab_en_US_help/sym_deleteConstrs.html
create mode 100644 help/en_US/scilab_en_US_help/sym_deleteVars.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getConstrActivity.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getConstrLower.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getConstrRange.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getConstrSense.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getConstrUpper.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getDblParam.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getInfinity.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getIntParam.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getIterCount.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getMatrix.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getNumConstr.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getNumElements.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getNumVar.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getObjCoeff.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getObjSense.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getObjVal.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getPrimalBound.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getRhs.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getStatus.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getStrParam.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getVarLower.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getVarSoln.html
create mode 100644 help/en_US/scilab_en_US_help/sym_getVarUpper.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isAbandoned.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isBinary.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isContinuous.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isEnvActive.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isInfeasible.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isInteger.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isIterLimitReached.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isOptimal.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isTargetGapAchieved.html
create mode 100644 help/en_US/scilab_en_US_help/sym_isTimeLimitReached.html
create mode 100644 help/en_US/scilab_en_US_help/sym_loadMPS.html
create mode 100644 help/en_US/scilab_en_US_help/sym_loadProblem.html
create mode 100644 help/en_US/scilab_en_US_help/sym_loadProblemBasic.html
create mode 100644 help/en_US/scilab_en_US_help/sym_open.html
create mode 100644 help/en_US/scilab_en_US_help/sym_resetParams.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setConstrLower.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setConstrType.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setConstrUpper.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setContinuous.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setDblParam.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setIntParam.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setInteger.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setObjCoeff.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setObjSense.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setPrimalBound.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setStrParam.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setVarLower.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setVarSoln.html
create mode 100644 help/en_US/scilab_en_US_help/sym_setVarUpper.html
create mode 100644 help/en_US/scilab_en_US_help/sym_solve.html
create mode 100644 help/en_US/scilab_en_US_help/symphony.html
create mode 100644 help/en_US/scilab_en_US_help/symphonymat.html
create mode 100644 help/en_US/scilab_en_US_help/xml_code.css
(limited to 'help/en_US')
diff --git a/help/en_US/master_help.xml b/help/en_US/master_help.xml
new file mode 100644
index 0000000..73ec952
--- /dev/null
+++ b/help/en_US/master_help.xml
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]>
+
Solves a multiobjective goal attainment problem
xopt = fgoalattain(fun,x0,goal,weight) +xopt = fgoalattain(fun,x0,goal,weight,A,b) +xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq) +xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub) +xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon) +xopt = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options) +[xopt,fval] = fgoalattain(...) +[xopt,fval,attainfactor] = fgoalattain(...) +[xopt,fval,attainfactor,exitflag] = fgoalattain(...) +[xopt,fval,attainfactor,exitflag,output] = fgoalattain(...) +[xopt,fval,attainfactor,exitflag,output,lambda] = fgoalattain(...)
a function that accepts a vector x and returns a vector F
a vector of double, contains initial guess of variables.
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
a function, the nonlinear constraints
a list, containing the option for user to specify. See below for details.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
The amount of over- or underachievement of the goals,γ at the solution.
The exit status. See below for details.
The structure consist of statistics about the optimization. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
fgoalattain solves the goal attainment problem, which is one formulation for minimizing a multiobjective optimization problem. +Finds the minimum of a problem specified by: +Minimise Y such that
+The solver makes use of fmincon to find the minimum.
+The fgoalattain finds out the maximum value of Y for the objectives evaluated at the starting point and +adds that as another variable to the vector x +This is passed to the fmincon function to get the optimised value of Y +Hence, the algorithm used mainly is "ipopt" to obtain the optimum solution +The relations between f(x), Y, weights and goals are added as additional non-linear inequality constraints
+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. +
By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of gattainObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates gattainObjfun gradient using numderivative toolbox.
+If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.
+Furthermore, we must enable the "GradObj" option with the statement : +
minimaxOptions = list("GradObj",fGrad); | ![]() | ![]() |
The constraint function must have header : +
+where x is a n x 1 matrix of doubles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne 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. +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of confun. In case the GradObj option is on and GradCons option is off, fminimax approximates confun gradient using numderivative toolbox.
+If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.
+Furthermore, we must enable the "GradCon" option with the statement : +
minimaxOptions = list("GradCon",confunGrad); | ![]() | ![]() |
The constraint derivative function must have header : +
+where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles. +The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
function f1=gattainObjfun(x) +f1(1)=2*x(1)*x(1)+x(2)*x(2)-48*x(1)-40*x(2)+304 +f1(2)=-x(1)*x(1)-3*x(2)*x(2) +f1(3)=x(1)+3*x(2)-18 +f1(4)=-x(1)-x(2) +f1(5)=x(1)+x(2)-8 +endfunction +x0=[-1,1]; +goal=[-5,-3,-2,-1,-4]; +weight=abs(goal) +//gval =[- 0.0000011 -63.999998 -2.0000002 -8 3.485D-08] +//z = [4 3.99] +//Run fgoalattain +[x,fval,attainfactor,exitflag,output,lambda]=fgoalattain(gattainObjfun,x0,goal,weight) | ![]() | ![]() |
Solves a multi-variable optimization problem on a bounded interval
xopt = fminbnd(f,x1,x2) +xopt = fminbnd(f,x1,x2,options) +[xopt,fopt] = fminbnd(.....) +[xopt,fopt,exitflag]= fminbnd(.....) +[xopt,fopt,exitflag,output]=fminbnd(.....) +[xopt,fopt,exitflag,output,lambda]=fminbnd(.....)
a function, representing the objective function of the problem
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
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
a list, containing the option for user to specify. See below for details.
a vector of doubles, containing the the computed solution of the optimization problem.
a scalar of double, containing the the function value at x.
a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.
a structure, containing the information about the optimization. See below for details.
a structure, containing the Lagrange multipliers of lower bound and upper bound at the optimized point. See below for details.
Search the minimum of a multi-variable function on bounded interval specified by : +Find the minimum of f(x) such that
+The routine calls Ipopt for solving the Bounded Optimization problem, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
//Find x in R^6 such that it minimizes: +//f(x)= sin(x1) + sin(x2) + sin(x3) + sin(x4) + sin(x5) + sin(x6) +//-2 <= x1,x2,x3,x4,x5,x6 <= 2 +//Objective function to be minimised +function y=f(x) +y=0 +for i =1:6 +y=y+sin(x(i)); +end +endfunction +//Variable bounds +x1 = [-2, -2, -2, -2, -2, -2]; +x2 = [2, 2, 2, 2, 2, 2]; +//Options +options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6]) +//Calling Ipopt +[x,fval] =fminbnd(f, x1, x2, options) +// Press ENTER to continue | ![]() | ![]() |
//The below problem is an unbounded problem: +//Find x in R^2 such that it minimizes: +//f(x)= -[(x1-1)^2 + (x2-1)^2] +//-inf <= x1,x2 <= inf +//Objective function to be minimised +function y=f(x) +y=-((x(1)-1)^2+(x(2)-1)^2); +endfunction +//Variable bounds +x1 = [-%inf , -%inf]; +x2 = []; +//Options +options=list("MaxIter",[1500],"CpuTime", [100],"TolX",[1e-6]) +//Calling Ipopt +[x,fval,exitflag,output,lambda] =fminbnd(f, x1, x2, options) | ![]() | ![]() |
Solves a multi-variable constrainted optimization problem
xopt = fmincon(f,x0,A,b) +xopt = fmincon(f,x0,A,b,Aeq,beq) +xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub) +xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc) +xopt = fmincon(f,x0,A,b,Aeq,beq,lb,ub,nlc,options) +[xopt,fopt] = fmincon(.....) +[xopt,fopt,exitflag]= fmincon(.....) +[xopt,fopt,exitflag,output]= fmincon(.....) +[xopt,fopt,exitflag,output,lambda]=fmincon(.....) +[xopt,fopt,exitflag,output,lambda,gradient]=fmincon(.....) +[xopt,fopt,exitflag,output,lambda,gradient,hessian]=fmincon(.....)
a function, representing the objective function of the problem
a vector of doubles, containing the starting values of variables of size (1 X n) or (n X 1) where 'n' is the number of Variables
a matrix of doubles, containing the coefficients of linear inequality constraints of size (m X n) where 'm' is the number of linear inequality constraints
a vector of doubles, related to 'A' and containing the the Right hand side equation of the linear inequality constraints of size (m X 1)
a matrix of doubles, containing the coefficients of linear equality constraints of size (m1 X n) where 'm1' is the number of linear equality constraints
a vector of doubles, related to 'Aeq' and containing the the Right hand side equation of the linear equality constraints of size (m1 X 1)
a vector of doubles, containing the lower bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables
a vector of doubles, containing the upper bounds of the variables of size (1 X n) or (n X 1) where 'n' is the number of Variables
a function, representing the Non-linear Constraints functions(both Equality and Inequality) of the problem. It is declared in such a way that non-linear inequality constraints are defined first as a single row vector (c), followed by non-linear equality constraints as another single row vector (ceq). Refer Example for definition of Constraint function.
a list, containing the option for user to specify. See below for details.
a vector of doubles, cointating the computed solution of the optimization problem
a scalar of double, containing the the function value at x
a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.
a structure, containing the information about the optimization. See below for details.
a structure, containing the Lagrange multipliers of lower bound, upper bound and constraints at the optimized point. See below for details.
a vector of doubles, containing the Objective's gradient of the solution.
a matrix of doubles, containing the Lagrangian's hessian of the solution.
Search the minimum of a constrained optimization problem specified by : +Find the minimum of f(x) such that
+The routine calls Ipopt for solving the Constrained Optimization problem, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
//Find x in R^2 such that it minimizes: +//f(x)= -x1 -x2/3 +//x0=[0,0] +//constraint-1 (c1): x1 + x2 <= 2 +//constraint-2 (c2): x1 + x2/4 <= 1 +//constraint-3 (c3): x1 - x2 <= 2 +//constraint-4 (c4): -x1/4 - x2 <= 1 +//constraint-5 (c5): -x1 - x2 <= -1 +//constraint-6 (c6): -x1 + x2 <= 2 +//constraint-7 (c7): x1 + x2 = 2 +//Objective function to be minimised +function y=f(x) +y=-x(1)-x(2)/3; +endfunction +//Starting point, linear constraints and variable bounds +x0=[0 , 0]; +A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1]; +b=[2;1;2;1;-1;2]; +Aeq=[1,1]; +beq=[2]; +lb=[]; +ub=[]; +nlc=[]; +//Gradient of objective function +function y=fGrad(x) +y= [-1,-1/3]; +endfunction +//Hessian of lagrangian +function y=lHess(x, obj, lambda) +y= obj*[0,0;0,0] +endfunction +//Options +options=list("GradObj", fGrad, "Hessian", lHess); +//Calling Ipopt +[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) +// Press ENTER to continue | ![]() | ![]() |
//Find x in R^3 such that it minimizes: +//f(x)= x1*x2 + x2*x3 +//x0=[0.1 , 0.1 , 0.1] +//constraint-1 (c1): x1^2 - x2^2 + x3^2 <= 2 +//constraint-2 (c2): x1^2 + x2^2 + x3^2 <= 10 +//Objective function to be minimised +function y=f(x) +y=x(1)*x(2)+x(2)*x(3); +endfunction +//Starting point, linear constraints and variable bounds +x0=[0.1 , 0.1 , 0.1]; +A=[]; +b=[]; +Aeq=[]; +beq=[]; +lb=[]; +ub=[]; +//Nonlinear constraints +function [c, ceq]=nlc(x) +c = [x(1)^2 - x(2)^2 + x(3)^2 - 2 , x(1)^2 + x(2)^2 + x(3)^2 - 10]; +ceq = []; +endfunction +//Gradient of objective function +function y=fGrad(x) +y= [x(2),x(1)+x(3),x(2)]; +endfunction +//Hessian of the Lagrange Function +function y=lHess(x, obj, lambda) +y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,-2,0;0,0,2] + lambda(2)*[2,0,0;0,2,0;0,0,2] +endfunction +//Gradient of Non-Linear Constraints +function [cg, ceqg]=cGrad(x) +cg=[2*x(1) , -2*x(2) , 2*x(3) ; 2*x(1) , 2*x(2) , 2*x(3)]; +ceqg=[]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad); +//Calling Ipopt +[x,fval,exitflag,output] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) +// Press ENTER to continue | ![]() | ![]() |
//The below problem is an unbounded problem: +//Find x in R^3 such that it minimizes: +//f(x)= -(x1^2 + x2^2 + x3^2) +//x0=[0.1 , 0.1 , 0.1] +// x1 <= 0 +// x2 <= 0 +// x3 <= 0 +//Objective function to be minimised +function y=f(x) +y=-(x(1)^2+x(2)^2+x(3)^2); +endfunction +//Starting point, linear constraints and variable bounds +x0=[0.1 , 0.1 , 0.1]; +A=[]; +b=[]; +Aeq=[]; +beq=[]; +lb=[]; +ub=[0,0,0]; +//Options +options=list("MaxIter", [1500], "CpuTime", [500]); +//Calling Ipopt +[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,[],options) +// Press ENTER to continue | ![]() | ![]() |
//The below problem is an infeasible problem: +//Find x in R^3 such that in minimizes: +//f(x)=x1*x2 + x2*x3 +//x0=[1,1,1] +//constraint-1 (c1): x1^2 <= 1 +//constraint-2 (c2): x1^2 + x2^2 <= 1 +//constraint-3 (c3): x3^2 <= 1 +//constraint-4 (c4): x1^3 = 0.5 +//constraint-5 (c5): x2^2 + x3^2 = 0.75 +// 0 <= x1 <=0.6 +// 0.2 <= x2 <= inf +// -inf <= x3 <= 1 +//Objective function to be minimised +function y=f(x) +y=x(1)*x(2)+x(2)*x(3); +endfunction +//Starting point, linear constraints and variable bounds +x0=[1,1,1]; +A=[]; +b=[]; +Aeq=[]; +beq=[]; +lb=[0 0.2,-%inf]; +ub=[0.6 %inf,1]; +//Nonlinear constraints +function [c, ceq]=nlc(x) +c=[x(1)^2-1,x(1)^2+x(2)^2-1,x(3)^2-1]; +ceq=[x(1)^3-0.5,x(2)^2+x(3)^2-0.75]; +endfunction +//Gradient of objective function +function y=fGrad(x) +y= [x(2),x(1)+x(3),x(2)]; +endfunction +//Hessian of the Lagrange Function +function y=lHess(x, obj, lambda) +y= obj*[0,1,0;1,0,1;0,1,0] + lambda(1)*[2,0,0;0,0,0;0,0,0] + lambda(2)*[2,0,0;0,2,0;0,0,0] +lambda(3)*[0,0,0;0,0,0;0,0,2] + lambda(4)*[6*x(1 ),0,0;0,0,0;0,0,0] + lambda(5)*[0,0,0;0,2,0;0,0,2]; +endfunction +//Gradient of Non-Linear Constraints +function [cg, ceqg]=cGrad(x) +cg = [2*x(1),0,0;2*x(1),2*x(2),0;0,0,2*x(3)]; +ceqg = [3*x(1)^2,0,0;0,2*x(2),2*x(3)]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "GradObj", fGrad, "Hessian", lHess,"GradCon", cGrad); +//Calling Ipopt +[x,fval,exitflag,output,lambda,grad,hessian] =fmincon(f, x0,A,b,Aeq,beq,lb,ub,nlc,options) | ![]() | ![]() |
Solves minimax constraint problem
xopt = fminimax(fun,x0) +xopt = fminimax(fun,x0,A,b) +xopt = fminimax(fun,x0,A,b,Aeq,beq) +xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub) +xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun) +xopt = fminimax(fun,x0,A,b,Aeq,beq,lb,ub,nonlinfun,options) +[xopt, fval] = fmincon(.....) +[xopt, fval, maxfval]= fmincon(.....) +[xopt, fval, maxfval, exitflag]= fmincon(.....) +[xopt, fval, maxfval, exitflag, output]= fmincon(.....) +[xopt, fval, maxfval, exitflag, output, lambda]= fmincon(.....)
The function to be minimized. fun is a function that accepts a vector x and returns a vector F, the objective functions evaluated at x.
a vector of double, contains initial guess of variables.
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
function that computes the nonlinear inequality constraints c⋅x ≤ 0 and nonlinear equality constraints c⋅x = 0.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
a 1x1 matrix of doubles, the maximum value in vector fval
The exit status. See below for details.
The structure consist of statistics about the optimization. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
fminimax minimizes the worst-case (largest) value of a set of multivariable functions, starting at an initial estimate. This is generally referred to as the minimax problem.
+Currently, fminimax calls fmincon which uses the ip-opt algorithm.
+max-min problems can also be solved with fminimax, using the identity
+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. +
The objective function must have header : +
+where x is a n x 1 matrix of doubles and F is a m x 1 matrix of doubles where m is the total number of objective functions inside F. +On input, the variable x contains the current point and, on output, the variable F must contain the objective function values. +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of minmaxObjfun. In case the GradObj option is off and GradConstr option is on, fminimax approximates minmaxObjfun gradient using numderivative toolbox.
+If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.
+Furthermore, we must enable the "GradObj" option with the statement : +
minimaxOptions = list("GradObj",fGrad); | ![]() | ![]() |
The constraint function must have header : +
+where x is a n x 1 matrix of dominmaxUbles, c is a 1 x nni matrix of doubles and ceq is a 1 x nne 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. +By default, the gradient options for fminimax are turned off and and fmincon does the gradient opproximation of confun. In case the GradObj option is on and GradCons option is off, fminimax approximates confun gradient using numderivative toolbox.
+If we can provide exact gradients, we should do so since it improves the convergence speed of the optimization algorithm.
+Furthermore, we must enable the "GradCon" option with the statement : +
minimaxOptions = list("GradCon",confunGrad); | ![]() | ![]() |
The constraint derivative function must have header : +
+where dc is a nni x n matrix of doubles and dceq is a nne x n matrix of doubles. +The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
// A case where we provide the gradient of the objective +// functions and the Jacobian matrix of the constraints. +// The objective function and its gradient +function f=myfun(x) +f(1)= 2*x(1)^2 + x(2)^2 - 48*x(1) - 40*x(2) + 304; +f(2)= -x(1)^2 - 3*x(2)^2; +f(3)= x(1) + 3*x(2) -18; +f(4)= -x(1) - x(2); +f(5)= x(1) + x(2) - 8; +endfunction +// Defining gradient of myfun +function G=myfungrad(x) +G = [ 4*x(1) - 48, -2*x(1), 1, -1, 1; +2*x(2) - 40, -6*x(2), 3, -1, 1; ]' +endfunction +// The nonlinear constraints and the Jacobian +// matrix of the constraints +function [c, ceq]=confun(x) +// Inequality constraints +c = [1.5 + x(1)*x(2) - x(1) - x(2), -x(1)*x(2) - 10] +// No nonlinear equality constraints +ceq=[] +endfunction +// Defining gradient of confungrad +function [DC, DCeq]=cgrad(x) +// DC(:,i) = gradient of the i-th constraint +// DC = [ +// Dc1/Dx1 Dc1/Dx2 +// Dc2/Dx1 Dc2/Dx2 +// ] +DC= [ +x(2)-1, -x(2) +x(1)-1, -x(1) +]' +DCeq = []' +endfunction +// Test with both gradient of objective and gradient of constraints +minimaxOptions = list("GradObj",myfungrad,"GradCon",cgrad); +// The initial guess +x0 = [0,10]; +// The expected solution : only 4 digits are guaranteed +xopt = [0.92791 7.93551] +fopt = [6.73443 -189.778 6.73443 -8.86342 0.86342] +maxfopt = 6.73443 +// Run fminimax +[x,fval,maxfval,exitflag,output] = fminimax(myfun,x0,[],[],[],[],[],[], confun, minimaxOptions) | ![]() | ![]() |
Solves a multi-variable unconstrainted optimization problem
xopt = fminunc(f,x0) +xopt = fminunc(f,x0,options) +[xopt,fopt] = fminunc(.....) +[xopt,fopt,exitflag]= fminunc(.....) +[xopt,fopt,exitflag,output]= fminunc(.....) +[xopt,fopt,exitflag,output,gradient]=fminunc(.....) +[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(.....)
a function, representing the objective function of the problem
a vector of doubles, containing the starting of variables.
a list, containing the option for user to specify. See below for details.
a vector of doubles, the computed solution of the optimization problem.
a scalar of double, the function value at x.
a scalar of integer, containing the flag which denotes the reason for termination of algorithm. See below for details.
a structure, containing the information about the optimization. See below for details.
a vector of doubles, containing the the gradient of the solution.
a matrix of doubles, containing the the hessian of the solution.
Search the minimum of an unconstrained optimization problem specified by : +Find the minimum of f(x) such that
+The routine calls Ipopt for solving the Un-constrained Optimization problem, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
//Find x in R^2 such that it minimizes the Rosenbrock function +//f = 100*(x2 - x1^2)^2 + (1-x1)^2 +//Objective function to be minimised +function y=f(x) +y= 100*(x(2) - x(1)^2)^2 + (1-x(1))^2; +endfunction +//Starting point +x0=[-1,2]; +//Gradient of objective function +function y=fGrad(x) +y= [-400*x(1)*x(2) + 400*x(1)^3 + 2*x(1)-2, 200*(x(2)-x(1)^2)]; +endfunction +//Hessian of Objective Function +function y=fHess(x) +y= [1200*x(1)^2- 400*x(2) + 2, -400*x(1);-400*x(1), 200 ]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess); +//Calling Ipopt +[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options) +// Press ENTER to continue | ![]() | ![]() |
//The below problem is an unbounded problem: +//Find x in R^2 such that the below function is minimum +//f = - x1^2 - x2^2 +//Objective function to be minimised +function y=f(x) +y= -x(1)^2 - x(2)^2; +endfunction +//Starting point +x0=[2,1]; +//Gradient of objective function +function y=fGrad(x) +y= [-2*x(1),-2*x(2)]; +endfunction +//Hessian of Objective Function +function y=fHess(x) +y= [-2,0;0,-2]; +endfunction +//Options +options=list("MaxIter", [1500], "CpuTime", [500], "Gradient", fGrad, "Hessian", fHess); +//Calling Ipopt +[xopt,fopt,exitflag,output,gradient,hessian]=fminunc(f,x0,options) | ![]() | ![]() |
Solves a linear programming problem.
xopt = linprog(c,A,b) +xopt = linprog(c,A,b,Aeq,beq) +xopt = linprog(c,A,b,Aeq,beq,lb,ub) +xopt = linprog(c,A,b,Aeq,beq,lb,ub,param) +xopt = linprog(file) +xopt = linprog(file,param) +[xopt,fopt,exitflag,output,lambda] = linprog( ... )
a vector of double, contains coefficients of the variables in the objective
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb ≤ x ≤ ub.
Upper bounds, specified as a vector or array of double. ub represents the upper bounds elementwise in lb ≤ x ≤ ub.
a list containing the parameters to be set.
a string describing the path to the mps file.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
status flag returned from symphony. See below for details.
The output data structure contains detailed information about the optimization process. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
OSI-CLP is used for solving the linear programming problems, OSI-CLP is a library written in C++. +Search the minimum of a constrained linear programming problem specified by :
+The routine calls Clp for solving the linear programming problem, Clp is a library written in C++.
+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. In the current version it only contains maxiter. +
The exitflag allows to know the status of the optimization which is given back by CLP. +
The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
filepath = get_absolute_file_path('linprog.dem.sce'); +filepath = filepath + "exmip1.mps" +[xopt,fopt,exitflag,output,lambda] =linprog(filepath) | ![]() | ![]() |
Solves a linear quadratic problem.
xopt = lsqlin(C,d,A,b) +xopt = lsqlin(C,d,A,b,Aeq,beq) +xopt = lsqlin(C,d,A,b,Aeq,beq,lb,ub) +xopt = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0) +xopt = lsqlin(C,d,A,b,Aeq,beq,lb,ub,x0,param) +[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin( ... )
a matrix of double, represents the multiplier of the solution x in the expression C⋅x - d. Number of columns in C is equal to the number of elements in x.
a vector of double, represents the additive constant term in the expression C⋅x - d. Number of elements in d is equal to the number of rows in C matrix.
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
a vector of double, contains initial guess of variables.
a list containing the parameters to be set.
a vector of double, the computed solution of the optimization problem.
a double, objective value returned as the scalar value norm(C⋅x-d)^2.
a vector of double, solution residuals returned as the vector d-C⋅x.
The exit status. See below for details.
The structure consist of statistics about the optimization. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
Search the minimum of a constrained linear least square problem specified by :
+The routine calls Ipopt for solving the linear least square problem, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
//A basic example for equality, inequality constraints and variable bounds +C = [1 1 1; +1 1 0; +0 1 1; +1 0 0; +0 0 1] +d = [89; +67; +53; +35; +20;] +A = [3 2 1; +2 3 4; +1 2 3]; +b = [191 +209 +162]; +Aeq = [1 2 1]; +beq = 10; +lb = repmat(0.1,3,1); +ub = repmat(4,3,1); +[xopt,resnorm,residual,exitflag,output,lambda] = lsqlin(C,d,A,b,Aeq,beq,lb,ub) | ![]() | ![]() |
Solves nonnegative least-squares curve fitting problems.
xopt = lsqnonneg(C,d) +xopt = lsqnonneg(C,d,param) +[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg( ... )
a matrix of double, represents the multiplier of the solution x in the expression C⋅x - d. Number of columns in C is equal to the number of elements in x.
a vector of double, represents the additive constant term in the expression C⋅x - d. Number of elements in d is equal to the number of rows in C matrix.
a vector of double, the computed solution of the optimization problem.
a double, objective value returned as the scalar value norm(C⋅x-d)^2.
a vector of double, solution residuals returned as the vector d-C⋅x.
The exit status. See below for details.
The structure consist of statistics about the optimization. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
Solves nonnegative least-squares curve fitting problems specified by :
+The routine calls Ipopt for solving the nonnegative least-squares curve fitting problems, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
Solves a linear quadratic problem.
xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB) +xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0) +xopt = qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) +[xopt,fopt,exitflag,output,lamda] = qpipopt( ... )
a double, number of variables
a double, number of constraints
a symmetric matrix of double, represents coefficients of quadratic in the quadratic problem.
a vector of double, represents coefficients of linear in the quadratic problem
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
a matrix of double, contains the constraint matrix conLB ≤ A⋅x ≤ conUB.
a vector of double, contains lower bounds of the constraints conLB ≤ A⋅x ≤ conUB.
a vector of double, contains upper bounds of the constraints conLB ≤ A⋅x ≤ conUB.
a vector of double, contains initial guess of variables.
a list containing the parameters to be set.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
The exit status. See below for details.
The structure consist of statistics about the optimization. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
Search the minimum of a constrained linear quadratic optimization problem specified by :
+The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
//Find x in R^6 such that: +A= [1,-1,1,0,3,1; +-1,0,-3,-4,5,6; +2,5,3,0,1,0 +0,1,0,1,2,-1; +-1,0,2,1,1,0]; +conLB=[1;2;3;-%inf;-%inf]; +conUB = [1;2;3;-1;2.5]; +lb=[-1000;-10000; 0; -1000; -1000; -1000]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +//and minimize 0.5*x'⋅H⋅x + f'⋅x with +f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); +nbVar = 6; +nbCon = 5; +x0 = repmat(0,nbVar,1); +param = list("MaxIter", 300, "CpuTime", 100); +[xopt,fopt,exitflag,output,lambda]=qpipopt(nbVar,nbCon,H,f,lb,ub,A,conLB,conUB,x0,param) | ![]() | ![]() |
Solves a linear quadratic problem.
xopt = qpipoptmat(H,f) +xopt = qpipoptmat(H,f,A,b) +xopt = qpipoptmat(H,f,A,b,Aeq,beq) +xopt = qpipoptmat(H,f,A,b,Aeq,beq,lb,ub) +xopt = qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,x0) +xopt = qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,x0,param) +[xopt,fopt,exitflag,output,lamda] = qpipoptmat( ... )
a symmetric matrix of double, represents coefficients of quadratic in the quadratic problem.
a vector of double, represents coefficients of linear in the quadratic problem
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, contains lower bounds of the variables.
a vector of double, contains upper bounds of the variables.
a vector of double, contains initial guess of variables.
a list containing the parameters to be set.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
The exit status. See below for details.
The structure consist of statistics about the optimization. See below for details.
The structure consist of the Lagrange multipliers at the solution of problem. See below for details.
Search the minimum of a constrained linear quadratic optimization problem specified by :
+The routine calls Ipopt for solving the quadratic problem, Ipopt is a library written in C++.
+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. +
The exitflag allows to know the status of the optimization which is given back by Ipopt. +
For more details on exitflag see the ipopt documentation, go to http://www.coin-or.org/Ipopt/documentation/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
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. +
//Find x in R^6 such that: +Aeq= [1,-1,1,0,3,1; +-1,0,-3,-4,5,6; +2,5,3,0,1,0]; +beq=[1; 2; 3]; +A= [0,1,0,1,2,-1; +-1,0,2,1,1,0]; +b = [-1; 2.5]; +lb=[-1000; -10000; 0; -1000; -1000; -1000]; +ub=[10000; 100; 1.5; 100; 100; 1000]; +x0 = repmat(0,6,1); +param = list("MaxIter", 300, "CpuTime", 100); +//and minimize 0.5*x'*H*x + f'*x with +f=[1; 2; 3; 4; 5; 6]; H=eye(6,6); +[xopt,fopt,exitflag,output,lambda]=qpipoptmat(H,f,A,b,Aeq,beq,lb,ub,x0,param) | ![]() | ![]() |
Add a new constraint
sym_addConstr(coeff,type,bound1[,bound2])
This function adds a new constraint from scratch. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
+The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
Sparse matrix representing coefficients of the variables in the new constraint (must have 1 row and number of columns equal to number of variables)
Type of the new constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
The first (or only) bound for the constraint
The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
Returns 0
Add a new variable
sym_addVar(coeff,lower,upper,obj,isInt,name)
This function adds a new variable from scratch.
Sparse matrix representing coefficients of the new variable in the existing constraints (must have 1 column and number of rows equal to number of constraints)
Lower bound of the new variable
Upper bound of the new variable
Coefficient of the variable in the objective function
Wether the variable is constrainted to be an integer (boolean %t or %f)
Name of the new variable
Returns 0
sym_addVar(sparse([0;0;1;2;0;0]),0,%inf,1.2,%t,"part1") | ![]() | ![]() |
Close the Symphony environment
sym_close()
Closes the already open Symphony environment.
+Warning: All data loaded into the environment is deleted.
This function takes no arguments
Returns 1 if the environment was successfully closed and 0 otherwise
This routine is used to delete rows from the original constraint matrix.
sym_deleteConstrs(indices)
An array indicating the indices of the rows to be deleted.
Returns 0 if the constraints specified in the indices are deleted successfully and 0 if it returns corresponding to an error value.
This routine is used to delete columns from the original problem description.
sym_deleteVars(indices)
Pointer to an integer type array indicating the indices of the column numbers(variables) to be deleted.
Returns 0 if the column numbers specified are deleted successfully and 0 if the deletion of column indices did not execute successfully and it returns with an error return value
Get the activity of the constraints in the solution
sym_getConstrActivity()
Get the activity of the constraints in the solution.
+This function may fail if the problem has not been solved already. Use sym_solve() in this case.
This function takes no arguments
Returns a matrix with 1 column and number of rows equal to number of constraints, that represents the activities of those constraints
To get the lower bounds of the constraints.
sym_getConstrLower()
This routine is used to get lower bounds of constraints.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a column vector of lower bounds of constraints.
To to get the constraint ranges.
sym_getConstrRange()
This routine is used to get the constraint ranges.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a column vector of the constraint ranges.
To get the row senses.
sym_getConstrSense()
This routine is used to get the row senses.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a column vector of the row senses.
To get the upper bounds of the constraints.
sym_getConstrUpper()
This routine is used to get upper bounds of the constraints.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a column vector of upper bounds of constraints.
This routine is used to get the value of a double type parameter.
sym_getDblParam(key)
The name of the double parameter whose value has to be retrieved. Note: should be given within " "
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
Get Symphony's infinity value
sym_getInfinity()
Get the value that Symphony considers to be infinity. This is equal to 10^20.
This function takes no arguments
Returns the infinity value of Symphony
This routine is used to get the value of an integer type parameter.
sym_getIntParam(key)
The name of the integer parameter whose value has to be retrieved. Note: should be given within " "
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
To get the number of the analyzed nodes of the branching tree after solving the problem.
sym_getIterCount()
This routine is used to get the number of the analyzed nodes of the branching tree after solving the problem.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns iteration count.
To get the constraint matrix.
sym_getMatrix()
This routine is used to get the constraint matrix as sparse matrix in a standard row-ordered format.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a row-ordered sparse matrix.
To get the number of the constraints of the current problem.
sym_getNumConstr()
This routine is used to get the number of the constraints of the current problem.
This function takes no arguments
If there was an error it prints error message to Scilab console and returns -1, else it returns a number ( >=0 ) as number of constraints.
To get the number of non-zero entries of the constraint matrix of the current problem.
sym_getNumElements()
This routine is used to get the number of non-zero entries of the constraint matrix of the current problem.
This function takes no arguments
If there was an error, it prints error message to Scilab console and returns -1, else it returns a number ( >=0 ) as number of non-zero elements.
To get the number of the variables of the current problem.
sym_getNumVar()
This routine is used to get the number of the variables of the current problem.
This function takes no arguments
If there was an error it prints error message to Scilab console and returns -1, else it returns a number ( >=0 ) as number of variables.
To get the objective vector.
sym_getObjCoeff()
This routine is used to get the objective vector.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a row vector of coefficients of variables in objective.
Get the objective sense
sym_getObjSense()
This function gets the sense of the objective function (minimization/maximization).
This function takes no arguments
Returns 1 if the objective is to be minimized and -1 if the objective is to be maximized
Get the optimized objective value
sym_getObjVal()
Get the optimized objective value after after solving the problem.
+This function may fail if the problem has not been solved already. Use sym_solve() in this case.
This function takes no arguments
Returns the optimized objective value
Get the primal bound of the problem
sym_getPrimalBound()
Get the primal bound of the loaded problem.
This function takes no arguments
Returns the primal bound of the problem
To to get the right hand side vector(column vector).
sym_getRhs()
This routine is used to get the right hand side vector(coumn vector).
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a column vector of the right hand side values of constraints.
To get status of the problem solver.
sym_getStatus()
This post-solution query routine is used to learn the termination status of the solution procedure.
+It prints status of the problem solver to scilab console.
This function takes no arguments
It returns 1 if it receives any return-value indicating an error message or 0 if it receives any return-value indicating a non-error message.
This routine is used to get the value of a string type parameter.
sym_getStrParam(key)
The name of the strung parameter whose value has to be retrieved. Note: should be given within " "
Returns 0 if the parameter's value has been successfully retrieved and displayed on the console ,else 1 is returned corressponding to an error value for the unsuccessful execution of the function
To get the lower bounds of the variables.
sym_getVarLower()
This routine is used to get the lower bounds of the variables.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a row vector of lower bounds of the variables.
Get the solution for the problem
sym_getVarSoln()
Get the solution for the problem after solving it.
+This function may fail if the problem has not been solved already. Use sym_solve() in this case.
This function takes no arguments
Returns a matrix with 1 row and number of columns equal to number of variables, that represents the solutions for those variables
To get the upper bounds of the variables.
sym_getVarUpper()
This routine is used to get the upper bounds of the variables.
+If there was an error it prints to Scilab console.
This function takes no arguments
It returns a row vector of upper bounds of the variables.
To check whether the problem was abandoned for some reason.
sym_isAbandoned()
This post-solution query routine is used to learn whether the problem was abandoned for some reason.
+It prints whether or not the problem was abandoned for some reason to scilab console.
This function takes no arguments
It returns 1 if the problem was abandoned or 0 if the problem was not abandoned or -1 if there was an error.
Check if a variable is constrained to be binary
sym_isBinary(index)
This function checks if a variable is constrained to be binary (0 or 1).
Index of the variable to check. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
Returns 1 if the variable is constrained to be binary and 0 if it is not.
Check if a variable is continuous
sym_isContinuous(index)
This function checks if a variable is continuous.
Index of the variable to check. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
Returns 1 if the variable is continuous and 0 if it is not.
Check if Symphony environment is active
sym_isEnvActive()
Check if Symphony environment is active (open). Most Symphony functions will require the environment to be open.
This function takes no arguments
Returns 1 if the environment is active and 0 otherwise
To check whether the problem was proven to be infeasible.
sym_isInfeasible()
This post-solution query routine is used to learn whether the problem was proven to be infeasible.
+It prints whether or not the problem was proven to be infeasible to scilab console.
This function takes no arguments
It returns 1 if the problem was solved proven to be infeasible or 0 if it was not proven to be infeasible or -1 if there was an error.
Check if a variable is constrained to be an integer
sym_isInteger(index)
This function checks if a variable is constrained to be an integer.
+index : Index of the variable to check. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
To know whether the iteration limit (node limit) was reached.
sym_isIterLimitReached()
This post-solution query routine is used to learn whether the iteration limit(node limit) was reached.
+It prints whether or not the iteration limit (node limit) was reached to scilab console.
+It can also be used if "find first feasible" parameter was set to true before solving the problem.
This function takes no arguments
It returns 1 if the iteration limit is reached or 0 if the iteration limit is not reached or -1 if there was an error.
To check whether the problem was solved to optimality.
sym_isOptimal()
This post-solution query routine is used to learn whether the problem was solved to
+optimality.
+It prints whether or not the problem was solved to optimality to scilab console.
This function takes no arguments
It returns 1 if the problem was solved to optimality or 0 if it was not solved to optimality or -1 if there was an error.
To know whether the target gap was reached.
sym_isTargetGapAchieved()
This post-solution query routine is used to learn whether the target gap was reached.
+It print whether or not the target gap was reached.
This function takes no arguments
It returns 1 if the target gap was reached or 0 if the target gap was not reached or -1 if there was an error.
To know whether the time limit was reached.
sym_isTimeLimitReached()
This post-solution query routine is used to learn whether the time limit was reached.
+It prints whether or not the time limit was reached to scilab console.
This function takes no arguments
It returns 1 if the time limit was reached or 0 if the time limit was not reached or -1 if there was an error.
This routine is used to load an instance from an MPS file.
sym_loadMPS(filename)
It is a string that has the path of the .mps file to loaded.It has to be given within double quotes ("")
Returns 0 if the .mps file is loaded properly to symphony and 0 if there is an error reading the mps file or the function returns with an error return value
status=sym_loadMPS("./sample.mps") -mps file present in the current directory of execution can be mentioned this way also | ![]() | ![]() |
status=sym_loadMPS("/home/Desktop/sample.mps") -mps file present at a different location must be specified with their entire path | ![]() | ![]() |
Load a problem into Symphony
sym_loadProblem(nbVar,nbConstr,varLB,varUB,objCoeff,isInt,objSense,conMatrix,conLB,conUB)
Loads a MIP problem into Symphony. All the necessary data can be given through a single function call.
+The type of constraint is automatically deduced from the constraint bounds.
Number of variables
Number of constraints
Matrix containing lower bounds of the variables (must have size 1 row and nbVar columns). Bound can be negative infinity
Matrix containing upper bounds of the variables (must have size 1 row and nbVar columns). Bound can be infinity
Matrix containing coefficients of the variables in the objective (must have size 1 row and nbVar columns)
Boolean matrix representing wether a variable is constrained to be an integer (must have size 1 row and nbVar columns)
The sense (maximization/minimization) of the objective. Use sym_minimize or sym_maximize here
Sparse matrix representing the constraint matrix (must have size nbConstr rows and nbVar columns)
Matrix containing lower bounds of the constraints (must have size nbConstr rows and 1 column)
Matrix containing upper bounds of the constraints (must have size nbConstr rows and 1 column)
Returns 0 if the problem was successfully loaded into Symphony
sym_loadProblem(2,2,[0,0],[%inf,%inf],[1,1],[%t,%t],sym_maximize,sparse([1,2;2,1]),[0;0],[7;6.5]) | ![]() | ![]() |
Load a problem into Symphony (basic version)
sym_loadProblemBasic(nbVar,nbConstr,varLB,varUB,objCoeff,isInt,objSense,conMatrix,conLB,conUB)
Loads a MIP problem into Symphony. All the necessary data can be given through a single function call.
+The type of constraint is automatically deduced from the constraint bounds.
+This version of the problem loader does not support sparse matrices and hence is only useful for small problems.
Number of variables
Number of constraints
Matrix containing lower bounds of the variables (must have size 1 row and nbVar columns). Bound can be negative infinity
Matrix containing upper bounds of the variables (must have size 1 row and nbVar columns). Bound can be infinity
Matrix containing coefficients of the variables in the objective (must have size 1 row and nbVar columns)
Boolean matrix representing wether a variable is constrained to be an integer (must have size 1 row and nbVar columns)
The sense (maximization/minimization) of the objective. Use sym_minimize or sym_maximize here
Matrix (normal) representing the constraint matrix (must have size nbConstr rows and nbVar columns)
Matrix containing lower bounds of the constraints (must have size nbConstr rows and 1 column)
Matrix containing upper bounds of the constraints (must have size nbConstr rows and 1 column)
Returns 0 if the problem was successfully loaded into Symphony
Open the Symphony environment
sym_open()
Opens the Symphony environment. The environment and all data loaded into it is maintained across function calls.
+This function fails if the environment is already open.
This function takes no arguments
Returns 1 if the environment was successfully opened and 0 otherwise
This routine sets all the environment variables and parameters to their default values.
sym_resetParams()
This function takes no arguments
Returns 0 if the environment variables and parameters are set to their default value and 1 if a value corresponding to an error is returned
Set the lower bound of a constraint
sym_setConstrLower(index,newBound)
This function changes the lower bound of a constraint
Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
The new lower bound for the constraint
Returns 0
Set the type of a constraint
sym_setConstrType(index,type,bound1[,bound2])
This function completely modifies the type of a constraint. Supported types of constraints are less than or equal to, more than or equal to, equal to, or ranged.
+The last argument is only required for ranged constraints. For the other types of constraints, only the third argument is required.
Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
New type of the constraint. Supported types: less than or equal to ("L"), greater than or equal to ("G"), equal to ("E"), or ranged ("R")
The first (or only) bound for the constraint
The second bound for ranged constraints. The two bounds for ranged constraints can be in any order.
Returns 0
Set the upper bound of a constraint
sym_setConstrUpper(index,newBound)
This function changes the upper bound of a constraint
Index of the constraint to modify. Must be in {0,1,2,...n-1} where n is the number of constraints in the problem
The new upper bound for the constraint
Returns 0
This routine is used to set the type of a variable to be continuous.
sym_setContinuous(index)
Index of the variable to be set continuous
Returns 0 if the variable type has been set as continuous and 0 if an error value is returned.
This routine is used to set a double type parameter.
sym_setDblParam(key,value)
The name of the double type parameter to be set. Note: should be given within " "
New value of the corresponding double parameter
Returns 0 if the parameter specified is set to the value mentioned and 0 if setting of the double parameter was unsuccessful due to invalid inputs
This routine is used to set an integer type parameter.
sym_setIntParam(key,value)
The name of the parameter to be set. Note:should be given within " "
New value of the corresponding integer parameter
Returns 0 if the parameter specified is set to the value mentioned and 0 if setting of the integer parameter was unsuccessful due to invalid inputs
This routine is used to set the type of a variable to be integer.
sym_setInteger(index)
The index of the variable type to be modified as integer. Note that, it has to be at most the number of columns.
Returns 0 if the variable type has been set as integer and 0 if an error value is returned.
Set coefficient of a variable in the objective
sym_setObjCoeff(index,newCoeff)
This function changes the coefficient of a variable in the objective function
Index of the variable to modify. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
The new coefficient of the variable
Returns 0
Set the objective sense
sym_setObjSense(sense)
This function sets the sense of the objective function (minimization/maximization).
The new sense of the objective function. Use sym_minimize or sym_maximize here
Returns 0
Set the primal bound of the problem
sym_setPrimalBound(bound)
Set the primal bound of the loaded problem.
The new primal bound for the problem
Returns 0
This routine is used to set a string type parameter.
sym_setStrParam(key,value)
The name of the string type parameter to be set. Note: should be given within " "
New value of the corresponding string parameter. Note: should be given within " "
Returns 0 if the parameter specified is set to the value mentioned and 0 if setting of the string parameter was unsuccessful due to invalid inputs
Set lower bound of a variable
sym_setVarLower(index,newBound)
This function changes the lower bound of a variable to a new value
Index of the variable to modify. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
The new lower bound for the variable
Returns 0
Set a solution for the problem
sym_setVarSoln(solution)
Sets a known solution for the problem.
+This function fails if the solution entered does not satisfy all bounds or is worse than another currently known solution.
Matrix containing solutions for the variables (must have size 1 row and number of columns equal to number of variables)
Returns 0
Set upper bound of a variable
sym_setVarUpper(index,newBound)
This function changes the upper bound of a variable to a new value
Index of the variable to modify. Must be in {0,1,2,...n-1} where n is the number of variables in the problem
The new upper bound for the variable
Returns 0
To solve the currently loaded MILP problem from scratch.
sym_solve()
This routine solves the currently loaded MILP problem from scratch.
+It prints status of the problem solver to scilab console.
This function takes no arguments
It returns 1 if it receives any return-value indicating an error message or 0 if it receives any return-value indicating a non-error message.
Solves a mixed integer linear programming constrained optimization problem.
xopt = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB) +xopt = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,objSense) +xopt = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,objSense,options) +[xopt,fopt,status,output] = symphony( ... )
a double, number of variables.
a double, number of constraints.
a vector of double, represents coefficients of the variables in the objective.
a vector of boolean, represents wether a variable is constrained to be an integer.
a vector of double, represents lower bounds of the variables.
a vector of double, represents upper bounds of the variables.
a matrix of double, represents matrix representing the constraint matrix conLB ≤ A⋅x ≤ conUB.
a vector of double, represents lower bounds of the constraints conLB ≤ A⋅x ≤ conUB.
a vector of double, represents upper bounds of the constraints conLB ≤ A⋅x ≤ conUB.
The sense (maximization/minimization) of the objective. Use 1(sym_minimize ) or -1 (sym_maximize) here.
a list containing the parameters to be set.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
status flag returned from symphony.See below for details.
The output data structure contains detailed information about the optimization process. See below for details.
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
+The routine calls SYMPHONY written in C by gateway files for the actual computation.
+The status allows to know the status of the optimization which is given back by Ipopt. +
For more details on status see the symphony documentation, go to http://www.coin-or.org/SYMPHONY/man-5.6/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
//Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. +// Objective function +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; +// Lower Bound of variable +lb = repmat(0,8,1); +// Upper Bound of variables +ub = [repmat(1,4,1);repmat(%inf,4,1)]; +// Constraint Matrix +A = [5,3,4,6,1,1,1,1; +5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03; +5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;] +// Lower Bound of constraints +conlb = [ 25; 1.25; 1.25] +// Upper Bound of constraints +conub = [ 25; 1.25; 1.25] +// Row Matrix for telling symphony that the is integer or not +isInt = [repmat(%t,1,4) repmat(%f,1,4)]; +xopt = [1 1 0 1 7.25 0 0.25 3.5] +fopt = [8495] +// Calling Symphony +[x,f,status,output] = symphony(8,3,c,isInt,lb,ub,A,conlb,conub,1) +// Press ENTER to continue | ![]() | ![]() |
// An advanced case where we set some options in symphony +// This problem is taken from +// P.C.Chu and J.E.Beasley +// "A genetic algorithm for the multidimensional knapsack problem", +// Journal of Heuristics, vol. 4, 1998, pp63-86. +// The problem to be solved is: +// Max sum{j=1,...,n} p(j)x(j) +// st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m +// x(j)=0 or 1 +// The function to be maximize i.e. P(j) +c = [ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. +825 1002 860 615 540 797 616 660 707 866 647 746 1006 608 .. +877 900 573 788 484 853 942 630 591 630 640 1169 932 1034 .. +957 798 669 625 467 1051 552 717 654 388 559 555 1104 783 .. +959 668 507 855 986 831 821 825 868 852 832 828 799 686 .. +510 671 575 740 510 675 996 636 826 1022 1140 654 909 799 .. +1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; +//Constraint Matrix +A = [ +//Constraint 1 +42 41 523 215 819 551 69 193 582 375 367 478 162 898 .. +550 553 298 577 493 183 260 224 852 394 958 282 402 604 .. +164 308 218 61 273 772 191 117 276 877 415 873 902 465 .. +320 870 244 781 86 622 665 155 680 101 665 227 597 354 .. +597 79 162 998 849 136 112 751 735 884 71 449 266 420 .. +797 945 746 46 44 545 882 72 383 714 987 183 731 301 .. +718 91 109 567 708 507 983 808 766 615 554 282 995 946 651 298; +//Constraint 2 +509 883 229 569 706 639 114 727 491 481 681 948 687 941 .. +350 253 573 40 124 384 660 951 739 329 146 593 658 816 .. +638 717 779 289 430 851 937 289 159 260 930 248 656 833 .. +892 60 278 741 297 967 86 249 354 614 836 290 893 857 .. +158 869 206 504 799 758 431 580 780 788 583 641 32 653 .. +252 709 129 368 440 314 287 854 460 594 512 239 719 751 .. +708 670 269 832 137 356 960 651 398 893 407 477 552 805 881 850; +//Constraint 3 +806 361 199 781 596 669 957 358 259 888 319 751 275 177 .. +883 749 229 265 282 694 819 77 190 551 140 442 867 283 .. +137 359 445 58 440 192 485 744 844 969 50 833 57 877 .. +482 732 968 113 486 710 439 747 174 260 877 474 841 422 .. +280 684 330 910 791 322 404 403 519 148 948 414 894 147 .. +73 297 97 651 380 67 582 973 143 732 624 518 847 113 .. +382 97 905 398 859 4 142 110 11 213 398 173 106 331 254 447 ; +//Constraint 4 +404 197 817 1000 44 307 39 659 46 334 448 599 931 776 .. +263 980 807 378 278 841 700 210 542 636 388 129 203 110 .. +817 502 657 804 662 989 585 645 113 436 610 948 919 115 .. +967 13 445 449 740 592 327 167 368 335 179 909 825 614 .. +987 350 179 415 821 525 774 283 427 275 659 392 73 896 .. +68 982 697 421 246 672 649 731 191 514 983 886 95 846 .. +689 206 417 14 735 267 822 977 302 687 118 990 323 993 525 322; +//Constrain 5 +475 36 287 577 45 700 803 654 196 844 657 387 518 143 .. +515 335 942 701 332 803 265 922 908 139 995 845 487 100 .. +447 653 649 738 424 475 425 926 795 47 136 801 904 740 .. +768 460 76 660 500 915 897 25 716 557 72 696 653 933 .. +420 582 810 861 758 647 237 631 271 91 75 756 409 440 .. +483 336 765 637 981 980 202 35 594 689 602 76 767 693 .. +893 160 785 311 417 748 375 362 617 553 474 915 457 261 350 635 ; +]; +nbCon = size(A,1) +nbVar = size(A,2) +// Lower Bound of variables +lb = repmat(0,nbVar,1) +// Upper Bound of variables +ub = repmat(1,nbVar,1) +// Row Matrix for telling symphony that the is integer or not +isInt = repmat(%t,1,nbVar) +// Lower Bound of constraints +conLB=repmat(0,nbCon,1); +// Upper Bound of constraints +conUB=[11927 13727 11551 13056 13460 ]'; +options = list("time_limit", 25); +// The expected solution : +// Output variables +xopt = [0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 .. +0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 .. +0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0] +// Optimal value +fopt = [ 24381 ] +// Calling Symphony +[x,f,status,output] = symphony(nbVar,nbCon,c,isInt,lb,ub,A,conLB,conUB,-1,options); | ![]() | ![]() |
Solves a mixed integer linear programming constrained optimization problem in intlinprog format.
xopt = symphonymat(c,intcon,A,b) +xopt = symphonymat(c,intcon,A,b,Aeq,beq) +xopt = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub) +xopt = symphonymat(c,intcon,A,b,Aeq,beq,lb,ub,options) +[xopt,fopt,status,output] = symphonymat( ... )
a vector of double, contains coefficients of the variables in the objective
Vector of integer constraints, specified as a vector of positive integers. The values in intcon indicate the components of the decision variable x that are integer-valued. intcon has values from 1 through number of variable.
a matrix of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a vector of double, represents the linear coefficients in the inequality constraints A⋅x ≤ b.
a matrix of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
a vector of double, represents the linear coefficients in the equality constraints Aeq⋅x = beq.
Lower bounds, specified as a vector or array of double. lb represents the lower bounds elementwise in lb ≤ x ≤ ub.
Upper bounds, specified as a vector or array of double. ub represents the upper bounds elementwise in lb ≤ x ≤ ub.
a list containing the parameters to be set.
a vector of double, the computed solution of the optimization problem.
a double, the value of the function at x.
status flag returned from symphony. See below for details.
The output data structure contains detailed information about the optimization process. See below for details.
Search the minimum or maximum of a constrained mixed integer linear programming optimization problem specified by :
+The routine calls SYMPHONY written in C by gateway files for the actual computation.
+The status allows to know the status of the optimization which is given back by Ipopt. +
For more details on status see the symphony documentation, go to http://www.coin-or.org/SYMPHONY/man-5.6/
+The output data structure contains detailed informations about the optimization process. +It has type "struct" and contains the following fields. +
// Objective function +// Reference: Westerberg, Carl-Henrik, Bengt Bjorklund, and Eskil Hultman. "An application of mixed integer programming in a Swedish steel mill." Interfaces 7, no. 2 (1977): 39-43. +c = [350*5,330*3,310*4,280*6,500,450,400,100]'; +// Lower Bound of variable +lb = repmat(0,1,8); +// Upper Bound of variables +ub = [repmat(1,1,4) repmat(%inf,1,4)]; +// Constraint Matrix +Aeq = [5,3,4,6,1,1,1,1; +5*0.05,3*0.04,4*0.05,6*0.03,0.08,0.07,0.06,0.03; +5*0.03,3*0.03,4*0.04,6*0.04,0.06,0.07,0.08,0.09;] +beq = [ 25, 1.25, 1.25] +intcon = [1 2 3 4]; +// Calling Symphony +[x,f,status,output] = symphonymat(c,intcon,[],[],Aeq,beq,lb,ub) +// Press ENTER to continue | ![]() | ![]() |
// An advanced case where we set some options in symphony +// This problem is taken from +// P.C.Chu and J.E.Beasley +// "A genetic algorithm for the multidimensional knapsack problem", +// Journal of Heuristics, vol. 4, 1998, pp63-86. +// The problem to be solved is: +// Max sum{j=1,...,n} p(j)x(j) +// st sum{j=1,...,n} r(i,j)x(j) <= b(i) i=1,...,m +// x(j)=0 or 1 +// The function to be maximize i.e. P(j) +c = -1*[ 504 803 667 1103 834 585 811 856 690 832 846 813 868 793 .. +825 1002 860 615 540 797 616 660 707 866 647 746 1006 608 .. +877 900 573 788 484 853 942 630 591 630 640 1169 932 1034 .. +957 798 669 625 467 1051 552 717 654 388 559 555 1104 783 .. +959 668 507 855 986 831 821 825 868 852 832 828 799 686 .. +510 671 575 740 510 675 996 636 826 1022 1140 654 909 799 .. +1162 653 814 625 599 476 767 954 906 904 649 873 565 853 1008 632]'; +//Constraint Matrix +A = [ //Constraint 1 +42 41 523 215 819 551 69 193 582 375 367 478 162 898 .. +550 553 298 577 493 183 260 224 852 394 958 282 402 604 .. +164 308 218 61 273 772 191 117 276 877 415 873 902 465 .. +320 870 244 781 86 622 665 155 680 101 665 227 597 354 .. +597 79 162 998 849 136 112 751 735 884 71 449 266 420 .. +797 945 746 46 44 545 882 72 383 714 987 183 731 301 .. +718 91 109 567 708 507 983 808 766 615 554 282 995 946 651 298; +//Constraint 2 +509 883 229 569 706 639 114 727 491 481 681 948 687 941 .. +350 253 573 40 124 384 660 951 739 329 146 593 658 816 .. +638 717 779 289 430 851 937 289 159 260 930 248 656 833 .. +892 60 278 741 297 967 86 249 354 614 836 290 893 857 .. +158 869 206 504 799 758 431 580 780 788 583 641 32 653 .. +252 709 129 368 440 314 287 854 460 594 512 239 719 751 .. +708 670 269 832 137 356 960 651 398 893 407 477 552 805 881 850; +//Constraint 3 +806 361 199 781 596 669 957 358 259 888 319 751 275 177 .. +883 749 229 265 282 694 819 77 190 551 140 442 867 283 .. +137 359 445 58 440 192 485 744 844 969 50 833 57 877 .. +482 732 968 113 486 710 439 747 174 260 877 474 841 422 .. +280 684 330 910 791 322 404 403 519 148 948 414 894 147 .. +73 297 97 651 380 67 582 973 143 732 624 518 847 113 .. +382 97 905 398 859 4 142 110 11 213 398 173 106 331 254 447 ; +//Constraint 4 +404 197 817 1000 44 307 39 659 46 334 448 599 931 776 .. +263 980 807 378 278 841 700 210 542 636 388 129 203 110 .. +817 502 657 804 662 989 585 645 113 436 610 948 919 115 .. +967 13 445 449 740 592 327 167 368 335 179 909 825 614 .. +987 350 179 415 821 525 774 283 427 275 659 392 73 896 .. +68 982 697 421 246 672 649 731 191 514 983 886 95 846 .. +689 206 417 14 735 267 822 977 302 687 118 990 323 993 525 322; +//Constrain 5 +475 36 287 577 45 700 803 654 196 844 657 387 518 143 .. +515 335 942 701 332 803 265 922 908 139 995 845 487 100 .. +447 653 649 738 424 475 425 926 795 47 136 801 904 740 .. +768 460 76 660 500 915 897 25 716 557 72 696 653 933 .. +420 582 810 861 758 647 237 631 271 91 75 756 409 440 .. +483 336 765 637 981 980 202 35 594 689 602 76 767 693 .. +893 160 785 311 417 748 375 362 617 553 474 915 457 261 350 635 ; +]; +nbVar = size(c,1) +b=[11927 13727 11551 13056 13460 ]; +// Lower Bound of variables +lb = repmat(0,1,nbVar) +// Upper Bound of variables +ub = repmat(1,1,nbVar) +// Lower Bound of constrains +intcon = []; +for i = 1:nbVar +intcon = [intcon i]; +end +options = list("time_limit", 25); +// The expected solution : +// Output variables +xopt = [0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 .. +0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 .. +0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0] +// Optimal value +fopt = [ 24381 ] +// Calling Symphony +[x,f,status,output] = symphonymat(c,intcon,A,b,[],[],lb,ub,options); | ![]() | ![]() |