[go: up one dir, main page]

Menu

[r66]: / trunk / rob_feas.m  Maximize  Restore  History

Download this file

75 lines (66 with data), 2.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function robust_feas = rob_feas(varargin)
%ROB_FEAS find a feasible solution in probabilistic sense for robust problem
%
% robust_feas = rob_feas(hFunc, hGrad, x0)
% robust_feas = rob_feas(hFunc, hGrad, x0, param1, param2, ...)
% robust_feas = rob_feas(hFunc, hGrad, x0, options)
%
% find a vector solution x for common function in form
% f(x, Delta) <= 0 forall Delta \in Delta
% where Q0, Q1, ... are symmetric matrices or handles to
% user-defined functions with uncertain matrices
% $Id$
if nargin == 3 % (hFunc, hGrad, x0)
hFunc = varargin{1};
hGrad = varargin{2};
x0 = varargin{3};
options = [];
elseif nargin == 4 % (hFunc, hGrad, x0, options)
hFunc = varargin{1};
hGrad = varargin{2};
x0 = varargin{3};
options = varargin{4};
else
error(['RACT:rob_feas:InputSize', ['Incorrect number of arguments: ' num2str(nargin)]]);
end
% validate options
options = valfeasopt(options);
if ~isa(hFunc, 'function_handle')
error(['RACT:rob_feas:InputType', 'First parameter hFunc should be function handle!']);
end
if ~isa(hGrad, 'function_handle')
error(['RACT:rob_feas:InputType', 'Second parameter hGrad should be function handle!']);
end
% initial point
x = x0;
Nin = ceil(log(1/options.delta)/log(1/(1 - options.eps)));
FEAS = 0; % constant for feasibility
for k=1:options.Nout
% cast probabilistic oracle
if ~(k==1)
[feasible, Ninter, Delta_viol] = poracle(hFunc, x, Nin, 'cont');
else
[feasible, Ninter, Delta_viol] = poracle(hFunc, x, Nin, 'init');
end
disp([num2str(k), '-th oracle casted, interrupted on ' num2str(Ninter) ' iteration (max ', num2str(Nin),').']);
if feasible
% solution considered to be found with some epsilon and delta
robust_feas = x;
return;
else
% violation sample found
% TODO can be speeded up by prefetching type of algorithm
switch options.method
case 'grad'
x = updgrad(hFunc, hGrad, x, Delta_viol, options);
case 'ell'
x = updell(hFunc, hGrad, x, Delta_viol, options);
case 'cutplane'
x = updcp(hFunc, hGrad, x, Delta_viol, options);
end
% [x.', 0, feval(hFunc, 0, Delta_viol, x, 1)]
end
end
robust_feas = x;
%warning('RACT:rob_feas:NoSolution', 'No feasible solution found.');
warning('No feasible solution found.');