Skip to content

Result

OptimizeResult

givp.OptimizeResult dataclass

Container for optimization output, modeled after scipy.optimize.OptimizeResult.

Attributes:

Name Type Description
x NDArray[float64]

Best solution vector found, in the user's variable space.

fun float

Objective value at x, in the user's original sign (i.e., already restored when direction='maximize').

nit int

Number of GRASP outer iterations executed.

nfev int

Number of objective function evaluations.

success bool

Whether at least one feasible solution was produced.

message str

Human-readable termination reason.

direction str

'minimize' or 'maximize'.

meta AlgorithmMeta

Additional algorithm-specific information (cache stats, etc.).

to_dict

to_dict() -> dict[str, Any]

Serialize to a JSON-safe dict with typed, schema-validated fields.

All values are Python primitives — no numpy types. The termination field is a TerminationReason enum value (closed set), which prevents prompt-injection via free-form message strings when passed to LLM agents.


TerminationReason

givp.TerminationReason

Bases: str, Enum

Closed set of termination reasons — safe to pass to LLM agents.

from_message classmethod

from_message(message: str) -> TerminationReason

Map a free-form termination message to the nearest enum value.