www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimextoptions/numConstraints.m
function [n, mn, mx] = numConstraints(opts) %NUMCONSTRAINTS Get number of constraints in optimization % % N = NUMCONSTRAINTS(OPTS) gets the number of constraints that have been % defined in the optimization options. % % [N, MIN, MAX] = NUMCONSTRAINTS(OPTS) also returns the minimum and maximum % number of items that are allowed. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. n = length(getModelConstraints(opts)) + length(getLinearConstraints(opts)); if nargout>1 mode = getConstraintsMode(opts); if strcmp(mode, 'any'); mn = 0; mx = realmax; else mn = n; mx = n; end end