Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdecyphir committed Aug 9, 2018
1 parent 9f1bf01 commit c1fe6cc
Show file tree
Hide file tree
Showing 57 changed files with 6,056 additions and 189 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ wiki/
@STL_Formula/private/recomp.m
Ext/ModelsData
/Examples/docrun_backup.mat
*.mexa64
/Ext/Toolboxes/jsonlab/examples/selftest.*
fileServerFolder
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# Release 1.4.0

## Users
- BreachSet.SetParam gets 'combine' option
- BreachSamplesPlot improvement
- Better support for req_monitors which are not stl_monitors
- Support for requirement parameters sampling at BreachRequirement level
- Updated Automatic transmission example


## Bugfixes
- Sim() recompute without argument now checks if traces are present before
recomputing with default time (was causing weird GetRobustSat behavior)
- log_format deactivated when using diskcaching wo parallel until figuring better solution

## Developpers
- Added jsonlab toolbox


# Release 1.3.3

- Fixed violation signals for alw (A => ev_[] B) types of requirements
Expand Down
28 changes: 12 additions & 16 deletions Core/Algos/@BreachProblem/BreachProblem.m
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,7 @@ function ResetTimeSpent(this)
function SaveInCache(this)
if this.BrSys.UseDiskCaching
FileSave = [this.BrSys.DiskCachingRoot filesep class(this) '_Runs.mat'];
if ~exist(FileSave, 'file')
evalin('base', ['save(''' FileSave ''',''' this.whoamI ''');']);
else
evalin('base', ['save(''' FileSave ''',''-append'',''', this.whoamI ''');']);
end
evalin('base', ['save(''' FileSave ''',''' this.whoamI ''');']);
end
end

Expand Down Expand Up @@ -553,13 +549,14 @@ function SetupParallel(this, varargin)
this.BrSys.SetupParallel(varargin{:});

% Enable DiskCaching
if this.log_traces
this.SetupDiskCaching();
end

% Possible need to change the optinmization optinion
this.setup_solver();
this.SetupDiskCaching();

% Possible need to change the optimization option
% this.setup_solver();
% TODO: review when needed on solver-by-solver basis - maybe
% warning in order ?


end

function StopParallel(this)
Expand All @@ -568,6 +565,7 @@ function StopParallel(this)
end

function SetupDiskCaching(this, varargin)
this.log_traces = 0; % FIXME
this.BrSys.SetupDiskCaching(varargin{:});
end

Expand Down Expand Up @@ -672,7 +670,7 @@ function LogX(this, x, fval)
this.X_log = [this.X_log x];
this.obj_log = [this.obj_log fval];

if (this.log_traces)&&~(this.use_parallel);
if (this.log_traces)&&~(this.use_parallel)&&~(this.BrSet.UseDiskCaching); % FIXME - logging flags and methods need be revised
if isempty(this.BrSet_Logged)
this.BrSet_Logged = this.BrSys.copy();
else
Expand Down Expand Up @@ -744,8 +742,7 @@ function Display_Best_Results(this, best_fval, param_values)
BrOut.ResetSimulations();
BrOut.SetParam(this.params, this.X_log);
BrOut.Sim();
end

end
[BrOut, Berr, BbadU] = this.ExportBrSet(BrOut);

end
Expand All @@ -763,7 +760,7 @@ function Display_Best_Results(this, best_fval, param_values)
end

function summary = SaveResults(this, varargin)
BLog = this.GetBrSet_Logged();
BLog = this.GetLog();
summary = BLog.SaveResults(varargin{:});
end

Expand Down Expand Up @@ -834,7 +831,6 @@ function display_status(this,fval, const_val)
if ~isempty(idx_ok)&&B.hasTraj();
BrOut = this.Spec.copy();
BrOut.ResetSimulations();
BrOut.BrSet = [];
BrOut.Eval(B);
end
end
Expand Down
24 changes: 24 additions & 0 deletions Core/Algos/@BreachProblem/check_monotony.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function monotony = check_monotony(this)
% BreachProblem.check_monotony might evolve eventually into more general sensitivity
% analysis

% check domains for non double -
for id= 1:numel(this.domains)
if ~isequal(this.domains(id).type, 'double')
warning('check_monotony not tested with non double type, such as type %s of variable %s', this.domains(id), this.params{id});
end
end

Sys= CreateSystem({},this.params, this.x0);
P = CreateParamSet(Sys, this.params, [this.lb, this.ub]);

p = 4;
r = 10;
Pr = pRefine(P, p,r);
Y = this.objective(Pr.pts);
[~, ~, ~, ~, EE] = EEffects(Y, Pr.D, p);

monotony = all(EE'>=0)-all(EE'<=0); % 1 if all positive, -1 if all negative, 0 otherwise



1 change: 0 additions & 1 deletion Core/Algos/@BreachProblem/setup_binsearch.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
'verbose', 1);
this.solver_options = solver_opt;
end

1 change: 1 addition & 0 deletions Core/Algos/@BreachProblem/solve_binsearch.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function res = solve_binsearch(this)
% solve_binsearch

Sys = this.BrSys.Sys;
phi = STL_Formula(this.Spec.req_monitors{1}.formula_id);
Expand Down
31 changes: 22 additions & 9 deletions Core/Algos/FalsificationProblem.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
end

methods (Static)
function load_runs(folder, run)
if nargin==1
evalin('base', ['load(''' folder filesep 'FalsificationProblem_Runs'');']);
elseif nargin==2
evalin('base', ['load(''' folder filesep 'FalsificationProblem_Runs'',''' run ''');']);
end
function falsif_pb = load_runs(logFilePath)
st = load([logFilePath, filesep, 'FalsificationProblem_Runs']);
fn= fieldnames(st);
falsif_pb = st.(fn{1});
falsif_pb.SetupDiskCaching('DiskCachingRoot', logFilePath);
end
end

Expand Down Expand Up @@ -98,6 +97,14 @@ function ResetObjective(this)
Xfalse = this.X_false;
end

function SaveInCache(this)
if this.BrSys.UseDiskCaching
FileSave = [this.BrSys.DiskCachingRoot filesep 'FalsificationProblem_Runs.mat'];
evalin('base', ['save(''' FileSave ''',''' this.whoamI ''');']);
end
end


% Logging
function LogX(this, x, fval)
% LogX log variable parameter value tested by optimizers
Expand All @@ -112,7 +119,7 @@ function LogX(this, x, fval)
this.obj_false = [this.obj_false fval];
if (this.log_traces)&&~this.use_parallel
if isempty(this.BrSet_False)
this.BrSet_False = this.BrSys.copy();
this.BrSet_False = this.Spec.BrSet.copy();
else
this.BrSet_False.Concat(this.BrSys);
end
Expand All @@ -125,8 +132,8 @@ function LogX(this, x, fval)
b= b||(this.StopAtFalse&&this.obj_best<0);
end

function [BrFalse, BrFalse_Err, BrFalse_badU] = GetBrSet_False(this)
BrFalse = this.BrSet_False;
function [BrFalse, BrFalse_Err, BrFalse_badU] = GetFalse(this)
BrFalse = this.BrSet_False;
if isempty(BrFalse)
[~, i_false] = find(this.obj_log<0);
if ~isempty(i_false)
Expand All @@ -137,6 +144,12 @@ function LogX(this, x, fval)
end

[BrFalse, BrFalse_Err, BrFalse_badU] = this.ExportBrSet(BrFalse);

end

function [BrFalse, BrFalse_Err, BrFalse_badU] = GetBrSet_False(this)
% Use GetFalse. Keeping this for backward compatibility.
[BrFalse, BrFalse_Err, BrFalse_badU] = this.GetFalse();
end

function DispResultMsg(this)
Expand Down
Loading

0 comments on commit c1fe6cc

Please sign in to comment.