Вы находитесь на странице: 1из 4

7/29/2019 Non-linear optimization with constraints and extra arguments | www.scilab.

org

Non-linear optimization with constraints and extra


arguments

 DOWNLOAD
OPTIMTUTO.SCE (SCE)

The content provided so far around optimization within SCILAB allowed you to solve di erent kind of problems: linear, quadratic,
semi-de nite, non-linear least squares, discrete, multiobjective, global ; leveraging di erents techniques such as gradient
methods, simplex, Genetic Algorithms and even Simulated Annealing. 

It is actually a set of pretty powerful capabilities I won't be focusing on in this tutorial. Instead, I will try to kill a myth which subsists
since beginning of time ... Since SCILAB's beginning, actually, but trust me ... that's old!

SCILAB is actually providing tools to solve the most generic problem ever: Nonlinear optimization with constraints!

Isn't that epic? Well ... more that it sounds, actually. So let me show you what some people think isn't even possible.

For a deeper experience, you can download the script on top of this page.

The problem
For this tutorial, we will take the example of the Rosenbrock's Post O ce problem which is stated as follow:

https://www.scilab.org/non-linear-optimization-constraints-and-extra-arguments 1/4
7/29/2019 Non-linear optimization with constraints and extra arguments | www.scilab.org

The extra argument trick


In this case, the objective function is pretty easy to set. To simplify the constraints, we will wrote them as a matrix inequality:

The associated Scilab code is as follow

In that case, we added some extra parameters to the cost function. To be honnest, that was not mandatory. We could obviously
have hard coded the inequalities within the function. But in some cases, extra arguments computation is more complex or is
coming from an imported le. In such cases, it is preferable to use this syntax rather than using global variables. Last step is then
to use a list object to concatenate the cost function with the extra parameters you would like to use.

This trick can be used in pretty much every optimization function available within SCILAB.

The neldermead component


For this optimization we will use a simplex method. You might probably know the fminsearch function which is a packaged version
of the simplex. This function is based on the neldermead component documented here.

The neldermead component is an object like structure created with the neldermead_new function. This object then needs to be
con gured before searching for optimal position using the neldermead_con gure function. The optimization set up is similar to
what is done for other optimization methods. Just make sure you selected the BOX method which allows you to implement
constraints and specify the number inequality constraints using the nbineqconst parameter. The following code is therefore
straightforward

https://www.scilab.org/non-linear-optimization-constraints-and-extra-arguments 2/4
7/29/2019 Non-linear optimization with constraints and extra arguments | www.scilab.org

Finally you can run the optimization using the neldermead_search function and access the optimal position using the
neldermead_get function with -xopt argument.

In xcomp we can then nd the optimal solution minimizing our objective function which is (24, 12, 12).

Sitemap

Download

Tutorials

Industries

Technology

Services

Software

Cloud

About

GET IN TOUCH


WORK WITH US
Email: team@scilab.io
Web: http://scilab.io/company/careers/
https://www.scilab.org/non-linear-optimization-constraints-and-extra-arguments 3/4
7/29/2019 Non-linear optimization with constraints and extra arguments | www.scilab.org

3 bis rue Saarinen


94528 Rungis - France

ESI Group - 2018


Cookie settings | Privacy & Terms Of Use
Legal notice | Donate

Tweets by @Scilab
Scilab Retweeted

Boost 4.0
@boost4_0
Today in Portugal at our #GA meeting #boost40. More news from our pilots in the next newsletter, don’t miss it.
@IMetrology_ES @FillGurten @BENTELER_Group @vwportugal @gestamp_es

Embed View on Twitter

https://www.scilab.org/non-linear-optimization-constraints-and-extra-arguments 4/4

Вам также может понравиться