iddefix package

Submodules

iddefix.framework module

Created on Mon Mar 23 13:20:11 2020

@author: sjoly @modified by: MaltheRaschke

class iddefix.framework.EvolutionaryAlgorithm(x_data, y_data, N_resonators, parameterBounds, plane='longitudinal', fitFunction='impedance', objectiveFunction=obj.sumOfSquaredError, wake_length=None, sigma=None)[source]

Bases: object

check_y_data()[source]

Small function to avoid 0 frequency leading to zero division when using resonators.

compute_fft(data_time=None, data_wake=None, fmax=3e9, samples=1001)[source]
display_resonator_parameters(params=None, to_markdown=False)[source]

Displays resonance parameters in a formatted table using ASCII characters.

Parameters

solution – A NumPy array of resonator parameters, typically shaped (n_resonators, 3).

generate_Initial_Parameters(parameterBounds, objectiveFunction, fitFunction, x_values_data, y_values_data, maxiter=2000, popsize=150, mutation=(0.1, 0.5), crossover_rate=0.8, tol=0.01, solver='scipy')[source]

Generates initial parameter guesses for a minimization algorithm.

This function uses a differential evolution (DE) solver to find approximate solutions to a minimization problem, which can be used as initial guesses for more precise optimizers.

Parameters
  • parameterBounds – A list of tuples representing the upper and lower bounds for each parameter.

  • objective_function – A function that calculates the cost given a set of parameters and data. The signature should be objective_function(parameters, fit_function, x_data, y_data).

  • fit_function – A function that calculates the fit between a model and data. The signature should be fit_function(parameters, x_data, y_data).

  • x_values_data – The x-values of the data to fit.

  • y_values_data – The y-values of the data to fit.

  • maxiter – The maximum number of iterations for the DE solver.

  • popsize – The population size for the DE algorithm.

  • mutation – A tuple of two floats representing the mutation factors.

  • crossover_rate – The crossover rate for the DE algorithm.

  • tol – The tolerance for convergence.

  • solver – The solver to use for differential evolution. Valid options are “scipy”, “pyfde”, or “pyfde_jade”. Defaults to “scipy”.

Returns

  • The estimated initial parameters found by the DE solver.

  • A message indicating the solver’s status.

Return type

A tuple containing

get_extrapolated_wake(new_end_time=None, dt=None, time_data=None, use_minimization=True)[source]
get_impedance(frequency_data=None, use_minimization=True, wakelength=None)[source]
get_impedance_from_fft(time_data=None, wake_data=None, fmax=3e9, samples=1001)[source]
get_impedance_from_fitFunction(frequency_data=None, use_minimization=True)[source]
get_wake(time_data=None, use_minimization=True)[source]
get_wake_potential(time_data=None, sigma=1e-9, use_minimization=True)[source]
run_differential_evolution(maxiter=2000, popsize=15, mutation=(0.1, 0.5), crossover_rate=0.8, tol=0.01, vectorized=False, solver='scipy', iteration_convergence=False, debug=False)[source]
run_minimization_algorithm(margin=0.1, method='Nelder-Mead')[source]

Minimization algorithm is used to refine results obtained by the DE algorithm. They are used as initial guess for the algorithm and each parameter is allowed to be increased or decreased by 100*margin [%].

iddefix.objectiveFunctions module

Created on Sat Dec 5 16:34:10 2020

@author: sjoly

class iddefix.objectiveFunctions.ObjectiveFunctions[source]

Bases: object

logsumOfSquaredError(fitFunction, x, y)[source]

Calculates the sum of log squared errors for a given fit function.

This function computes the log squared errors between the predicted values from a fit function and the actual data points. It works with both real and imaginary components of the data.

Parameters
  • parameters – Array of parameters used by the fit_function.

  • fitFunction – Function that takes parameters and x values as input and returns predicted y values (including real and imaginary parts).

  • x – Array of x values for the data.

  • y – Array of y values for the data (including real and imaginary parts).

Returns

The sum of log squared errors.

logsumOfSquaredErrorReal(fitFunction, x, y)[source]

Calculates the real sum of log squared errors for a given fit function.

This function computes the real log squared errors between the predicted values from a fit function and the actual data points. It works only with the real component of the data.

Parameters
  • parameters – Array of parameters used by the fit_function.

  • fitFunction – Function that takes parameters and x values as input and returns predicted y values (including only the real part).

  • x – Array of x values for the data.

  • y – Array of y values for the data (including only the real part).

