-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to trigger stop condition manually #280
Comments
Outcomment the |
Except to specifing the timeout to hard stop, is it possible to set some object function value to stop? For example I want the object function value to be <=45, what should I do? Is there a criticism to set in options? |
Same answer, you can use the These versatile options can be displayed like import cma
{key: val for key, val in cma.CMAOptions().items() if '#v' in val} gives {'CMA_active_injected': '0 #v weight multiplier for negative weights of injected solutions',
'CMA_elitist': 'False #v or "initial" or True, elitism likely impairs global search performance',
'CMA_injections_threshold_keep_len': '1 #v keep length if Mahalanobis length is below the given relative threshold',
'CSA_dampfac': '1 #v positive multiplier for step-size damping, 0.3 is close to optimal on the sphere',
'CSA_disregard_length': 'False #v True is untested, also changes respective parameters',
'CSA_clip_length_value': 'None #v poorly tested, [0, 0] means const length N**0.5, [-1, 1] allows a variation of +- N/(N+2), etc.',
'CSA_squared': 'False #v use squared length for sigma-adaptation ',
'CSA_invariant_path': 'False #v pc is invariant and ps (default) is unbiased',
'stall_sigma_change_on_divergence_iterations': 'False #v number of iterations of median worsenings threshold at which the sigma change is stalled; the default may become 2',
'ftarget': '-inf #v target function value, minimization',
'is_feasible': 'is_feasible #v a function that computes feasibility, by default lambda x, f: f not in (None, np.nan)',
'maxfevals': 'inf #v maximum number of function evaluations',
'maxiter': '100 + 150 * (N+3)**2 [//](https://github.com/CMA-ES/pycma/issues/280) popsize**0.5 #v maximum number of iterations',
'mean_shift_line_samples': 'False #v sample two new solutions colinear to previous mean shift',
'mindx': '0 #v minimal std in any arbitrary direction, cave interference with tol*',
'minstd': '0 #v minimal std (scalar or vector) in any coordinate direction, cave interference with tol*',
'maxstd': 'None #v maximal std (scalar or vector) in any coordinate direction',
'pc_line_samples': 'False #v one line sample along the evolution path pc',
'randn': 'np.random.randn #v randn(lam, N) must return an np.array of shape (lam, N), see also cma.utilities.math.randhss',
'termination_callback': '[] #v a function or list of functions returning True for termination, called in `stop` with `self` as argument, could be abused for side effects',
'timeout': 'inf #v stop if timeout seconds are exceeded, the string "2.5 * 60**2" evaluates to 2 hours and 30 minutes',
'tolconditioncov': '1e14 #v stop if the condition of the covariance matrix is above `tolconditioncov`',
'tolfacupx': '1e3 #v termination when step-size increases by tolfacupx (diverges). That is, the initial step-size was chosen far too small and better solutions were found far away from the initial solution x0',
'tolupsigma': '1e20 #v sigma/sigma0 > tolupsigma * max(eivenvals(C)**0.5) indicates "creeping behavior" with usually minor improvements',
'tolflatfitness': '1 #v iterations tolerated with flat fitness before termination',
'tolfun': '1e-11 #v termination criterion: tolerance in function value, quite useful',
'tolfunhist': '1e-12 #v termination criterion: tolerance in function value history',
'tolfunrel': '0 #v termination criterion: relative tolerance in function value: Delta f current < tolfunrel * (median0 - median_min)',
'tolstagnation': 'int(100 + 100 * N**1.5 [/](https://file+.vscode-resource.vscode-cdn.net/) popsize) #v termination if no improvement over tolstagnation iterations',
'tolxstagnation': '[1e-9, 20, 0.1] #v termination thresholds for Delta of [mean, iterations, iterations fraction], the latter two are summed; trigger termination if Dmean stays below the threshold over Diter iterations, pass `False` or a negative value to turn off tolxstagnation',
'tolx': '1e-11 #v termination criterion: tolerance in x-changes',
'updatecovwait': 'None #v number of iterations without distribution update, name is subject to future changes',
'verbose': '3 #v verbosity e.g. of initial/final message, -1 is very quiet, -9 maximally quiet, may not be fully implemented',
'verb_disp': '100 #v verbosity: display console output every verb_disp iteration',
'verb_disp_overwrite': 'inf #v start overwriting after given iteration',
'verb_log': '1 #v verbosity: write data to files every verb_log iteration, writing can be time critical on fast to evaluate functions',
'verb_plot': '0 #v in fmin2(): plot() is called every verb_plot iteration',
'verb_time': 'True #v output timings on console'}``` |
Hi,
I found that cma optimizer takes too long time searching over a global minimum (maybe local minimum but near to the global one). The outputs indicate that a plateau is reached, but optimizer does not stop searching. The chi2 is around 57 given by other optimizer like maximum entropy method. I don't understand exactly how the cma works. My question is how to trigger stop condition manually. Below is part of the outcomes.
Regards
The text was updated successfully, but these errors were encountered: