rollo.constraints

Module Contents

class rollo.constraints.Constraints(output_dict, input_constraints, toolbox)

The Constraints class contains methods to initialize constraints defined in the input file and applies the constraints by removing individuals that do not meet the constraint.

Parameters
  • output_dict (OrderedDict) – Ordered dict of output variables as keys and solvers as values

  • input_constraints (dict) – constraints sub-dictionary from input file

  • toolbox (deap.base.Toolbox object) – DEAP toolbox populated with user-defined genetic algorithm parameters

constraints

list of constraints information

Type

list

numbered_oup_dict

output parameter name as key and ordered position as value

Type

dict

ops

dict of accepted operators

Type

dict

toolbox

DEAP toolbox populated with user-defined genetic algorithm parameters

Type

deap.base.Toolbox object

output_dict_numbered(self, output_dict)

Returns dictionary of output variables and their corresponding index

Parameters

output_dict (OrderedDict) – Ordered dict of output variables as keys and solvers as values

Returns

output parameter name as key and ordered position as value

Return type

dict

constraints_list(self, input_constraints)

Returns list of constraints information

Parameters

input_constraints (dict) – constraints sub-dictionary from input file

Returns

constraints_list – list of constraints information

Return type

list

apply_constraints(self, pop)

Removes individuals in population that fail to meet constraints

Parameters

pop (list) – list of deap.creator.Ind for that generation

Returns

list of deap.creator.Ind for that generation with individuals that fail to meet constraints removed

Return type

list