function x = uncertain(x,varargin)%UNCERTAIN Declares a variable as uncertain%% F = UNCERTAIN(W) is used to describe the set of uncertain variables% in an uncertain program%% INPUT% W : SDPVAR object or list of constraints% S : Optional distribution information for random uncertainty%% OUTPUT% F : Constraint object%% Uncertain is used to declare uncertain variables in robust% deterministic worst-case optimization. It can also be used to specify% uncertain random variables, and their associated distribution, to be% used in OPTIMIZER objects with the SAMPLE command.%% EXAMPLE%% Robust worst-case optimization%% sdpvar x w% F = [x + w <= 1], W = [-0.5 <= w <= 0.5];% optimize([F,W,uncertain(w)],-x)%% sdpvar x w% F = [x + w <= 1], W = [-0.5 <= w <= 0.5];% optimize([F,uncertain(W)],-x)%% To specify random uncertainties, you specify the distribution, and all% distribution parameters following the syntax n the RANDOM command in% the Statistics Toolbox%% sdpvar x w% F = [x + w <= 1, uncertain(w, 'uniform',0,1)];% P = optimizer([F,W,uncertain(w)],-x,[],w,x)% S = sample(P,10); % Sample ten instances and concatenate models% S([]) % Solve and return optimal x%% Alternatively, you can specify a function handle which generates% samples. YALMIP will always send a trailing argument with dimensions%% F = [x + w <= 1, uncertain(w,@mysampler,myarguments1,...)];%% The standard random case above would thus be recovered with%% F = [x + w <= 1, uncertain(w,@random,0,1)];%%% See also OPTIMIZE, ROBUSTMODEL, OPTIMIZER, SAMPLEif nargin == 1 || ((nargin == 2) && strcmpi(varargin{1},'deterministic'))x.typeflag = 15;x.extra.distribution.name = 'deterministic';x = lmi(x);elsex.typeflag = 16;if isa(varargin{1},'function_handle')temp = {varargin{:},x.dim};elsetemp = {@random,varargin{:},x.dim};endx.extra.distribution.name = temp{1};x.extra.distribution.parameters = {temp{2:end-1}};trytemp = feval(temp{:});catchdisp(lasterr);error('Trial evaluation of attached sample generator failed.')endx = lmi(x);end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。