class documentation

quick hack versatile base class

Method __call__ return penalty or list of penalties, by default zero(s).
Method __init__ bounds are not copied, but possibly modified and put into a normalized form: bounds can be None or [lb, ub] where lb and ub are either None or a vector (which can have None entries).
Method get_bound return lower and upper bound of variable with index index
Method get_bounds get_bounds('lower', 8) returns the lower bounds in 8-D
Method has_bounds return True if any variable is bounded
Method idx_out_of_bounds return index list of out-of-bound values in x.
Method inverse inverse of repair if it exists, at least it should hold repair == repair o inverse o repair
Method is_in_bounds not yet tested
Method repair projects infeasible values on the domain bound, might be overwritten by derived class
Method to_dim_times_two return boundaries in format [[lb0, ub0], [lb1, ub1], ...], as used by BoxConstraints... class.
Method update end-iteration callback of boundary handler (abstract/empty)
Instance Variable bounds Undocumented
Method _get_bounds ib == 0/1 means lower/upper bound, return a vector of length dimension
def __call__(self, solutions, *args, **kwargs):

return penalty or list of penalties, by default zero(s).

This interface seems too specifically tailored to the derived BoundPenalty class, it should maybe change.

def __init__(self, bounds):

bounds are not copied, but possibly modified and put into a normalized form: bounds can be None or [lb, ub] where lb and ub are either None or a vector (which can have None entries).

Generally, the last entry is recycled to compute bounds for any dimension.

def get_bound(self, index):

return lower and upper bound of variable with index index

def get_bounds(self, which, dimension):

get_bounds('lower', 8) returns the lower bounds in 8-D

def has_bounds(self):

return True if any variable is bounded

def idx_out_of_bounds(self, x):

return index list of out-of-bound values in x.

if bounds.idx_out_of_bounds evaluates to True if and only if x is out of bounds.

def inverse(self, y, copy_if_changed=True):

inverse of repair if it exists, at least it should hold repair == repair o inverse o repair

def is_in_bounds(self, x):

not yet tested

def repair(self, x, copy_if_changed=True):

projects infeasible values on the domain bound, might be overwritten by derived class

def to_dim_times_two(self, bounds):

return boundaries in format [[lb0, ub0], [lb1, ub1], ...], as used by BoxConstraints... class.

def update(self, *args, **kwargs):

end-iteration callback of boundary handler (abstract/empty)

bounds =

Undocumented

def _get_bounds(self, ib, dimension):

ib == 0/1 means lower/upper bound, return a vector of length dimension