Skip to content

Commit 674cf93

Browse files
committed
CORA v2025.2.0
- ci: better handling of failed jobs and retries, now warns if the duration of a test changed drastically - conZonotope/representsa: check for 'emptySet' makes use of polytope/representsa now - converter/cora2spaceex: bug fix, reset assignments - examples/ARCH'25 revisions - global/CORAROOT: major speedup - global/CORAerror: made help text clickable for convenience - global/CORAlinprog: improved stability - global/CORAtable: added 'rownr' and 'time' format, added 'csv' design - global/checkValueAttributes: bug fix, gpuArrays - global/codingConvention: enforced timerVal in tic-toc - global/printCell: bug fixes - global/printMatrix: bug fixes - global/updateCORApath: should be faster now; no longer includes the repeatability template - global/verbose: sets, systems, matrices, tables, etc. can now be printed directly into a file - linearSys/Krylov: refactor, speed up, and improved testing - linearSys/sparse|full: added - matZonotope/contains: added - matZonotope/randPoint: bug fix - models: moved distributed model files into ./model folder - neuralNetwork/calcSensitivity: fixed bug with incorrect size - neuralNetwork/computeReducedNetwork: added, computes a reduced network with nice verification guarantees - neuralNetwork/explain: added, computes provably sufficient explanations - nn: added ability to verify graph neural networks - nnActivationLayer: bug fix, large domains - polygon/minkDiff: bug fix, reset vertices property - polytope/project: bug fix, empty polytope did not return the correct polytope - polytope/representa: emptySet, bug fix - polytope/zonotope: added method 'inner' - reachSet/hasTimeInterval: added - reachSet/plot: bug fix, no time interval - repeatability package: updates for clarity - simResult/add: bug fix - simResult/isemptyobject: bug fix - specification/check: improved check of reachSet/simResult for timed specifications - zonoBundle/generateRandom: bug fix - zonotope/compact: bug fix, outputs are now consistent for 'all' - zonotope/contains: speed up, if the zonotope represents an interval; bug fix, tolerances - zonotope/reduce: added two methods based scaling - zonotope/sparse|full: added - zonotope/zonotopeNorm: bug fix, minimizer was not returned properly
1 parent 33a0e98 commit 674cf93

File tree

485 files changed

+12388
-4870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

485 files changed

+12388
-4870
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Issue Template
3+
about: General questions, bug reports, and feature requests
4+
title: ''
5+
labels: ''
6+
assignees: TUMcps
7+
8+
---
9+
10+
## Description
11+
12+
*Briefly describe the issue*
13+
14+
## Steps to Reproduce the Issue
15+
16+
*Ideally provide code of a minimal example. E.g.*
17+
```
18+
% 1. init two zonotopes
19+
Z1 = zonotope([1;2], [1 0 1; 0 1 1]);
20+
Z2 = zonotope([5;4], [1 0 -1; 0 1 1]);
21+
22+
% 2. plot the zonotopes
23+
figure;
24+
plot(Z1);
25+
plot(Z2);
26+
```
27+
28+
### Expected Behavior
29+
30+
*both zonotopes are visible in the figure*
31+
32+
### Current Behavior
33+
34+
*only the last zonotope is visible*
35+
36+
## Versions
37+
38+
- CORA version: *v2025.0.0* (type `CORAVERSION` in command window)
39+
- Matlab version: *R2024b* (type `version` in command window)
40+
- OS: *Linux/Windows/Mac*

.github/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# GitHub
2+
3+
This folder contains all files related to our GitHub repository: https://github.com/TUMcps/CORA
4+
5+
<hr style="height: 1px;">
6+
7+
<img src="../app/images/coraLogo_readme.svg"/>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Create Release on Tag Push
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
create_release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v3
14+
15+
- name: Get Commit Message
16+
id: get_commit_message
17+
run: |
18+
COMMIT_MESSAGE=$(git log -1 --pretty=format:%s ${{ github.ref }})
19+
echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_ENV
20+
21+
- name: Create GitHub Release
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
run: |
25+
gh release create "${{ github.ref_name }}" \
26+
--title "${{ github.ref_name }}" \
27+
--notes "${{ env.commit_message }}"

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ A Tool for COntinuous Reachability Analysis.
1010

