Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - Français


overview

An overview of the Optimbase toolbox.

Purpose

The goal of this component is to provide a building block for optimization methods. The goal is to provide a building block for a large class of specialized optimization methods. This component manages

  • the number of variables,

  • the minimum and maximum bounds,

  • the number of non linear inequality constraints,

  • the cost function,

  • the logging system,

  • various termination criteria,

  • etc...

This toolboxes is designed with Oriented Object ideas in mind.

Features

The following is a list of features the Optimbase toolbox currently provides:

  • Manage cost function

    • optional additional argument,

    • direct communication of the task to perform: cost function or inequality constraints.

  • Manage various termination criteria, including

    • maximum number of iterations,

    • tolerance on function value (relative or absolute),

    • tolerance on x (relative or absolute),

    • maximum number of evaluations of cost function.

  • Manage the history of the convergence, including

    • history of function values,

    • history of optimum point.

  • Provide query features for

    • the status of the optimization process,

    • the number of iterations,

    • the number of function evaluations,

    • function value at initial point,

    • function value at optimal point,

    • the optimum parameters,

    • etc...

Description

This set of commands allows to manage an abstract optimization method. The goal is to provide a building block for a large class of specialized optimization methods. This component manages the number of variables, the minimum and maximum bounds, the number of non linear inequality constraints, the logging system, various termination criteria, the cost function, etc...

The optimization problem to solve is the following

min f(x)
l_i <= x_i <= h_i, i = 1,n
g_i(x) >= 0, i = 1,nbineq

where

n

number of variables

nbineq

number of inequality constraints

Example

In the following example, ones searches to solve f(x) = 0 thanks dichotomy method. An optimization object is created and configured (number of variables, initial point, maximum number of iterations, ...). The -verbose option is enabled so that messages are generated during the algorithm, are printed.

function [f, index]=fun(x, index)
    f = 2*x - 4;
endfunction

a = -5;
b = 5;
x0 = (a+b)/2;

// Creation of the object
opt = optimbase_new();

// Configures the object
opt = optimbase_configure(opt,"-numberofvariables",2);
opt = optimbase_configure(opt, "-x0", x0);
opt = optimbase_configure(opt, "-tolxrelative", 10*%eps);
opt = optimbase_configure(opt, "-maxiter", 30);
opt = optimbase_configure(opt, "-function", fun);
opt = optimbase_configure(opt,"-verbose",1);

function x=Dicho(opt, a, b)
    xk = optimbase_cget(opt, "-x0");
    [opt, fx0, index] = optimbase_function (opt , xk , 1);
    opt = optimbase_set ( opt , "-xopt" , xk );
    opt = optimbase_set ( opt , "-fopt" , fx0 );
    terminate = %f;
    while ~terminate
        [opt, f, index] = optimbase_function(opt, xk, 1);
        [opt, g, index] = optimbase_function(opt, a, 1);
        if g*f <= 0 then
            b = xk;
        else
            a = xk;
        end
        x = (a + b)/2;
        opt = optimbase_incriter(opt);
        [opt, terminate, status] = optimbase_terminate(opt, optimbase_get(opt, "-fopt"), f, xk, x);
        opt = optimbase_set ( opt , "-xopt" , x );
        opt = optimbase_set ( opt , "-fopt" , f );
        xk = x;
    end
endfunction

x = Dicho(opt,a,b)
Report an issue
<< optimbase_outstruct Optimization base optimbase_proj2bnds >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:15:59 CEST 2024