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

Change language to:
English - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Aide de Scilab >> Optimisation et Simulation > Optimization base > optimbase_checkcostfun


Checks the cost function.


opt = optimbase_checkcostfun(opt)



The object of TOPTIM type (tlist).


The optimbase_checkcostfun function checks that the cost function is correctly connected. This function generates an error if the cost function is not connected.

This function takes into account for the cost function at the initial guess x0 only. She checks that all values of the index argument are valid. If there are non-linear constraints, optimbase_checkcostfun checks that the matrix has the correct shape.

This function requires at least one call to the cost function to make the necessary checks.


function [y, index]=rosenbrock(x, index)
    y = 100*(x(2)-x(1)^2)^2 + (1-x(1))^2;

opt = optimbase_new ();
opt = optimbase_configure(opt,"-numberofvariables",2);
opt = optimbase_configure(opt,"-x0",[1.1 1.1]');
opt = optimbase_configure(opt,"-function",rosenbrock);
opt = optimbase_checkcostfun(opt)
opt = optimbase_destroy(opt);

See also

Report an issue
<< optimbase_checkbounds Optimization base optimbase_checkx0 >>

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:
Tue Feb 25 08:50:25 CET 2020