src.DGCG¶
General controller of the DGCG algorithm package.
Module Contents¶
Functions¶
|
Set the the fundamental parameters of the model. |
|
Solve the given dynamic inverse problem for input data. |
-
src.DGCG.set_model_parameters(alpha, beta, time_samples, H_dimensions, test_func, grad_test_func)¶ Set the the fundamental parameters of the model.
- Parameters
- alpha, beta: float
Regularization parameter of the regularization problem, must be positive.
- time_samples: numpy.ndarray
Ordered array of values between 0 and 1, with
time_samples[0] = 0andtime_samples[-1] = 1.- H_dimension: list[int]
List of dimensions of the considered Hilbert spaces
H_t.- test_funccallable[[int, numpy.ndarray], numpy.ndarray]
Function φ that defines the forward measurements. The first input is time, the second input is a list of elements in the domain Ω. It maps into a list of elements in H_t. See Notes for further reference.
- grad_test_funccallable[[int, numpy.ndarray], numpy.ndarray]
The gradient of the input function test_func. The inputs of the gradient are the same of those of the original function. Returns a tuple with each partial derivative.
- Returns
- None
Notes
It is required to set this values prior to defining atoms or taking measurements. This is because the input values fix the set of extremal points of the Benomou-Brenier energy, and the given kernels define the Forward and Backward measurement operators.
The
test_funcφ is the funciton that defines the forward measurements. The first input is a time sample in[0, 1, ..., T-1], withTthe total number of time samples. The second input is a list ofNelements in Ω, expressed as a (N,2)numpy.ndarray(Ω is of dimension 2).The output of φ is a list of
Nelements inH_t, since the dimension ofH_tis input withH_dimensions, then the output of φ(t, x) is a (N, H_dimensions[t])numpy.ndarrayThe function
grad_test_func∇φ has the same input, but the output is a (2, N, H_dimensions[t]) tuple representing the two partial derivatives ∂_x and ∂_y respectively.
-
src.DGCG.solve(data, **kwargs)¶ Solve the given dynamic inverse problem for input data.
This function will apply the Dynamic Generalized Conditional Gradient (DGCG) algorithm.
- Parameters
- datanumpy.ndarray
Array of
Tentries, each a numpy.ndarray of sizeH_dimensions[t]for eacht. See notes for further reference.- initial_measure
src.classes.measure, optional Initial guess for the DGCG algorithm. Default value is None corresponding the the zero measure.
- use_ffmmpegbool, optional
To indicate the use of the ffmpeg library. If set to false, matplotlib won’t be able to save the output videos as videos files. Nonetheless, it is possible to animate the measures with the DGCG.classes.measure.animate method.
- insertion_max_restartsint, optional
Hard limit on the number of allowed restarts for the multistart gradient descent at each iteration. Default 1000.
- insertion_min_restartsint, optional
Hard limit on the number of allowed restarts for the multistart gradient descent at each iteration. Default 20.
- results_folderstr, optional
name of the folder that will be created to save the simulation results. Default ‘results’.
- multistart_early_stopcallable[[int,int], int] optional
function to stop early as a function of the found stationary points. Default lambda n,m: np.inf.
- multistart_pooling_numint, optional
When insertion random curves, the algorithm will realize this given number of curves and then choose the one with best F(γ) value. The higher the value of this parameter, the more one samples on the best initial curves to descent. The drawback is that it slows down the proposition of random curves.
- log_outputbool, optional
Save the output of shell into a .txt inside the results folder. default False, to be improved. <+TODO+>
- Returns
- solution
src.classes.measure The computed solution.
- exit_flagtuple[int, str]
Tuple with a numeric indicator and a string with a brief description. <+TODO+> check this, add dual_gap exit value.
- solution
Notes
The
datainput corresponds to the gathered data with the defined forward operator when runningsrc.DGCG.set_model_parameters(). Each entry of this array correspond to the measurement at each time sample. Therefore, the size of that entry will correspond to the respectiveH_tspace.