2 % Parameter sampling
class with uniformly distributed parameters in the
5 properties (SetAccess =
private, Dependent)
11 %
boolean value determining whether a logarithmic
function shall be
12 % applied on the uniform distribution of the parameter samples.
13 log_distribution =
false;
15 % vector or scalar determining how many equally distant vectors shall be
16 % added to the parameter sample in each direction.
18 % If it is a vector,
for each direction of the parameter space a different
19 % number can be given.
20 init_numintervals = 2;
23 properties (Access =
public)
29 function ups =
Uniform(init_numintervals, log_distribution)
30 %
function ups =
Uniform(init_numintervals, log_distribution)
34 % init_numintervals: vector or scalar determining how many equally
35 % distant vectors shall be added to the parameter
36 % sample in each direction.
37 % log_distribution:
boolean indicator determining whether a
38 % logarithmic
function shall be applied on the
39 % uniform distribution of the parameter samples.
44 ups.log_distribution = log_distribution;
48 function init_sample(
this, dmodel)
49 %
function init_sample(
this, dmodel)
55 if this.log_distribution
56 params.range = cellfun(@log, dmodel.mu_ranges, 'UniformOutput', false);
58 params.range = dmodel.mu_ranges;
60 if isscalar(this.init_numintervals)
61 params.numintervals = ones(1,length(params.range)) * this.init_numintervals;
63 params.numintervals = this.init_numintervals;
68 this.init_done = true;
71 function M = get.sample(this)
73 M = get(this.pgrid, 'vertex');
74 if this.log_distribution
82 function levels = get_refinement_levels(this)
83 % function levels = get_refinement_levels(this)
87 levels = get(this.pgrid, 'level');
90 function size = size(this)
91 % function size = size(this)
95 size = get(this.pgrid, 'nleafelements');
98 function this = refine(this, elems)
99 % function this = refine(this, elems)
104 elems = 1:length(this.pgrid.get_leafgids);
106 this.refined_elements = [this.refined_elements, {elems}];
107 this.sample_history = [this.sample_history, this.sample];
108 refine(this.pgrid, elems);
111 function cogs = cogs(
this)
112 %
function cogs = cogs(
this)
116 cogs = get(this.pgrid, 'leafcogs');
119 function skips = skipped_refinements(this)
120 % function skips = skipped_refinements(this)
124 li = get_leafgids(this.pgrid);
125 skips = this.pgrid.refine_steps - this.pgrid.creation_step(li);
128 function max_vertex = elementwise_maximum_of_vertex_values(this, values)
129 % function max_vertex = elementwise_maximum_of_vertex_values(this, values)
133 li = get_leafgids(this.pgrid);
134 lv = this.pgrid.vertexindex(li,:);
136 value_vertex = reshape(values(lv(:)), size(lv));
137 max_vertex = max(value_vertex, [], 2);
A hierarchical cubegrid of arbitrary dimension.
virtual function cogs = cogs()
returns the center of gravity of sample cells (in case the sample can be viewed as a grid) ...
virtual function init_sample(IDetailedModel dmodel)
initializes the parameter sampling object
Interface class for parameter sample classes that allow the adaptive refinement of the sampling...
Interface for parameter sampling classes producing discrete parameter sample in the parameter space ...
sample
matrix storing the parameter vectors in the parameter samples as row vectors.