-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f04c98
commit 4477052
Showing
73 changed files
with
12,770 additions
and
1,125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function out = STL_ApplyRec(phi,func,n) | ||
% STL_ApplyRec Recursively apply func to the phi and its subformulas | ||
|
||
if nargin<3 | ||
n=inf; | ||
end | ||
|
||
out = {func(phi)}; | ||
if n>0 | ||
switch (phi.type) | ||
case 'predicate' | ||
return; | ||
|
||
case{'not', 'always', 'eventually', 'historically', 'once'} | ||
out1 = STL_ApplyRec(phi.phi,func,n-1); | ||
out = [out out1] ; | ||
|
||
case {'and', 'or', '=>', 'until'} | ||
out1 = STL_ApplyRec(phi.phi1,func,n-1); | ||
out2 = STL_ApplyRec(phi.phi2,func,n-1); | ||
out = [out out1 out2]; | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
function is_sensitive = STL_Eval_Structural_Sensitivity(Sys, phi, P, traj1, traj2, inout, relabs, taus) | ||
|
||
|
||
%% default parameters | ||
if isfield(phi.params,'default_params') | ||
pnames = fieldnames(phi.params.default_params); | ||
for ip = 1:numel(pnames) | ||
% if P doesn't define the parameter, use default | ||
if FindParam(P,pnames{ip})> size(P.pts,1) | ||
pval = phi.params.default_params.(pnames{ip}); | ||
if isscalar(pval) | ||
P = SetParam(P,pnames{ip},pval ); | ||
else | ||
P.(pnames{ip}) = pval; | ||
end | ||
end | ||
end | ||
end | ||
|
||
partition = []; | ||
if (strcmp(inout, 'in')) | ||
partition = get_in_signal_names(phi); | ||
elseif (strcmp(inout, 'out')) | ||
partition = get_out_signal_names(phi); | ||
end | ||
|
||
[trajs_sensitive, time_values__] = ... | ||
calculate_structural_sensitivity(Sys, phi, P, traj1, traj2, partition, relabs, taus); | ||
|
||
% TODO: Can we ignore time values here? | ||
is_sensitive = any(trajs_sensitive); | ||
|
||
|
||
end |
Oops, something went wrong.