1111
<hr style="height: 1px;">
1212

13-
The COntinuous Reachability Analyzer (CORA) is a collection of MATLAB classes for the formal verification of cyber-physical systems using reachability analysis.
14-
CORA integrates various vector and matrix set representations and operations on them as well as reachability algorithms of various dynamic system classes.
15-
The software is designed such that set representations can be exchanged without having to modify the code for reachability analysis.
16-
CORA is designed using the object oriented paradigm, such that users can safely use methods without concerning themselves with detailed information hidden inside the object.
17-
Since the toolbox is written in MATLAB, the installation and use is platform independent.
18-
From Release 2018 on, the direct import of SpaceEx models into CORA is also supported.
19-
The following points summarize the main features of the CORA toolbox:
20-
13+
The Continuous Reachability Analyzer (CORA) is a MATLAB-based toolbox designed for the formal verification of cyber-physical systems through reachability analysis.
14+
It offers a comprehensive suite of tools for modeling and analyzing various system dynamics, including linear, nonlinear, and hybrid systems.
15+
CORA supports both continuous and discrete-time systems, accommodating uncertainties in system inputs and parameters.
16+
These uncertainties are captured by a diverse range of set representations such as intervals, zonotopes, Taylor models, and polytopes.
17+
Additionally, CORA provides functionalities for the formal verification of neural networks as well as data-driven system identification with reachset conformance.
18+
Various converters are implemented to easily model a system in CORA such as the well-established SpaceEx format for dynamic systems and ONNX format for neural networks.
19+
CORA ensures the seamless integration of different reachability algorithms without code modifications and aims for a user-friendly experience through automatic parameter tuning,
20+
making it a versatile tool for researchers and engineers in the field of cyber-physical systems.
2121

2222
### Reachability Analysis for Continuous Systems
2323

@@ -50,8 +50,19 @@ Additionally, one can train verifiably robust neural networks in CORA.
5050

5151
Please check Section 1.3 in the <a target='_blank' href="https://cora.in.tum.de/manual">CORA manual</a>.
5252

53-
Furthermore, if you clone CORA using git, please also i) install <a href="https://git-lfs.com/" target="_blank">git lfs</a> (large file storage) and ii) run the command `git lfs pull` to ensure all data files are downloaded correctly.
53+
The installation of all required toolboxes can be checked individually by running `test_requiredToolboxes` in MATLAB.
54+
To check whether the core functionality of CORA has been set up correctly,
55+
run the standard test suite `runTestSuite` which should take about 10 minutes.
56+
57+
Furthermore, if you clone CORA using git, please also
58+
i) install <a href="https://git-lfs.com/" target="_blank">git lfs</a> (large file storage)
59+
sand ii) run the `git lfs pull` in the command line to ensure all data files are downloaded correctly.
60+
Then, iii) you can check the correct download of the data files in MATLAB using `test_gitlfs`.
5461

62+
**Repeatability package:**
63+
We also provide a template for a repeatability package to run CORA within Docker in one click.
64+
This can also be used to use CORA without installing Matlab directly on your device.
65+
Please visit `./unitTests/ci/repeatability-template` for details.
5566

5667
### Folder Structure
5768

app/examples/linear_reach.mat

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/examples/nonlinear_reach.mat

Lines changed: 0 additions & 3 deletions
This file was deleted.

contDynamics/@contDynamics/printSystem.m

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
function printSystem(sys,varargin)
1+
function res = printSystem(varargin)
22
% printSystem - prints a contDynamic object such that if one executes this command
33
% in the workspace, this contDynamic object would be created
44
%
55
% Syntax:
66
% printSystem(sys)
7-
% printSystem(sys,'high')
7+
% printSystem(sys,accuracy,doCompact,clearLine)
8+
% printSystem(fid,sys,varargin)
9+
% printSystem(filename,sys,varargin)
810
%
911
% Inputs:
10-
% sys - contDynamic
11-
% accuracy - (optional) floating-point precision
12-
% doCompact - (optional) whether to compactly print the set
13-
% clearLine - (optional) whether to finish with '\n'
12+
% sys - contDynamics
13+
% accuracy - floating-point precision
14+
% doCompact - whether to compactly print the set
15+
% clearLine - whether to finish with '\n'
16+
% filename - char, filename to print given obj to
17+
% fid - char, fid to print given obj to
1418
%
1519
% Outputs:
16-
% -
20+
% res - logical
1721
%
1822
% Other m-files required: none
1923
% Subfunctions: none
@@ -23,78 +27,74 @@ function printSystem(sys,varargin)
2327

2428
% Authors: Tobias Ladner
2529
% Written: 10-October-2024
26-
% Last update: ---
30+
% Last update: 20-May-2025 (TL, added option for fid)
2731
% Last revision: ---
2832

2933
% ------------------------------ BEGIN CODE -------------------------------
3034

31-
narginchk(0,4);
32-
[accuracy,doCompact,clearLine] = setDefaultValues({'%4.3f',false,true},varargin);
33-
if ischar(accuracy) && strcmp(accuracy,'high')
34-
accuracy = '%16.16f';
35-
end
36-
inputArgsCheck({ ...
37-
{sys,'att',{'contDynamics'}}, ...
38-
{accuracy,'att', {'char','string'}}, ...
39-
{doCompact,'att','logical'}, ...
40-
{clearLine,'att','logical'}
41-
})
35+
% parse input
36+
[fid,closefid,sys,accuracy,doCompact,clearLine] = initPrint(varargin{:});
4237

4338
% get print info
4439
[propertyOrder] = getPrintSystemInfo(sys);
4540

4641
if doCompact
4742
% print in one line
48-
fprintf('%s(',class(sys))
43+
fprintf(fid,'%s(',class(sys));
4944
for p = 1:numel(propertyOrder)
5045
pname = propertyOrder{p};
51-
aux_printProperty(sys.(pname),accuracy);
46+
aux_printProperty(fid,sys.(pname),accuracy);
5247
if p < numel(propertyOrder)
53-
fprintf(', ')
48+
fprintf(fid,', ');
5449
end
5550
end
56-
fprintf(')')
51+
fprintf(fid,')');
5752

5853
else
5954
% print each property as variable
6055
for p = 1:numel(propertyOrder)
6156
pname = propertyOrder{p};
62-
fprintf('%s = ',pname);
63-
aux_printProperty(sys.(pname),accuracy);
64-
fprintf(';\n');
57+
fprintf(fid,'%s = ',pname);
58+
aux_printProperty(fid,sys.(pname),accuracy);
59+
fprintf(fid,';\n');
6560
end
6661
% init set
67-
fprintf('sys = %s(%s);',class(sys),strjoin(propertyOrder,','));
62+
fprintf(fid,'sys = %s(%s);',class(sys),strjoin(propertyOrder,','));
6863
end
6964

7065
if clearLine
71-
fprintf('\n');
66+
fprintf(fid,'\n');
7267
end
7368

69+
% finalize
70+
res = closePrint(fid,closefid);
71+
7472
end
7573

7674

7775
% Auxiliary functions -----------------------------------------------------
7876

79-
function aux_printProperty(property,accuracy)
77+
function aux_printProperty(fid,property,accuracy)
78+
% Matlab objects ---
8079
if ischar(property) || isstring(property)
81-
fprintf("'%s'",property);
80+
fprintf(fid,"'%s'",property);
8281
elseif isnumeric(property)
83-
printMatrix(property,accuracy,true,false);
82+
printMatrix(fid,property,accuracy,true,false);
8483
elseif iscell(property)
85-
printCell(property,accuracy,true,false);
84+
printCell(fid,property,accuracy,true,false);
8685
elseif isstruct(property)
87-
printStruct(property,accuracy,true,false);
88-
elseif isa(property,'contSet') || isa(property,'matrixSet')
89-
printSet(property,accuracy,true,false)
90-
elseif isa(property,'contDynamics')
91-
printSystem(property,accuracy,true,false)
86+
printStruct(fid,property,accuracy,true,false);
9287
elseif isa(property,'function_handle')
9388
funcstr = func2str(property);
9489
if ~startsWith(funcstr,'@')
9590
funcstr = sprintf('@%s',funcstr);
9691
end
97-
fprintf(funcstr)
92+
fprintf(fid,funcstr);
93+
% CORA objects ---
94+
elseif isa(property,'contSet') || isa(property,'matrixSet')
95+
printSet(fid,property,accuracy,true,false);
96+
elseif isa(property,'contDynamics')
97+
printSystem(fid,property,accuracy,true,false);
9898
else
9999
throw(CORAerror("CORA:noops",property))
100100
end

