saealib.Evaluator#

class saealib.Evaluator[source]#

Bases: ABC

Base class for batch evaluators.

Methods

__init__

acknowledge

Acknowledge one contiguous update sequence.

can_reattach

Return whether pending work can be restored after checkpoint load.

cancel

Cancel submitted work when the backend supports cancellation.

collect

Return unacknowledged updates for a handle.

contract

Return the evaluator family contract.

detach

Detach work whose result must no longer be delivered.

evaluate_batch

Evaluate a batch of design vectors.

evaluate_request

Evaluate a request, including its public metadata boundary.

has_partial_lifecycle_override

Return whether lifecycle adapter methods are only partly overridden.

reattach

Restore a pending request or raise when unsupported.

submit

Submit a request through the synchronous adapter.

supports_batch_rollback

Return whether failed batch submission can be rolled back.

Method Details

Evaluator.__init__()#
Evaluator.acknowledge(handle, sequence)[source]#

Acknowledge one contiguous update sequence.

Parameters:
Return type:

None

Evaluator.can_reattach(pending)[source]#

Return whether pending work can be restored after checkpoint load.

Parameters:

pending (PendingEvaluation)

Return type:

bool

Evaluator.cancel(handle)[source]#

Cancel submitted work when the backend supports cancellation.

Parameters:

handle (EvaluationHandle)

Return type:

bool

Evaluator.collect(handle, *, wait=True)[source]#

Return unacknowledged updates for a handle.

Parameters:
Return type:

list[EvaluationUpdate]

Evaluator.contract()[source]#

Return the evaluator family contract.

Return type:

ComponentContract

Evaluator.detach(handle)[source]#

Detach work whose result must no longer be delivered.

Parameters:

handle (EvaluationHandle)

Return type:

bool

abstractmethod Evaluator.evaluate_batch(x, problem)[source]#

Evaluate a batch of design vectors.

Parameters:
  • x (np.ndarray) – Design vectors to evaluate. shape = (n, dim)

  • problem (Problem) – The optimization problem providing the objective and constraints.

Returns:

Batched objective values, raw constraint values, and violations.

Return type:

EvaluationResult

Evaluator.evaluate_request(request, problem)[source]#

Evaluate a request, including its public metadata boundary.

Parameters:
Return type:

EvaluationResult

classmethod Evaluator.has_partial_lifecycle_override()[source]#

Return whether lifecycle adapter methods are only partly overridden.

Return type:

bool

Evaluator.reattach(pending, problem)[source]#

Restore a pending request or raise when unsupported.

Parameters:
Return type:

EvaluationHandle

Evaluator.submit(request, problem)[source]#

Submit a request through the synchronous adapter.

Parameters:
Return type:

EvaluationHandle

Evaluator.supports_batch_rollback()[source]#

Return whether failed batch submission can be rolled back.

Return type:

bool