CloudRunner

... share your algorithms as a web service

Algorithm: Example for Data Validation in the Presence of Stochastic and Set-membership Uncertainties

Description:
Generates some random set-valued measurements and performs the data validation test.
All parameters are set according as specified in the paper.
Two suggested optimization algorithms are 'interior-point' (default) or 'active-set'.

Note: The Minkowski sum in dark green may be slightly inaccurate due to numerical approximation.
Paper: Florian Pfaff, Benjamin Noack, and Uwe D. Hanebeck. Data validation in the presence of stochastic and set-membership uncertainties (to appear). In Proceedings of the 16th International Conference on Information Fusion (Fusion 2013). Istanbul, Turkey, July 2013.
Tags: ellipsoid visualization validation correlation
Depends On: "Ellipsoidal toolbox essentials" by florian.pfaff (latest version)
Usage: Algorithm is public.
Viewed 3499 times, called 65 times
Upload:
Empty star Empty star Empty star Empty star Empty star
0 votes
Florian Pfaff
03/16/2013 4:12 p.m. (version #1)

Run Algorithm

:
Number of measurements to be performed
: Optimization algorithm used
: Allow cached result?
Close

Please Wait

Computation is running...

Plots

showing plot # of

Result Value(s)


		

Resource Usage

Execution of the algorithm took seconds.
Peak memory usage for running the algorithm was kilobytes (total usage: kilobytes).

Run ID / Link

ID of this run:
Link:

Result from Cache

Result has been delivered from cache and computed on (UTC).

Matlab log

(show)

		

Error

Using this algorithm in your local MATLAB environment is easy: Click here for instructions!

Usage Instructions for CloudRunner Client

  1. Download the CloudRunner Client by clicking here and place the downloaded file in your MATLAB working directory.

  2. Inside MATLAB, initialize the CloudRunner Client by calling CloudRunner:
    >> CloudRunner

    A login dialog will prompt for your CloudRunner mail address and password. For a start, you can leave the dialog empty and just click "Connect".

    Alternatively, you can provide the login credentials (or empty strings to skip login) as a parameter and hence skip the login dialog. This is useful when using CloudRunner in non-interactive scripts.
    >> CloudRunner('mail@example.com', 'password')

  3. Select this algorithm by its URL. Selecting an algorithm creates the lambda function that proxies calls to the algorithm to the server for execution:
    >> CloudRunnerSelect('http://www.cloudrunner.eu/algorithm/123/example-for-data-validation-in-the-presence-of-stochastic-and-set-membership-uncertainties/version/1/')

    For the sake of convenience, you can also use the algorithm ID instead of its URL for public algorithms.

  4. Call functions from the algorithm like any regular local function.

Note: You can find further information on the help page.

Source Code

File:

 1 function exampleCR(numberOfMeas,optimAlgo)
 2 % Visual evaluation for use on cloudrunner
 3 % @author Florian Pfaff
 4 % @date 2013
 5 
 6     %initialize static parameters
 7     xhat=[0;0];
 8     rmax=.7;
 9     Cxx=[0.2,0.1;0.1,0.4];
10     Cyy=diag([0.4,0.2]);
11     Hx=eye(2);
12     Hy=[1,0.1;0,2];
13     Xellip=[3,1;1,5];
14     %generate (up to) 200 joint covariances for plotting purposes
15     covs={};
16     for i=1:200
17         r=rand(4,1)*1.4-0.7;
18         Cxy=[r(1)*sqrt(Cxx(1)*Cyy(1)),r(2)*sqrt(Cxx(1)*Cyy(2));r(3)*sqrt(Cxx(2)*Cyy(1)),r(4)*sqrt(Cxx(4)*Cyy(4))]
19         Cyx=Cxy';
20         if ~all(all(Cxy/Cxx*Cxy<=0.7*Cyy))
21             disp('Does not satisfy')  %not a valid joint covariance, skip
22             continue
23         end
24         %print joint
25         disp([[Cxx,Cxy];[Cyx,Cyy]])
26         covCurr=Hx*Cxx*Hx'+Hy*Cyy*Hy'-Hx*Cxy*Hy'-Hy*Cyx*Hx';
27         covCurr=0.5*(covCurr+covCurr');
28         if min(eig(covCurr))<=0
29             disp('Not positive definite')
30             continue
31         end
32         covs=[covs,{covCurr}];
33         opt.color=[8,138,8]/255;
34         %plot(ellipsoid([0;0],covs{end}),opt) %comment in to view the joint covariance at the center
35     end
36     % Generate boundaries of Minkowski sum of X ellipsoid with union of
37     % covariance ellipsoids
38     boundaryPoints=[];
39     for i=1:length(covs)
40         boundaryPoints=[boundaryPoints,ellbndr_2dlocal(ellipsoid([0;0],covs{i}))];
41     end
42     indices=convhull(boundaryPoints(1,:),boundaryPoints(2,:));
43     conv1=boundaryPoints(:,indices);
44     conv2=ellbndr_2dlocal(ellipsoid([0;0],Hx*Xellip*Hx'));
45     boundaryPoints2=[];
46     for i=1:size(conv1,2)
47         boundaryPoints2=[boundaryPoints2,kron(conv1(:,i),ones(1,size(conv2,2)))+conv2];
48     end
49     indices=convhull(boundaryPoints2(1,:),boundaryPoints2(2,:));
50     convAll=boundaryPoints2(:,indices);
51     
52     hold on
53     plot(ellipsoid(Hx*xhat,Hx*Xellip*Hx'),'b')
54     % Generate some pseudo-random ellipsoids
55     rot=@(ang,base)0.5*(([cos(ang),-sin(ang);sin(ang),cos(ang)]'*base*[cos(ang),-sin(ang);sin(ang),cos(ang)])+([cos(ang),-sin(ang);sin(ang),cos(ang)]'*base*[cos(ang),-sin(ang);sin(ang),cos(ang)])');
56     yhatArray=arrayfun(@(i){randn(2,1)*4},1:numberOfMeas);
57     YellipArray=arrayfun(@(i){diag(rand(2,1)*5+0.3)},1:numberOfMeas);
58     YellipArray=arrayfun(@(i){rot(pi*rand,YellipArray{i})},1:numberOfMeas);
59     
60     % Set up some plot parameters
61     box on,grid on
62     xlabel('$e_1\rightarrow$')
63     ylabel('$e_2\rightarrow$')
64     set(findobj(gca,'color','b'),'LineStyle','--')
65     plot(convAll(1,:),convAll(2,:),opt)
66     
67     
68     % Plot all to get correct axis
69     for i=1:length(yhatArray)
70         plot(Hy*ellipsoid(yhatArray{i},YellipArray{i}),'c');
71     end
72     axis(axis)
73     delete(findobj(gca,'color','c'))
74     
75     % Test measurements and plot results
76     for i=1:length(yhatArray)
77         yhat=yhatArray{i};
78         Yellip=YellipArray{i};
79         if valTest(xhat,Cxx,Xellip,yhat,Cyy,Yellip,Hx,Hy,rmax,optimAlgo,1)
80             plot(Hy*ellipsoid(yhat,Yellip),'g');
81         else
82             plot(Hy*ellipsoid(yhat,Yellip),'r');
83         end
84         drawnow
85     end
86 
87 end
 1 function isValid=valTest(xhat,Cxx,Xellip,yhat,Cyy,Yellip,Hx,Hy,rmax,optimAlgo,k)
 2 % Use 'active−set' as optimAlgo for Karush–Kuhn–Tucker equations based
 3 % optimization or 'interior−point' for interior point based optimization
 4 % @author Florian Pfaff
 5 % @date 2013
 6 
 7     % Use ellipsoid centers as starting points for the optimization
 8     V0=[xhat;yhat]; % As vector because they may not be of equal lengths
 9     options=optimset('Algorithm',optimAlgo);
10     % Perform outer optimization
11     [~,minDist]=fmincon(@objFun,V0,[],[],[],[],[],[],@conFun,options);
12     isValid=minDist<=k;
13     function d=objFun(v) % Inner optimization performed in objective
14         x=v(1:length(xhat)); y=v(length(xhat)+1:end); 
15         eta=@(kappa)(1-sqrt(rmax^2+kappa.^2*(1-rmax^2)^2))/(1-rmax^2); % Declare eta as a lambda function
16         [~,d]=fminbnd(@(kappa)-(Hx*x-Hy*y)'/(1/(eta(kappa)-kappa)*Hx*Cxx*Hx'+1/(eta(kappa)+kappa)*Hy*Cyy*Hy')*(Hx*x-Hy*y),-.5,.5); % Use negative to find max
17         d=-d;
18     end
19     function [c,ceq]=conFun(v) % Set constraint function
20         x=v(1:length(xhat)); y=v(length(xhat)+1:end); 
21         c=[x'/Xellip*x-2*xhat'/Xellip*x+xhat'/Xellip*xhat-1;
22             y'/Yellip*y-2*yhat'/Yellip*y+yhat'/Yellip*yhat-1];
23         ceq=[];
24     end
25 end
 1 % Taken from ellipsoidal toolbox:
 2 % Ellipsoidal Toolbox Copyright
 3 % 
 4 % 
 5 % Copyright (c) 2004-2011 The Regents of the University of California. All rights reserved.
 6 % Permission is hereby granted, without written agreement and without license or royalty
 7 % fees, to use, copy, modify, and distribute this software and its documentation for any
 8 % purpose, provided that the above copyright notice and the following two paragraphs appear
 9 % in all copies of this software.
10 % 
11 % IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
12 % SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND
13 % ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY
14 % OF SUCH DAMAGE.
15 % 
16 % THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
17 % LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18 % THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA
19 % HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
20 
21 function x = ellbndr_2dlocal(E)
22 %
23 % ELLBNDR_2D - compute the boundary of 2D ellipsoid.
24 %
25 
26   global ellOptions;
27 
28   N      = ellOptions.plot2d_grid;
29   phi    = linspace(0, 2*pi, N);
30   l      = [cos(phi); sin(phi)];
31   [r, x] = rho(E, l);
32   x      = [x x(:, 1)];
33 
34   return;
35 end
Download algorithm (3 files) as ZIP

Comments

Please login to post a comment.

#2: LukInsumpCQ LukInsumpCQ on 02/07/2018 6:43 a.m.
Buy Tadalista Online Where To Buy Cialis 20mg In Uk Propecia Sale Official <a href=http://cialicheap.com>buy cialis</a> Levitra Generico Affitto

#1: TerrkapsYD TerrkapsYD on 05/12/2017 11:36 p.m.
Wo Kann Ich Viagra Ohne Rezept Keflex Without A Prescription shipped ups on line isotretinoin 10mg in usa Vaginal Infections And Amoxicillin Levitra Street Value <a href=http://byuvaigranonile.com>viagra</a> Buy Plavix Dental Abcess And Amoxicillin Zithromax Dosage For Dogs