Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regularization error in ReachContinuous #45

Open
yzh89 opened this issue Dec 8, 2015 · 6 comments
Open

Regularization error in ReachContinuous #45

yzh89 opened this issue Dec 8, 2015 · 6 comments
Assignees
Labels

Comments

@yzh89
Copy link

yzh89 commented Dec 8, 2015

I have been trying reachablility set computation for some aircraft dynamics. I kept on getting strange errors in the regularization process. The code is attached test.txt

The errors when runing "rsObj_A = elltool.reach.ReachContinuous(lsys, x0EllObj, dirsMat, timeVec, 'isRegEnabled', true, 'isJustCheck', false, 'regTol', 1e-7);" are the following.

"
Error using modgen.common.checkvar (line 69)
matrix must be symmetric.

Error in gras.la.regposdefmat (line 20)
modgen.common.checkvar(inpMat, 'gras.la.ismatsymm(x)',...

Error in gras.mat.MatrixPosReg>@(x)gras.la.regposdefmat(x,self.regTol) (line 28)
@(x) gras.la.regposdefmat(x, self.regTol), resArray,...

Error in gras.gen.MatVector.evalMFunc (line 68)
resArray(:,:,iElem)=fHandle(dataArray(:,:,iElem));

Error in gras.mat.MatrixPosReg/evaluate (line 27)
resArray = gras.gen.SquareMatVector.evalMFunc(...

Error in gras.ellapx.lreachplain.ExtEllApxBuilder/calcEllApxMatrixDeriv (line 12)
BPBTransMat=BPBTransDynamics.evaluate(t);

Error in
gras.ellapx.lreachplain.ExtEllApxBuilder/getEllApxMatrixDerivFunc/@(t,y)calcEllApxMatrixDeriv(self,self.getProblemDef().getAtDynamics,self.getProblemDef.getBPBTransDynamics,self.getGoodDirSet.getRGoodDirOneCurveSpline(iGoodDir),t,y)

Error in gras.ode.MatrixODESolver>@(t,y)(reshape(fDerivFunc(t,reshape(y,reshapeSizeVec)),[],1)) (line 30)
fMatrixDerivFunc=@(t, y)(reshape(fDerivFunc(t, ...

Error in odearguments (line 87)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ode45 (line 113)
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in gras.ode.MatrixODESolver/solve (line 32)
[timeVec, xResMat] = ...

Error in gras.ellapx.lreachplain.ATightEllApxBuilder/build (line 54)
[~,data_Q_star]=solverObj.solve(fHandle,...

Error in gras.ellapx.lreachplain.ATightEllApxBuilder/getEllTubes (line 110)
self.build();

Error in gras.ellapx.gen.EllApxCollectionBuilder/getEllTubes (line 43)
ellTubeTempRel=self.builderList{iBuilder}.getEllTubes();

Error in elltool.reach.ReachContinuous/auxMakeEllTubeRel (line 136)
extEllTubeRel = extellTubeBuilder.getEllTubes();

Error in elltool.reach.ReachContinuous/internalMakeEllTubeRel (line 168)
[ellTubeRel,goodDirSetObj] = self.auxMakeEllTubeRel(...

Error in elltool.reach.AReach/makeEllTubeRel (line 657)
[ellTubeRel, goodDirSetObj] = self.internalMakeEllTubeRel(...

Error in elltool.reach.AReach (line 767)
[self.ellTubeRel,goodDirSetObj,probDynObj] =...

Error in elltool.reach.ReachContinuous (line 298)
self=[email protected](varargin{:});

Software Version:
ET Version 2.1
CVX and MPT is the ones included in the toolbox
MATLAB Version: 8.5.0.197613 (R2015a)
Operating System: Microsoft Windows 7 Enterprise Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Version 8.5 (R2015a)
Simulink Version 8.5 (R2015a)
Bioinformatics Toolbox Version 4.5.1 (R2015a)
Communications System Toolbox Version 6.0 (R2015a)
Computer Vision System Toolbox Version 6.2 (R2015a)
Control System Toolbox Version 9.9 (R2015a)
Curve Fitting Toolbox Version 3.5.1 (R2015a)
DSP System Toolbox Version 9.0 (R2015a)
Data Acquisition Toolbox Version 3.7 (R2015a)
Database Toolbox Version 5.2.1 (R2015a)
Datafeed Toolbox Version 5.1 (R2015a)
Fixed-Point Designer Version 5.0 (R2015a)
Fuzzy Logic Toolbox Version 2.2.21 (R2015a)
Global Optimization Toolbox Version 3.3.1 (R2015a)
Image Acquisition Toolbox Version 4.9 (R2015a)
Image Processing Toolbox Version 9.2 (R2015a)
Instrument Control Toolbox Version 3.7 (R2015a)
MATLAB Coder Version 2.8 (R2015a)
MATLAB Compiler Version 6.0 (R2015a)
MATLAB Compiler SDK Version 6.0 (R2015a)
MATLAB Report Generator Version 4.1 (R2015a)
Mapping Toolbox Version 4.1 (R2015a)
Model Predictive Control Toolbox Version 5.0.1 (R2015a)
Multi-Parametric Toolbox Version 3.1 (R2011a)
Neural Network Toolbox Version 8.3 (R2015a)
OPC Toolbox Version 3.3.3 (R2015a)
Optimization Toolbox Version 7.2 (R2015a)
Parallel Computing Toolbox Version 6.6 (R2015a)
Partial Differential Equation Toolbox Version 2.0 (R2015a)
Robust Control Toolbox Version 5.3 (R2015a)
Signal Processing Toolbox Version 7.0 (R2015a)
SimEvents Version 4.4 (R2015a)
SimMechanics Version 4.6 (R2015a)
Simscape Version 3.13 (R2015a)
Simulink 3D Animation Version 7.3 (R2015a)
Simulink Coder Version 8.8 (R2015a)
Simulink Control Design Version 4.2 (R2015a)
Simulink Design Optimization Version 2.7 (R2015a)
Spreadsheet Link EX Version 3.2.3 (R2015a)
Stateflow Version 8.5 (R2015a)
Statistics and Machine Learning Toolbox Version 10.0 (R2015a)
Symbolic Math Toolbox Version 6.2 (R2015a)
System Identification Toolbox Version 9.2 (R2015a)
Wavelet Toolbox Version 4.14.1 (R2015a)

@pgagarinov pgagarinov added the bug label Dec 8, 2015
@pgagarinov pgagarinov self-assigned this Dec 8, 2015
@pgagarinov pgagarinov added this to the Autumn-Winter 2015 milestone Dec 8, 2015
@pgagarinov pgagarinov changed the title Regularization error Regularization error in ReachContinuous Dec 8, 2015
pgagarinov pushed a commit that referenced this issue Dec 9, 2015
BugFix: the first part of the fix
pgagarinov pushed a commit that referenced this issue Dec 12, 2015
BugFix: fixed a misprint in the previous commit
pgagarinov pushed a commit that referenced this issue Dec 13, 2015
BugFix: next portion of fixes
pgagarinov pushed a commit that referenced this issue Dec 14, 2015
BugFix: the first part of the fix
pgagarinov pushed a commit that referenced this issue Dec 14, 2015
BugFix: fixed a misprint in the previous commit
pgagarinov pushed a commit that referenced this issue Dec 14, 2015
BugFix: next portion of fixes
pgagarinov pushed a commit that referenced this issue Dec 14, 2015
Enhancement: split calcPrecision into absTol and relTol: part1
pgagarinov pushed a commit that referenced this issue Dec 14, 2015
Enhancement: a test problem by Yuchen Zhou is added to the regression test pack.
Test problem itself is now calculated if a) regTol is increased up to 1e-5 b) directions [1 0 0 0 0 0 0] and [0 0 1 0 0 0 0 0] are removed from the list of good directions (dirsMat). Looks like the structure
of A is such that l(t) degrades for these initial directions. There still a minor difference between this test and a real problem which will be eliminated in the next commit. Also we still need to add a few unit tests.
Once all this is done the branch will be merged into master
pgagarinov pushed a commit that referenced this issue Dec 15, 2015
BugFix: eliminated references to removed calcPrecision parameter
pgagarinov pushed a commit that referenced this issue Dec 15, 2015
Enhancement: calcPrecision is replaced with absTol and relTol in a few moretests
pgagarinov pushed a commit that referenced this issue Dec 15, 2015
Enhancement: slightly refactored ellipsoid tube construction (not finished) yet
pgagarinov pushed a commit that referenced this issue Dec 16, 2015
Enhancement: fixed and updated documentation for ellipsoidal tube classes
pgagarinov pushed a commit that referenced this issue Dec 20, 2015
BugFix: recached regression test results
pgagarinov pushed a commit that referenced this issue Dec 21, 2015
BugFix: calcPrecision is completely replaced with absTol and relTol in SuiteSupportFunction.m test case
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: calcPrecision is split into absTol and relTol for mixed ellipsoidal tube tests
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: the first part of the fix
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: fixed a misprint in the previous commit
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: next portion of fixes
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
Enhancement: split calcPrecision into absTol and relTol: part1
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
Enhancement: a test problem by Yuchen Zhou is added to the regression test pack.
Test problem itself is now calculated if a) regTol is increased up to 1e-5 b) directions [1 0 0 0 0 0 0] and [0 0 1 0 0 0 0 0] are removed from the list of good directions (dirsMat). Looks like the structure
of A is such that l(t) degrades for these initial directions. There still a minor difference between this test and a real problem which will be eliminated in the next commit. Also we still need to add a few unit tests.
Once all this is done the branch will be merged into master
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: eliminated references to removed calcPrecision parameter
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
Enhancement: calcPrecision is replaced with absTol and relTol in a few moretests
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
Enhancement: slightly refactored ellipsoid tube construction (not finished) yet
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
Enhancement: fixed and updated documentation for ellipsoidal tube classes
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: recached regression test results
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: calcPrecision is completely replaced with absTol and relTol in SuiteSupportFunction.m test case
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
BugFix: calcPrecision is split into absTol and relTol for mixed ellipsoidal tube tests
pgagarinov pushed a commit that referenced this issue Dec 22, 2015
Enhancement: temporary disable regression tests for yuchenZhouProb1 configuration
@yzh89
Copy link
Author

yzh89 commented Dec 23, 2015

Looks like commit 55b4c1e is already good to test my setup. Thanks for fixing it so fast.

Happy Holidays,
Yuchen

pgagarinov pushed a commit that referenced this issue Dec 23, 2015
Enhancement: implemented a new test for l(t) degradation check
Enhancement: fixed description of fields for all EllTube-like classes. Also fixed description for some of EllTube (and alike) methods.
Enhancement: EllTube.fromEllArray method now accepts cell vectors of ellipsoid vectors and can construct multiple ellipsoidal tubes, not just one
BugFix: calcPrecision is split into absTol and relTol in all the classes for ellipsoidal approximation and tests for them
Enhancement: a test problem yuchenZhouProb1.xml by Yuchen Zhou is added to the regression test pack.
Test problem itself is now calculated if a) regTol is increased up to 1e-5 b) directions [1 0 0 0 0 0 0] and [0 0 1 0 0 0 0 0] are removed from the list of good directions (dirsMat). Looks like the structure
of A is such that l(t) degrades for these initial directions. There still a minor difference between this test and a real problem which will be eliminated in the nearest future. For now regression and support function-comparision tests for yuchenZhouProb1 do not pass (because of the mentioned difference in behavior) and temporarily switched off.
Enhancement: a few cosmetic changes along the way
pgagarinov pushed a commit that referenced this issue Dec 24, 2015
Enhancement: one more test to fix functionality of EllTube
pgagarinov pushed a commit that referenced this issue Dec 29, 2015
Enhancement: enabled failing configurations
@yzh89
Copy link
Author

yzh89 commented Jan 11, 2016

Looks like still having issue on the precision. I used the latest commit on master to test. The problem itself is modified according to a154e3b

Error is following.

check [any touch line is always within any external approx] has failed for xTouchCurveMat, expected precision=2.000000e-05, actual
precision=3.013283e-05

@pgagarinov
Copy link
Member

This might be caused by using a different CPU. This happened before when some tests pass on older CPUs and fail on newer CPUs because of different CPU instructions being used.
On my is Core i7 5820k the attached example (test zip) works.
test.zip

However even on my CPU the same example integrated into the test coverage fails in the branch
i.e.

gras.ellapx.uncertcalc.test.regr.run_comp_tests('filter',{'yuchenZhouProb1','.','.'})

produced the same error as you reported. I plan to figure out why this happens and fix this within a few next weeks when I have time.

Meanwhile I suggest you use a simple workaround by replacing throwerror with throwwarn on line 445
(it might be different in your case but this is the one that throws the reported exception). And do not forget to replace import modgen.common.throwerror; with import modgen.common.throwwarn; It is probably a good idea to run the solver in a relaxed self-checking mode when only warnings are thrown and a user becomes responsible for the quality of calculation results. Anyway, just keep an eye on what throwwarn prints out to make sure that the precision is within an acceptable range every time you run the solver because those checks are there for a reason. Based on what I see 3.013283e-05 is good enough but the solver is very conservative which is a good idea for a production use I believe.

And of course you can participate in improving the solver or finding the bugs by figuring our why gras.ellapx.uncertcalc.test.regr.run_comp_tests('filter',{'yuchenZhouProb1','.','.'}) fails on your own if you do not want to wait for my fix and replacing exceptions with warnings doesn't work for you for some reason.

@pgagarinov
Copy link
Member

Were you able to calculate the dynamics by replacing throwerror with throwwarn?

Also, can you please, if possible, provide more details about the problem that leads to this specific linear control system? Maybe you have some paper? Right now I can use any interesting example of real problem that can be solved with help of the toolbox, especially for enhancing a list of demo examples. Thanks.

@yzh89
Copy link
Author

yzh89 commented Jan 18, 2016

Yes I am able to calculate the dynamics. There are still some precision issue so I am using another more stable dynamics instead. The linearization comes from http://uavbook.byu.edu/doku.php?id=lecture lecture 5. It includes a linearized model of the lateral motion of a fix-wing aircraft. The main issue is that the external approximation sometimes becomes way too far from the theoretically support function boundary derived from Prof. AB Kurzhanskiy's book.

For a good example of using the toolbox, you can refer to the paper I published in CDC 2015 using this toolbox. It is in the archive http://arxiv.org/abs/1512.01195. I was using a linearized quadrotor dynamics.

@pgagarinov
Copy link
Member

So do you do your research at Cornell University? If - can you please tell me a name of the department just for the record. I hope I could compile a list of places where the toolbox is used to increase its popularity. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants