

The nonlinear constraint function should return a column vector of values. No matter the value of x, the function executes the same code path. Multiline MATLAB functions including loops are supported, but the function must be deterministic. Obj = objective(x,a,b) %now only a function of x


If your function requires multiple parameters you can wrap it like this: However, both functions must be a function of only one argument (x). Remember, your objective function must always result in a scalar.īoth MATLAB functions and anonymous functions are supported. ObjI3 = sum(a(1)*x) % scalar expansion is also supported ObjI = sum(a(a>1).*x(a>1)) % logical indexing The interface implements indexing that is identical to MATLAB so you can use logical or position based indexing: ObjD = a'*x % equivalent to above but via inner product ObjV = sum(a.*x) % element wise multiply summed For the following examples, assume x is a 3 x 1 column vector: The MATLAB - BARON Interface also supports a vector and a subset of matrix operations. If your objective is a function of only one variable (i.e., single variable optimization), you may drop the index:Īlternatively, if your objective does not contain any variables, you must still write it as a function of x: Based on this requirement, user-supplied functions must meet the following criteria:Ī simple objective function is written as a function of indexed (scalar) decision variables, such as: Therefore, user-supplied functions (e.g., objective and constraints) must be pre-processed to an algebraic form that BARON can process. BARON is a sophisticated global optimizer that requires an algebraic description of the model in order to optimize it.