Returns

The real sum of log squared errors.

sumOfSquaredError(fitFunction, x, y)[source]

Calculates the sum of squared errors (SSE) for a given fit function.

This function computes the SSE between the predicted values from a fit function and the actual data points. It works with both real and imaginary components of the data.

Parameters
  • parameters – Array of parameters used by the fit_function.

  • fitFunction – Function that takes parameters and x values as input and returns predicted y values (including real and imaginary parts).

  • x – Array of x values for the data.

  • y – Array of y values for the data (including real and imaginary parts).

Returns

The sum of squared errors (SSE).

sumOfSquaredErrorReal(fitFunction, x, y)[source]

Calculates the real sum of squared errors (SSE) for a given fit function.

This function computes the SSE between the predicted values from a fit function and the actual data points. It works only with the real component of the data.

Parameters
  • parameters – Array of parameters used by the fit_function.

  • fitFunction – Function that takes parameters and x values as input and returns predicted y values (including only the real part).

  • x – Array of x values for the data.

  • y – Array of y values for the data (including only the real part).

Returns

The real sum of squared errors (SSE).

iddefix.resonatorFormulas module

Created on Mon Mar 23 13:20:11 2020

@author: sjoly

class iddefix.resonatorFormulas.Impedances[source]

Bases: object

Resonator_longitudinal_imp(Rs, Q, resonant_frequency, wake_length=None)[source]

Calculates the longitudinal impedance of a resonator.

This function calculates the longitudinal impedance of a resonator with shunt impedance Rs, quality factor Q, and resonant frequency resonant_frequency at different frequencies frequencies.

Parameters
  • frequencies (np.ndarray) – Array of frequencies values in Hz.

  • Rs (float) – Shunt impedance of the resonator in Ohm.

  • Q (float) – Quality factor of the resonator.

  • resonant_frequency (float) – Resonant frequency of the resonator in Hz.

  • wake_length (float, optional) – Additional parameter for the calculation

  • wake. (of the impedance of a partially decayed) – Defaults to None for the original (fully decayed wake) behavior.

Returns

Array of longitudinal impedance values [Ohm] at the corresponding frequencies.

Return type

np.ndarray

Notes

