Skip to content

Commit

Permalink
1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdecyphir committed Jan 25, 2022
1 parent 1f04c98 commit 4477052
Show file tree
Hide file tree
Showing 73 changed files with 12,770 additions and 1,125 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Examples/*.dat
Examples/variablescmaes.mat

slprj/
Doc/

# Ignore everything in Ext...
Ext/*
Expand Down Expand Up @@ -41,3 +40,4 @@ docrun_backup.mat
*.r2015a
*_ert_rtw
*.7z
*.slxc
23 changes: 23 additions & 0 deletions @STL_Formula/STL_ApplyRec.m
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
34 changes: 34 additions & 0 deletions @STL_Formula/STL_Eval_Structural_Sensitivity.m
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
Loading

0 comments on commit 4477052

Please sign in to comment.