contDynamics/@contDynamics/private/priv_abstrerr_lin.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@
8989
H_ = max(infimum(H_),supremum(H_));
9090
errorLagr(i) = 0.5 * dz' * H_ * dz;
9191
end
92+
93+
% check if Lagrange remainder is too large
94+
if any(isnan(errorLagr)) || any(isinf(errorLagr))
95+
throw(CORAerror('CORA:reachSetExplosion','Lagrange remainder exploded.'))
96+
end
9297

9398
trueError = errorLagr;
94-
VerrorDyn = zonotope(0*trueError,diag(trueError));
99+
VerrorDyn = zonotope(zeros(size(trueError)),diag(trueError));
95100

96101
else
97102
% no interval arithmetic (?)

contDynamics/@contDynamics/private/priv_conform_black.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@
8484
if options.approx.verbose
8585
fprintf('Output dimension %d. \n', i_y)
8686
end
87-
tic
87+
timerVal = tic;
8888
gp = rungp(@(x) config_gp(x, params, options, 'blackGP'));
89-
T = toc;
89+
T = toc(timerVal);
9090
if options.approx.save_res
9191
save(file_approx_iy,"gp", "T");
9292
end
@@ -106,7 +106,7 @@
106106
options.approx.yval = yval;
107107
options.approx.ytrain = ytrain;
108108
options.approx.pop_pre = true;
109-
tic
109+
timerVal = tic;
110110
% create initial propulation with normal genetic programming
111111
del_res = false;
112112
if ~isfield(options.approx, 'cgp_file_pop_pre') && ...
@@ -125,7 +125,7 @@
125125

126126
params.testSuite = params.testSuite_val;
127127
gp = rungp(@(x)config_gp(x, params, options, 'blackCGP'));
128-
T = toc;
128+
T = toc(timerVal);
129129
if options.approx.save_res
130130
save(options.approx.filename,"gp", "T");
131131
end

contDynamics/@linearSys/full.m

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
function linsys_full = full(linsys)
2+
% full - Converts system matrices/vectors to full representation
3+
%
4+
% Syntax:
5+
% linsys_full = full(linsys)
6+
%
7+
% Inputs:
8+
% linsys - linearSys object
9+
%
10+
% Outputs:
11+
% linsys_full - linearSys object with full system matrices/vectors
12+
%
13+
% Example:
14+
% A = rand(10,10);
15+
% A(A < 0.8) = 0;
16+
% B = rand(10,10);
17+
% B(B < 0.8) = 0;
18+
% sys = linearSys(sparse(A),sparse(B));
19+
% sys_full = full(sys);
20+
% disp(sys);
21+
% disp(sys_full);
22+
%
23+
% Other m-files required: none
24+
% Subfunctions: none
25+
% MAT-files required: none
26+
%
27+
% See also: none
28+
29+
% Authors: Maximilian Perschl
30+
% Written: 02-June-2025
31+
% Last update: ---
32+
% Last revision: ---
33+
34+
% ------------------------------ BEGIN CODE -------------------------------
35+
36+
A = full(linsys.A);
37+
B = full(linsys.B);
38+
c = full(linsys.c);
39+
C = full(linsys.C);
40+
D = full(linsys.D);
41+
k = full(linsys.k);
42+
E = full(linsys.E);
43+
F = full(linsys.F);
44+
45+
linsys_full = linearSys(linsys.name,A,B,c,C,D,k,E,F);
46+
47+
end
48+
49+
% ------------------------------ END OF CODE ------------------------------

0 commit comments

Comments
 (0)