odatse.solver.function module

class odatse.solver.function.Solver(info: Info)[source]

Bases: SolverBase

Solver class for evaluating functions with given parameters.

Initialize the solver.

Parameters:

info (Info) – Information object containing solver configuration.

__init__(info: Info) None[source]

Initialize the solver.

Parameters:

info (Info) – Information object containing solver configuration.

evaluate(x: ndarray, args: Tuple = (), nprocs: int = 1, nthreads: int = 1) float[source]

Evaluate the function with given parameters.

Parameters:
  • x (np.ndarray) – Input array for the function.

  • args (Tuple, optional) – Additional arguments for the function.

  • nprocs (int, optional) – Number of processes to use.

  • nthreads (int, optional) – Number of threads to use.

Returns:

Result of the function evaluation.

Return type:

float

get_results() float[source]

Get the results of the function evaluation.

Returns:

Result of the function evaluation.

Return type:

float

prepare(x: ndarray, args=()) None[source]

Prepare the solver with the given parameters.

Parameters:
  • x (np.ndarray) – Input array for the function.

  • args (tuple, optional) – Additional arguments for the function.

run(nprocs: int = 1, nthreads: int = 1) None[source]

Run the function evaluation.

Parameters:
  • nprocs (int, optional) – Number of processes to use.

  • nthreads (int, optional) – Number of threads to use.

Raises:

RuntimeError – If the function is not set.

set_function(f: Callable[[ndarray], float]) None[source]

Set the function to be evaluated.

Parameters:

f (Callable[[np.ndarray], float]) – Function to be evaluated.