LSSurrogateParameters Class

class localsolver.LSSurrogateParameters

Parameters specific to the surrogate modeling feature. Surrogate parameters can be used to query and set the evaluation budget and the evaluation points of the associated external function.

Since:

9.5

See:

LSExternalContext.enable_surrogate_modeling()

Summary

Attributes

evaluation_limit

Maximum number of evaluations.

evaluation_points

List of the evaluation points of the external function.

Methods

get_evaluation_limit

Returns the maximum number of evaluations.

set_evaluation_limit

Sets the maximum number of evaluations.

create_evaluation_point

Creates an evaluation point for the external function.

get_nb_evaluation_points

Returns the number of evaluation points.

get_evaluation_point

Returns the evaluation point at the given position.

Instance methods

LSSurrogateParameters.get_evaluation_limit()

Returns the maximum number of evaluations. By default, the maximum number of evaluations is set to the largest positive integer on 32 bits, that is 2^32-1 = 2,147,483,647 > 10^9.

Returns:

Maximum number of evaluations.

LSSurrogateParameters.set_evaluation_limit(evaluation_limit)

Sets the maximum number of evaluations. By default, the maximum number of evaluations is set to the largest positive integer on 32 bits, that is 2^32-1 = 2,147,483,647 > 10^9. Only allowed in states Modeling or Stopped.

Parameters:

evaluationLimit – Maximum number of evaluations.

LSSurrogateParameters.create_evaluation_point()

Creates an evaluation point for the external function. It consists of a list of values corresponding to the function’s arguments and return value. Evaluation points are used to specify known points for a function in advance. It can be useful to warm-start the solver when the function is particularly expensive to evaluate, or if you already have a good estimate of the optimal point. Only allowed in states Modeling or Stopped.

Returns:

Evaluation point.

Return type:

LSEvaluationPoint

LSSurrogateParameters.get_nb_evaluation_points()

Returns the number of evaluation points.

Returns:

Number of evaluation points.

Return type:

int

LSSurrogateParameters.get_evaluation_point(pos)

Returns the evaluation point at the given position.

Parameters:

pos – Position of the evaluation point.

Returns:

Evaluation point at the given position.

Return type:

LSEvaluationPoint

Instance attributes

All get/set methods have their attribute counterpart. You can use them as shortcuts to improve the readability of your models and codes.

LSSurrogateParameters.evaluation_limit

Maximum number of evaluations. It is a shortcut for get_evaluation_limit() and set_evaluation_limit()

LSSurrogateParameters.evaluation_points

List of the evaluation points of the external function. This attribute is read-only. The returned object is iterable, supports the len function and can be indexed with integers. It is a shortcut for get_evaluation_point() and get_nb_evaluation_points() methods.