Startpoint

Methods for selecting points that can be used as startpoints for multi-start optimization. Startpoint methods can be implemented by deriving from pypesto.startpoint.StartpointMethod. Handling in pypesto is then wrapped in pypesto.startpoint.assign_startpoints(), handling e.g. non-requirement of startpoints e.g. for global methods, and re-sampling of non-finite points.

class pypesto.startpoint.FunctionStartpoints(function: Callable)[source]

Bases: pypesto.startpoint.base.StartpointMethod

Define startpoints via callable.

The callable should take the same arguments as the __call__ method.

__call__(n_starts: int, lb: numpy.ndarray, ub: numpy.ndarray, objective: pypesto.objective.base.ObjectiveBase)numpy.ndarray[source]

Generate startpoints.

Parameters
  • n_starts – Number of starts.

  • lb – Lower parameter bound.

  • ub – Upper parameter bound.

  • objective – Objective, maybe required for evaluation.

Returns

Startpoints, shape (n_starts, n_par).

Return type

startpoints

__init__(function: Callable)[source]
Parameters

function (The callable sampling startpoints.) –

class pypesto.startpoint.LatinHypercubeStartpoints(smooth: bool = True)[source]

Bases: pypesto.startpoint.base.StartpointMethod

Generate latin hypercube-sampled startpoints.

See e.g. https://en.wikipedia.org/wiki/Latin_hypercube_sampling.

__call__(n_starts: int, lb: numpy.ndarray, ub: numpy.ndarray, objective: Optional[pypesto.objective.base.ObjectiveBase] = None)numpy.ndarray[source]

Generate startpoints.

Parameters
  • n_starts – Number of starts.

  • lb – Lower parameter bound.

  • ub – Upper parameter bound.

  • objective – Objective, maybe required for evaluation.

Returns

Startpoints, shape (n_starts, n_par).

Return type

startpoints

__init__(smooth: bool = True)[source]
Parameters

smooth – Whether a (uniformly chosen) random starting point within the hypercube [i/n_starts, (i+1)/n_starts] should be chosen (True) or the midpoint of the interval (False).

class pypesto.startpoint.StartpointMethod[source]

Bases: object

Startpoint generation, in particular for multi-start optimization.

Abstract base class, specific sampling method needs to be defined in sub-classes.

abstract __call__(n_starts: int, lb: numpy.ndarray, ub: numpy.ndarray, objective: pypesto.objective.base.ObjectiveBase)numpy.ndarray[source]

Generate startpoints.

Parameters
  • n_starts – Number of starts.

  • lb – Lower parameter bound.

  • ub – Upper parameter bound.

  • objective – Objective, maybe required for evaluation.

Returns

Startpoints, shape (n_starts, n_par).

Return type

startpoints

class pypesto.startpoint.UniformStartpoints[source]

Bases: pypesto.startpoint.base.StartpointMethod

Generate uniformly sampled startpoints.

__call__(n_starts: int, lb: numpy.ndarray, ub: numpy.ndarray, objective: Optional[pypesto.objective.base.ObjectiveBase] = None)numpy.ndarray[source]

Generate startpoints.

Parameters
  • n_starts – Number of starts.

  • lb – Lower parameter bound.

  • ub – Upper parameter bound.

  • objective – Objective, maybe required for evaluation.

Returns

Startpoints, shape (n_starts, n_par).

Return type

startpoints

pypesto.startpoint.assign_startpoints(n_starts: int, startpoint_method: Union[pypesto.startpoint.base.StartpointMethod, bool], problem: pypesto.problem.Problem, startpoint_resample: bool)numpy.ndarray[source]

Assign startpoints for a given problem.

This is the main method called e.g. by pypesto.optimize.minimize.

Parameters
  • n_starts – Number of startpoints to generate.

  • startpoint_method – Startpoint generation method to use.

  • problem – Underlying problem specifying e.g. dimensions and bounds.

  • startpoint_resample – Whether to evaluate function values at proposed startpoints, and resample ones having non-finite values until all startpoints have finite value.

Returns

Startpoints, shape (n_starts, n_par).

Return type

startpoints

pypesto.startpoint.to_startpoint_method(maybe_startpoint_method: Union[pypesto.startpoint.base.StartpointMethod, Callable])pypesto.startpoint.base.StartpointMethod[source]

Create StartpointMethod instance if possible, otherwise raise.

Parameters

maybe_startpoint_method – A StartpointMethod instance, or a Callable as expected by FunctionStartpoints.

Returns

A StartpointMethod instance.

Return type

startpoint_method

Raises

TypeError if arguments cannot be converted to a StartpointMethod.