Skip to content

grasp_ils_vnd_pr

givp.grasp_ils_vnd_pr

grasp_ils_vnd_pr(func: ObjectiveFn, bounds: BoundsLike, *, num_vars: int | None = None, minimize: bool | None = None, direction: str | None = None, config: GraspIlsVndConfig | None = None, initial_guess: Sequence[float] | None = None, iteration_callback: IterationCallback | None = None, seed: int | None = None, verbose: bool = False) -> OptimizeResult

Minimize (or maximize) a scalar function with GRASP-ILS-VND-PR.

Parameters:

Name Type Description Default
func ObjectiveFn

Objective callable mapping a 1-D np.ndarray to a scalar.

required
bounds BoundsLike

Either a sequence of (low, high) pairs (SciPy style) or a (lower, upper) tuple of two equally-sized sequences.

required
num_vars int | None

Optional explicit number of variables. Inferred from bounds when omitted.

None
minimize bool | None

Boolean flag for the optimization sense. True minimizes, False maximizes. Preferred over direction for new code.

None
direction str | None

'minimize' or 'maximize' (SciPy/Optuna style). Kept for backward compatibility. Ignored when minimize is given. Defaults to 'minimize' when neither flag is supplied.

None
config GraspIlsVndConfig | None

Algorithm hyper-parameters. GraspIlsVndConfig() is used when omitted. Any sense field on config is overridden by the explicit minimize/direction kwargs when provided.

None
initial_guess Sequence[float] | None

Optional warm-start vector, evaluated and inserted in the elite pool before the first iteration.

None
iteration_callback IterationCallback | None

Optional callable invoked once per outer iteration with (iteration, best_cost_in_core_sign, best_solution).

None
seed int | None

Optional integer seed for full reproducibility. When given, every internal RNG is derived deterministically from this seed, so two calls with the same inputs return the same result.

None
verbose bool

If True, prints progress information to stdout.

False

Returns:

Name Type Description
OptimizeResult OptimizeResult

Dataclass with x (best solution), fun (best

OptimizeResult

objective value in the user's original sign) and metadata.

Raises:

Type Description
ValueError

If both minimize and direction are passed with conflicting values, or if direction is not one of 'minimize' / 'maximize'.