The fully decayed formula uses the generalized impedance formula (https://cds.cern.ch/record/192684/files/198812060.pdf) and can be used for any real positive value of Q.

The partially decayed formula uses the formula derived in (Joly, S. thesis not published yet!)

Moreover, it sets the impedance value to zero for zero frequencies in both cases.

Units for this formula are:

Rs: Ohm/m Q: dimensionless resonant_frequency: Hz wake_length: m

Examples

>>> frequencies = np.linspace(0, 2.5e9, 1000)
>>> Rs = 1e6
>>> Q = 0.6
>>> resonant_frequency = 1e9
>>> impedance = Resonator_longitudinal_imp(frequencies, Rs, Q, resonant_frequency)
>>> plt.plot(frequencies, impedance)
>>> plt.xlabel("Frequency [Hz]")
>>> plt.ylabel("Longitudinal Impedance [Ohm]")
>>> plt.show()
Resonator_transverse_imp(Rs, Q, resonant_frequency, wake_length=None)[source]

Calculates the transverse impedance of a resonator.

This function calculates the transverse impedance of a resonator with shunt impedance Rs, quality factor Q, and resonant frequency resonant_frequency at different frequencies frequencies. The wake_length argument allows computing the impedance of a partially decayed wake over wake_length.

Parameters
  • frequencies (np.ndarray) – Array of frequencies values in Hz.

  • Rs (float) – Shunt impedance of the resonator in Ohm/m.

  • Q (float) – Quality factor of the resonator.

  • resonant_frequency (float) – Resonant frequency of the resonator in Hz.

  • wake_length (float, optional) – Additional parameter for the calculation

  • wake. (of the impedance of a partially decayed) – Defaults to None for the original (fully decayed wake) behavior.

Returns

Array of transverse impedance values [Ohm/m] at the corresponding frequencies.

Return type

np.ndarray

Notes

The fully decayed formula uses the generalized impedance formula (https://cds.cern.ch/record/192684/files/198812060.pdf) and can be used for any real positive value of Q.

The partially decayed formula uses the formula derived in (Joly, S. thesis not published yet!)

Moreover, it sets the impedance value to zero for zero frequencies in both cases.

Units for this formula are:

Rs: Ohm/m Q: dimensionless resonant_frequency: Hz wake_length: m

n_Resonator_longitudinal_imp(pars, wake_length=None)[source]

Calculates the combined longitudinal impedance of multiple resonators.

This function calculates the total longitudinal impedance of a system consisting of multiple resonators at different frequencies frequencies. Each resonator is defined by its parameters provided in a dictionary dict_params.

Parameters
  • frequencies (np.ndarray) – Array of frequencies values in Hz.

  • dict_params (dict or ndarray) –

    Dictionary containing resonator parameters. Keys are unique identifiers for each resonator, and values are lists containing the parameters in the following order:

    • Rs (float): Shunt impedance of the resonator in Ohm.

    • Q (float): Quality factor of the resonator.

    • resonant_frequency (float): Resonant frequency of the resonator in Hz.

  • wake_length (float, optional) – Additional parameter for the calculation

  • wake. (of the impedance of a partially decayed) –

  • original (Defaults to None for the) –

Returns

Array of combined longitudinal impedance values [Ohm] at

the corresponding frequencies.

Return type

np.ndarray

Examples

>>> frequencies = np.linspace(0, 2.5e9, 1000)
>>> pars = {
...     1: [1e6, 1, 1e9],
...     2: [2e6, 1, 5e8],
... }
>>> # Or, use directly the result from the DE solver
>>> pars = DE_model.evolutionParameters
>>> impedance = n_Resonator_longitudinal_imp(frequencies, pars)
>>> plt.plot(frequencies, impedance)
>>> plt.xlabel("Frequency [Hz]")
>>> plt.ylabel("Longitudinal Impedance [Ohm]")
>>> plt.show()

Notes

  • This function assumes all resonators have the same type of longitudinal

    impedance formula implemented in Resonator_longitudinal_imp.

  • The combined impedance is calculated by summing the individual

    impedance contributions from each resonator at each frequency.

  • Resonator parameters should be positive values (except for the shunt impedance).

Behavior for invalid values is not defined and may lead to errors.

n_Resonator_transverse_imp(pars, wake_length=None)[source]

Calculates the combined transverse impedance of multiple resonators.

This function calculates the total transverse impedance of a system consisting of multiple resonators at different frequencies frequencies. Each resonator is defined by its parameters provided in a dictionary dict_params.

Parameters
  • frequencies (np.ndarray) – Array of frequencies values in Hz.

  • dict_params (dict or ndaray) –

    Dictionary containing resonator parameters. Keys are unique identifiers for each resonator, and values are lists containing the parameters in the following order:

    • Rs (float): Shunt impedance of the resonator in Ohm/m.

    • Q (float): Quality factor of the resonator.

    • resonant_frequency (float): Resonant frequency of the resonator in Hz.

  • wake_length (float, optional) – Additional parameter for the calculation

  • wake. (of the impedance of a partially decayed) –

  • original (Defaults to None for the) –

Returns

Array of combined transverse impedance values [Ohm/m] at

the corresponding frequencies.

Return type

np.ndarray

Examples

>>> frequencies = np.linspace(0, 2.5e9, 1000)
>>> pars = {
...     1: [1e6, 1, 1e9],
...     2: [2e6, 1, 5e8],
... }
>>> # Or, use directly the result from the DE solver
>>> pars = DE_model.evolutionParameters
>>> impedance = n_Resonator_transverse_imp(frequencies, pars)
>>> plt.plot(frequencies, impedance)
>>> plt.xlabel("Frequency [Hz]")
>>> plt.ylabel("Transverse Impedance [Ohm/m]")
>>> plt.show()

Notes

  • This function assumes all resonators have the same type of transverse

    impedance formula implemented in Resonator_transverse_imp.

  • The combined impedance is calculated by summing the individual

    impedance contributions from each resonator at each frequency.

  • Resonator parameters should be positive values (except for the shunt impedance).

Behavior for invalid values is not defined and may lead to errors.

class iddefix.resonatorFormulas.Wakes[source]

Bases: object

Resonator_longitudinal_wake(Rs, Q, resonant_frequency)[source]

Calculates the longitudinal wake function of a resonator.

This function calculates the longitudinal wake function of a resonator with shunt impedance Rs, quality factor Q, and resonant frequency resonant_frequency at different times times.

Parameters
  • times (np.ndarray) – Array of time values in seconds.

  • Rs (float) – Shunt impedance of the resonator in Ohm.

  • Q (float) – Quality factor of the resonator.

  • resonant_frequency (float) – Resonant frequency of the resonator in Hz.

Returns

Array of longitudinal wake function values [V/C] at the corresponding times.

Return type

np.ndarray

Notes

This formula uses the generalized wake function formula and can be used for any real positive value of Q. https://cds.cern.ch/record/192684/files/198812060.pdf

Units for this formula are:

Rs: Ohm Q: dimensionless resonant_frequency: Hz

Examples

>>> times = np.linspace(0, 1e-9, 1000)
>>> Rs = 1e6
>>> Q = 0.6
>>> resonant_frequency = 1e9
>>> wake_function = Resonator_longitudinal_wake(times, Rs, Q, resonant_frequency)
>>> plt.plot(times, wake_function)
>>> plt.xlabel("Time [s]")
>>> plt.ylabel("Longitudinal Wake Function [V/C]")
>>> plt.show()
Resonator_longitudinal_wake_potential(Rs, Q, resonant_frequency, sigma=1e-10, use_mpmath=False)[source]

Single resonator wake potential (longitudinal) for a Gaussian bunch of line density.

Parameters
  • Rs (float or list) – Shunt impedance (Ohm).

  • resonant_frequency (float or list) – Resonant frequency (Hz).

  • Q (float or list) – Quality factor.

  • sigma (float) – RMS bunch length (s).

  • times (array-like) – Times (s) where wake is computed (times > 0 behind the source).

  • use_mpmath (bool, optional) – Use mpmath for calculations. Defaults to False.

Returns

Wake potential at times times.

Return type

np.ndarray

Notes

The formula is from Chao’s Handbook (p. 237, sec 3.2), partly re-derived by N. Mounet. Equivalent formula in https://cds.cern.ch/record/192684/files/198812060.pdf Q must be different from 0.5! Rs, resonant_frequency, and Q must be scalar.

Resonator_transverse_wake(Rs, Q, resonant_frequency)[source]

Calculates the longitudinal wake function of a resonator.

This function calculates the transverse wake function of a resonator with shunt impedance Rs, quality factor Q, and resonant frequency resonant_frequency at different times times.

Parameters
  • times (np.ndarray) – Array of time values in seconds.

  • Rs (float) – Shunt impedance of the resonator in Ohm/m.

  • Q (float) – Quality factor of the resonator.

  • resonant_frequency (float) – Resonant frequency of the resonator in Hz.

Returns

Array of longitudinal wake function values [V/C/m] at the corresponding times.

Return type

np.ndarray

Notes

This formula uses the generalized wake function formula and can be used for any real positive value of Q. https://cds.cern.ch/record/192684/files/198812060.pdf

Units for this formula are:

Rs: Ohm/m Q: dimensionless resonant_frequency: Hz

Examples

>>> times = np.linspace(0, 1e-9, 1000)
>>> Rs = 1e6
>>> Q = 0.6
>>> resonant_frequency = 1e9
>>> wake_function = Resonator_transverse_wake(times, Rs, Q, resonant_frequency)
>>> plt.plot(times, wake_function)
>>> plt.xlabel("Time [s]")
>>> plt.ylabel("Transverse Wake Function [V/C]")
>>> plt.show()
Resonator_transverse_wake_potential(Rs, Q, resonant_frequency, sigma=1e-10, use_mpmath=False)[source]

Single resonator wake potential (transverse) for a Gaussian bunch of line density.

Parameters
  • Rs (float or list) – Shunt impedance (Ohm).

  • resonant_frequency (float or list) – Resonant frequency (Hz).

  • Q (float or list) – Quality factor.

  • sigma (float) – RMS bunch length (s).

  • times (array-like) – Times (s) where wake is computed (times > 0 behind the source).

  • use_mpmath (bool, optional) – Use mpmath for calculations. Defaults to False.

Returns

Wake potential at times times.

Return type

np.ndarray

Notes

The formula is from Chao’s Handbook (p. 237, sec 3.2), partly re-derived by N. Mounet. Equivalent formula in https://cds.cern.ch/record/192684/files/198812060.pdf Q must be different from 0.5! Rs, resonant_frequency, and Q must be scalar.

n_Resonator_longitudinal_wake(pars)[source]

Calculates the combined longitudinal wake function of multiple resonators.

This function calculates the total longitudinal wake function induced by a system consisting of multiple resonators at different times times. Each resonator is defined by its parameters provided in a dictionary dict_params.

Parameters
  • times (np.ndarray) – Array of time values in seconds.

  • dict_params (dict or ndarray) – Dictionary containing resonator parameters.

  • dict (If) –

  • resonator (Keys are unique identifiers for each) –

  • are (and values) –

  • order (lists containing the parameters in the following) –

    • Rs (float): Shunt impedance of the resonator in Ohm.

    • Q (float): Quality factor of the resonator.

    • resonant_frequency (float): Resonant frequency of the resonator in Hz.

Returns

Array of combined transverse wake function values [V/C] at

the corresponding times.

Return type

np.ndarray

Examples

>>> times = np.linspace(0, 1e-9, 1000)
>>> pars = {
...     1: [1e6, 1, 1e9],
...     2: [2e6, 1, 5e8],
... }
>>> # Or, use directly the result from the DE solver
>>> pars = DE_model.evolutionParameters
>>> wake_function = n_Resonator_longitudinal_wake(times, pars)
>>> plt.plot(times, wake_function)
>>> plt.xlabel("Time [s]")
>>> plt.ylabel("Longitudinal Wake Function [V/C]")
>>> plt.show()

Notes

  • This function assumes all resonators have the same type of longitudinal

    wake function formula implemented in Resonator_longitudinal_wake.

  • The combined wake function is calculated by summing the individual

    wake function contributions from each resonator at each time step.

  • Resonator parameters should be positive values (except for the shunt impedance).

Behavior for invalid values is not defined and may lead to errors.

n_Resonator_longitudinal_wake_potential(pars, sigma=1e-10)[source]
n_Resonator_transverse_wake(pars)[source]

Calculates the combined transverse wake function of multiple resonators.

This function calculates the total transverse wake function induced by a system consisting of multiple resonators at different times times. Each resonator is defined by its parameters provided in a dictionary dict_params.

Parameters
  • times (np.ndarray) – Array of time values in seconds.

  • dict_params (dict or ndarray) –

    Dictionary containing resonator parameters. Keys are unique identifiers for each resonator, and values are lists containing the parameters in the following order:

    • Rs (float): Shunt impedance of the resonator in Ohm/m.

    • Q (float): Quality factor of the resonator.

    • resonant_frequency (float): Resonant frequency of the resonator in Hz.

Returns

Array of combined transverse wake function values [V/C/m] at

the corresponding times.

Return type

np.ndarray

Examples

>>> times = np.linspace(0, 1e-9, 1000)
>>> pars = {
...     1: [1e6, 1, 1e9],
...     2: [2e6, 1, 5e8],
... }
>>> # Or, use directly the result from the DE solver
>>> pars = DE_model.evolutionParameters
>>> wake_function = n_Resonator_transverse_wake(times, pars)
>>> plt.plot(times, wake_function)
>>> plt.xlabel("Time [s]")
>>> plt.ylabel("Transverse Wake Function [V/C/m]")
>>> plt.show()

Notes

  • This function assumes all resonators have the same type of transverse

    wake function formula implemented in Resonator_transverse_wake.

  • The combined wake function is calculated by summing the individual

    wake function contributions from each resonator at each time step.

  • Resonator parameters should be positive values (except for the shunt impedance).

Behavior for invalid values is not defined and may lead to errors.

n_Resonator_transverse_wake_potential(pars, sigma=1e-10)[source]

iddefix.smartBoundDetermination module

Created on Sat Dec 5 16:34:10 2020

@author: MaltheRaschke

class iddefix.smartBoundDetermination.SmartBoundDetermination(frequency_data, impedance_data, minimum_peak_height=1.0)[source]

Bases: object

find(frequency_data=None, impedance_data=None, minimum_peak_height=None, threshold=None, distance=None, prominence=None)[source]

Identifies peaks in the impedance data and determines the bounds for fitting parameters based on the detected peaks.

This function uses scipy.signal.find_peaks to locate peaks in the impedance data and then calculates bounds for fitting parameters, including resistance (Rs), quality factor (Q), and resonant frequency.

Parameters
  • frequency_data (numpy.ndarray, optional) – Array containing the frequency data in Hz. If None, the instance attribute self.frequency_data is used.

  • impedance_data (numpy.ndarray, optional) – Array containing the impedance data in Ohms. If None, the instance attribute self.impedance_data is used.

  • minimum_peak_height (float or numpy.ndarray or 2-item list, optional) – Minimum peak height for the peak-finding algorithm. * If numpy.ndarray, it should have the same length as impedance_data * If 2-item list, specifies the [min, max] of peak heights

  • threshold (float, optional) – Required vertical distance between a peak and its neighboring values to be considered a peak. Passed to scipy.signal.find_peaks. Default is None.

  • distance (float, optional) – Required minimum horizontal distance (in indices) between peaks. Passed to scipy.signal.find_peaks. Default is None.

  • prominence (float, optional) – Required prominence of peaks. The prominence measures how much a peak stands out compared to its surrounding values. Passed to scipy.signal.find_peaks. Default is None.

Returns

parameterBounds – A list of parameter bounds for fitting. Each resonance contributes three sets of bounds: - (Rs_min, Rs_max): Bounds for resistance Rs. - (Q_min, Q_max): Bounds for quality factor Q. - (freq_min, freq_max): Bounds for the resonant frequency.

Return type

list of tuples

Notes

  • The peak-finding algorithm is implemented using scipy.signal.find_peaks.

See the official documentation for more details: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html - The 3dB bandwidth method is used to estimate initial Q factors and define frequency bounds. - The detected peaks and their heights are stored in instance attributes self.peaks and self.peaks_height, respectively. - The number of detected resonances is stored in self.Nres.

inspect()[source]

iddefix.solvers module

Created on Sat Dec 5 16:33:41 2020

@author: sjoly

class iddefix.solvers.ProgressBarCallback(max_generations)[source]

Bases: object

close()[source]
class iddefix.solvers.Solvers[source]

Bases: object

run_pyfde_jade_solver(minimization_function, maxiter=2000, popsize=150, tol=0.01, **kwargs)[source]

Runs the pyfde JADE solver to minimize a given function.

Parameters
  • parameterBounds – A list of tuples representing the bounds for each parameter.

  • minimization_function – The function to be minimized.

  • maxiter – The maximum number of iterations to run the solver for.

  • popsize – The population size for the differential evolution algorithm.

  • tol – The tolerance for convergence.

Returns

  • The solution found by the solver.

  • A message indicating the solver’s status.

Return type

A tuple containing

run_pyfde_solver(minimization_function, maxiter=2000, popsize=150, mutation=0.45, crossover_rate=0.8, tol=0.01, **kwargs)[source]

Runs the pyfde ClassicDE solver to minimize a given function.

Parameters
  • parameterBounds – A list of tuples representing the bounds for each parameter.

  • minimization_function – The function to be minimized.

  • maxiter – The maximum number of iterations to run the solver for.

  • popsize – The population size for the differential evolution algorithm.

  • mutation – A tuple of two floats representing the mutation factors.

  • crossover_rate – The crossover rate for the differential evolution algorithm.

  • tol – The tolerance for convergence.

Returns

  • The solution found by the solver.

  • A message indicating the solver’s status.

Return type

A tuple containing

run_scipy_solver(minimization_function, maxiter=2000, popsize=150, mutation=(0.1, 0.5), crossover_rate=0.8, tol=0.01, **kwargs)[source]

Runs the SciPy differential_evolution solver to minimize a given function.

All the arguments are detailed on this page : (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html) Setting workers= -1 means all CPUs available will be used for the computation. Default parameters used for the DE algorithm taken from https://www.mdpi.com/2227-7390/9/4/427

Parameters
  • parameterBounds – A list of tuples representing the upper and lower bounds for each parameter.

  • minimization_function – The function to be minimized.

  • maxiter – The maximum number of iterations to run the solver for.

  • popsize – The population size for the differential evolution algorithm.

  • mutation – A tuple of two floats representing the mutation factors.

  • crossover_rate – The crossover rate for the differential evolution algorithm.

  • tol – The tolerance for convergence.

Returns

  • The solution found by the solver.

  • A message indicating the solver’s status.

Return type

A tuple containing

iddefix.solvers.stop_criterion(solver)[source]

Based on the criterion used in scipy.optimize.differential_evolution (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.differential_evolution.html) Check that the ratio of the spread of the population fitness compared to its average. In other words, if most of the population individuals converge to the same solution indicating an optimal solution has been found.

Module contents