pyglobalsearch.PyLocalSolution#

class pyglobalsearch.PyLocalSolution(point, objective)#

Bases: object

A local solution found by the optimization algorithm.

Represents a single solution point in parameter space along with its objective function value. This class provides both direct attribute access and SciPy-compatible methods for accessing solution data.

Variables:
  • point (list[float]) – The solution coordinates as a list of float values

  • objective (float) – The objective function value at this solution point

Examples#

Create and access a solution:

>>> solution = PyLocalSolution([1.0, 2.0], 3.5)
>>> # Access via attributes
>>> x_coords = solution.point
>>> f_value = solution.objective
>>> # Access via SciPy-compatible methods
>>> x_coords = solution.x()
>>> f_value = solution.fun()
__init__()#

Methods

__init__()

fun()

Returns the objective function value at the solution point.

x()

Returns the solution point as a list of float values.

Attributes

objective

The objective function value at this solution point

point

The solution coordinates as a list of float values

fun()#

Returns the objective function value at the solution point.

Returns:

The objective function value at this solution point (same as objective attribute)

Return type:

float

Note

This method is similar to the fun method in SciPy.optimize results.

objective#

The objective function value at this solution point

Returns:

The objective function value at this solution point (same as fun() method)

Return type:

float

point#

The solution coordinates as a list of float values

Returns:

The solution coordinates as a list of float values (same as x() method)

Return type:

list[float]

x()#

Returns the solution point as a list of float values.

Returns:

The solution coordinates as a list of float values (same as point attribute)

Return type:

list[float]

Note

This method is similar to the x method in SciPy.optimize results.