IntegerConstraint

class ioh.iohcpp.IntegerConstraint(self, fn: object, weight: float = 1.0, exponent: float = 1.0, enforced: ioh.iohcpp.ConstraintEnforcement = ConstraintEnforcement.SOFT, name: str = '')

Bases: AbstractIntegerConstraint

General Constraint, defined by a function

Parameters:
  • f (numpy.ndarray -> float) – A function that computes the violation of a point (a new numpy array, float64 for real and int32 for integer problems)

  • weight (float) – The weight given to the violation when penalizing the objective function

  • exponent (float) – The exponent given to the violation when penalizing the objective function

  • enforced (ConstraintEnforcement) – how the constraint should be enforced

  • name (str) – name of the constraint

Attributes Summary

enforced

The type of constraint enforcement applied.

exponent

The exponent for this constraint

weight

The weight given to this constraint

Methods Summary

__call__([order, device])

compute_violation([order, device])

is_feasible([order, device])

penalize(self, arg, /)

penalty(self)

violation(self)

Attributes Documentation

enforced

The type of constraint enforcement applied.

exponent

The exponent for this constraint

weight

The weight given to this constraint

Methods Documentation

__call__(self, arg0: ndarray[shape=(*), order='C', device='cpu'], arg1: float, /) → float
__call__(self, arg0: collections.abc.Sequence[int], arg1: float, /) → float
compute_violation(self, arg: ndarray[shape=(*), order='C', device='cpu'], /) → bool
compute_violation(self, arg: collections.abc.Sequence[int], /) → bool
is_feasible(self, arg: ndarray[shape=(*), order='C', device='cpu'], /) → bool
is_feasible(self, arg: collections.abc.Sequence[int], /) → bool
penalize(self, arg: float, /) → float
penalty(self) → float
violation(self) → float