72
72
declare that there are no available crossovers and then will propose a
73
73
random curve for descent.
74
74
crossover_child_F_threshold : numpy.float, default 0.8
75
-
76
-
77
-
78
-
79
-
80
- Extensive description of each parameter of this module
81
-
75
+ Obtained crossover curves will be proposed for descensen only if their
76
+ energy F(γ) is close to the best known stationary curve. How close it has
77
+ to be is modulated by this parameter, it must satisfy
78
+ F(crossover_child) < crossover_child_F_threshold * F(best_curve),
79
+ remember that the energies are negative.
80
+ crossover_max_distance: numpy.float, default 0.05
81
+ Childs from two curves can be obtained only if at some point in time they
82
+ get close one to another, this parameter indicates how close they need to
83
+ get in H^1 norm for a crossover to happen.
84
+ insertion_eps : numpy.float, defaylt 1e-10
85
+ This is the tolenrance value to stop the algorithm. If the dual gap drops
86
+ below it, the algorithm exits.
87
+ insertion_max_restarts : int, default 20
88
+ The maximum number of restarts of the multistart algorithm.
89
+ insertion_min_restarts : int, default 15
90
+ The minimum number of restarts of the multistart algorithm. This
91
+ parameter is useful only in the case an early stop criteria is set
92
+ via the `multistart_early_stop` parameter.
93
+ multistart_inter_iteration_checkup : int, default 50
94
+ While descending a single curve during the multistart gradient descent,
95
+ the code will routinely check if curve being descended is close to the any
96
+ element of the stationary point set. If so, the descense is stopped
97
+ and the curve is discarded. This parameter regulates how often this
98
+ check is done. Precaution: The algorithm also is coded to "omit" the curves
99
+ that got too fast too close to the stationary point set. By "omiting", we
100
+ mean that such a descented curve will not count towards the number of
101
+ descented curves; "too fast" means that the curve got too close to the
102
+ statonary set before the first checkup. A consequence of this is that if
103
+ this checkup number is set too high, and there are a few stationary points,
104
+ then (almost) all the descended curves will converge faster than the first
105
+ checkup and as such, they will not count towards the number of attempted
106
+ tries. Heavily slowing down the algorithm.
107
+ multistart_max_discarded_tries : int, default 30
108
+ If more than multistart_max_discarded_tries curves are discarded
109
+ consecutively. Then the algorithm will issue a warning to set
110
+ `multistart_inter_iteration_checkup` higher and will add a counter
111
+ to the number of restarts. This is a failsafe against a `while true` loop.
112
+ multistart_taboo_dist : numpy.float, default 0.01
113
+ The distance, in H^1 norm, of a curve to an element of the stationary
114
+ set to be discarded.
115
+ multistart_energy_dist : numpy.float, default 0.01
116
+ Acceleration parameter to measure the distance between the descended curve
117
+ with those of the stationary set. The stationary point set is ordered by
118
+ their F(γ) value, which is also readily available in a list. Therefore by
119
+ computing the F(γ) value of the descended curve, one can just compare the
120
+ current curve with those around that value, this parameter defines that
121
+ radius.
122
+ multistart_early_stop : lambda function, default constant equal to infinite
123
+ This parameter allows to pass an early stop criteria to the multistart
124
+ algorithm. The input is a two variable function whose first input is
125
+ the number of attempted restarts, and the second parameter is the number
126
+ of found stationary point. The multistart gradient descent will stop once
127
+ it either reaches the `insertion_max_restart` value, or the value given by
128
+ this function.
129
+ multistart_proposition_max_iter : int, default 10000
130
+ Each proposed curve must start with negative energy, if it does not, it
131
+ is discarded and another curve is proposed. This parameter sets a limit on
132
+ how many attempts will be done.
133
+ multistart_descent_max_iter : int, default 16000
134
+ This parameter limits the number of gradient descent steps that will be
135
+ done on each descended curve.
136
+ multistart_descent_soft_max_iter : int, default 5000
137
+ This is a soft maximum number of iterations. If the currently descended
138
+ curve has done more than this number of iterations, and simultaneously its
139
+ energy is not "good enough", then the descense will be stopped.
140
+ multistart_descent_soft_max_threshold : numpy.float, default 0.8
141
+ Sets the threshold to discard the current descended curve, the current
142
+ descended curve has to be at least this ratio closer to the best known
143
+ stationary curve.
144
+ multistart_descent_init_step : numpy.float, default 1
145
+ The gradient descent uses an Armijo with backtracking descent. This
146
+ parameter sets the intiial stepsize/
147
+ multistart_descent_limit_stepsize : numpy.float, default 1e-20
148
+ The gradient descent stops when the stepsize becomes smaller than this
149
+ value.
150
+ H1_tolerance : numpy.float, default 1e-5
151
+ The quadratic optimization step will attempt to merge curves that are
152
+ closer than this distance in H1 norm.
153
+ curves_list_length_lim : int, default 1000
154
+ The quadratic optimization step will take at most this number of stationary
155
+ point found in the insertion step.
156
+ curves_list_length_min : int, default 10,
157
+ In the optimization step after the insertion step, the inserted curves are
158
+ the union of the already known curves, together with those found in the
159
+ multistart descent. This parameter sets least number of stationary curves
160
+ from the mutlistart descent that have to be added for optimization.
161
+ CVXOPT_TOL : numpy_float, default 1e-25
162
+ CVXOPT is the used solver to tackle the quadratic optimization step. This
163
+ parameter defines the considered tolerance value for both the relative and
164
+ absolute errors.
165
+ g_flow_opt_max_iter : int, default 100000
166
+ During the sliding step, this parameter modules the maximum number of
167
+ iterations to execute.
168
+ g_flow_opt_in_between_iters : int, default 100
169
+ During the sliding step, in between iterations, the weights of the measure
170
+ are optomized via the optimization step. This parameter regulates how often
171
+ this is done.
172
+ g_flow_init_step : numpy.float, default 1
173
+ The initial stepsize of the Armijo with Backtracking gradient descent
174
+ for the Sliding step.
175
+ g_flow_limit_stepsize : numpy.float, defaylt 1e-20
176
+ During the sliding step, the descent stops once the stepsize reaches this
177
+ size.
178
+ log_output : boolean, default False
179
+ Switch to log the convergence information into a .txt file into the
180
+ `results` folder. WARNING: requires rework, too many useless lines are
181
+ saved.
182
+ save_output_each_N : int, default 1000
183
+ How often the saved logs will be saved. This parameter consider the number
184
+ of lines of the file.
185
+ log_maximal_line_size : int, default 10000,
186
+ Maximum size of the logfile. If exceeded, the file is discarded.
187
+ use_ffmpeg : Boolean, default True
188
+ Switch to use the ffmpeg library. This is required to save the obtained
189
+ curves and measures as videos.
82
190
"""
83
191
# Standard imports
84
192
import pickle
@@ -118,6 +226,7 @@ def self_pickle(filename):
118
226
beta = 0.1
119
227
# Problem data
120
228
f_t = None
229
+ multistart_max_discarded_tries = 30
121
230
122
231
# Measures parameters
123
232
measure_coefficient_too_low = 1e-18
@@ -135,7 +244,7 @@ def self_pickle(filename):
135
244
crossover_consecutive_inserts = 30
136
245
crossover_search_attempts = 1000
137
246
crossover_child_F_threshold = 0.8
138
- switching_max_distance = 0.05
247
+ crossover_max_distance = 0.05
139
248
140
249
# Insertions step
141
250
insertion_eps = 1e-10
@@ -144,11 +253,11 @@ def self_pickle(filename):
144
253
insertion_max_restarts = 20
145
254
insertion_min_restarts = 15
146
255
multistart_inter_iteration_checkup = 50
256
+ multistart_max_discarded_tries = 30
147
257
multistart_taboo_dist = 0.01
148
258
multistart_energy_dist = 0.01
149
259
multistart_early_stop = lambda num_tries , num_found : np .inf
150
260
multistart_proposition_max_iter = 10000
151
- multistart_max_discarded_tries = 30
152
261
153
262
# multistart gradient descent parameters
154
263
multistart_descent_max_iter = 16000
@@ -174,59 +283,5 @@ def self_pickle(filename):
174
283
save_output_each_N = 1000
175
284
log_maximal_line_size = 10000
176
285
177
- """ PARAMETER EXPLANATION GUIDE:
178
-
179
- * Problem coefficients
180
- alpha, beta > 0, are the regularization parameters of the underlying problem.
181
-
182
- * Curve and measures parameters
183
- curves_times_samples: the considered time discretization for the considered
184
- time-continuous curves in the time-continuous version of the problem
185
- measure_coefficient_too_low > 0, if a coefficient associated to some of the
186
- curves is too small, we consider the particular coefficient to be zero instead.
187
-
188
- * Whole algorithm parameters
189
- full_max_iteration. A complete iteration consists of an insertion step,
190
- merging step and flowing step. This number limits the number of complete
191
- iterations of the algorithm.
192
-
193
- * Max_curve parameters
194
- max_curve_x_res > 0 stands for the spatial resolution of the max_curve. The max
195
- curve is a curve that passes for each time through the maximum of the function
196
- w_t. Since afterwards the algorithm procedes to do a gradient descent, this
197
- maximum values can be chosen in a "less precise" way, therefore, instead of
198
- expensively finding the maximum at each step, a predefined spatial resolution
199
- is chosen and then the function w_t is discreetly sampled on a spatial grid
200
- with width defined by the max_curve_x_res parameter.
201
-
202
- * Step3 tabu search iteration parameters
203
- - step3_min_attempts_to_find_better_curve,
204
- - step3_max_attempts_to_find_better_curve
205
- At the step3, we need to find a curve that minimizes the target step3_energy.
206
- The problem is smooth but not convex. Therefore, the proposed approach is to
207
- shoot some curves and then descend them. By doing so, we are able to find local
208
- minima of the target functional. Empirically, it seems that it is not required
209
- to have the precise minimum of the functional, so these parameters basically
210
- allow to accelerate the algorithm trade-offing some sloppyness.
211
- step3_min_attempts_to_find_better_curve stands for the minimum number of
212
- attempts taken by the algorithm to find an acceptable curve to insert.
213
- If the algorithm does not find an acceptable curve to insert after this minimum
214
- number of tries, it will keep trying to find better candidates until reaching
215
- step3_max_attempts_to_find_better_curve. If this number is reached and no
216
- acceptable curve was found, the algorithm considers the true minimum to be
217
- already visited, and therefore the algorithm stops.
218
- - step3_tabu_in_between_iteration_condition_checkup
219
- - step3_tabu_dist
220
- The tabu search has an optimization step in which no all curves are descended
221
- to the fullest, as it is clear that they are descending to an already known
222
- local minimum. To do it so, the H1 norm is evaluated from the current curve
223
- candidate and those in the tabu set, the threshold in which to decide that the
224
- curve will descent to any already known local minimum curve is step3_tabu_dist.
225
- step3_tabu_in_between_iteration_condition_checkup is a parameter indicating
226
- after how many iterations to check if the current curve is close to someone
227
- on the Tabu set. (a low value implies a lot of wasted resources checking
228
- against all the curves in the Tabu set, a high value implies wasting too much
229
- resources descending a curve that clearly is converging to one in the tabu
230
- set).
231
-
232
- """
286
+ # Miscelaneous
287
+ use_ffmpeg = True
0 commit comments