mach_opt package
mach_opt module
Module holding classes required for design optimization.
This module holds the classes required for optimizing a design using pygmo in MachEval.
- class mach_opt.mach_opt.DataHandler(archive_filepath, designer_filepath)
Bases:
objectParent class for data handlers
- get_archive_data()
- get_pareto_data()
Return data of Pareto optimal designs
- get_pareto_fitness_freevars()
Extract fitness and free variables for Pareto optimal designs
- load_from_archive()
Load data from Pickle optimization archive
- load_object(filename)
load object from specified filename
- save_designer(designer)
Save designer used in optimization
- save_object(obj, filename)
Save object to specified filename
- save_to_archive(x, design, full_results, objs)
Save machine evaluation data to optimization archive using Pickle
- Parameters:
x – Free variables used to create design
design – Created design
full_results – Input, output, and results corresponding to each step of an evaluator
objs – Fitness values corresponding to a design
- class mach_opt.mach_opt.Design
Bases:
ABCParent class for all designs
- class mach_opt.mach_opt.DesignOptimizationMOEAD(design_problem)
Bases:
object- initial_pop(pop_size)
- load_pop(filepath, pop_size)
- run_optimization(pop, gen_size, filepath=None)
- save_pop(filepath, pop)
- class mach_opt.mach_opt.DesignProblem(designer: Designer, evaluator: Evaluator, design_space: DesignSpace, dh: DataHandler, invalid_design_objs=None)
Bases:
objectClass to create, evaluate, and optimize designs
- designer
Objects which convert free variables to a design.
- evaluator
Objects which evaluate the performance of different designs.
- design_space
Objects which characterizes the design space of the optimization.
- dh
Data handlers which enable saving optimization results and its resumption.
- invalid_design_objs
List of (large) objective values to use for invalid designs
- fitness(x: tuple) tuple
Calculates the fitness or objectives of each design based on evaluation results.
This function creates, evaluates, and calculates the fitness of each design generated by the optimization algorithm. It also saves the results and handles invalid designs.
- Parameters:
x – The list of free variables required to create a complete design
- Returns:
Returns the fitness of each design
- Return type:
objs
- Raises:
e – The errors encountered during design creation or evaluation apart from the InvalidDesign error
- get_bounds()
Returns bounds for optimization problem
- get_nobj()
Returns number of objectives of optimization problem
- class mach_opt.mach_opt.DesignSpace(*args, **kwargs)
Bases:
ProtocolParent class for a optimization DesignSpace classes
- abstract bounds() tuple
- abstract check_constraints(full_results) bool
- abstract get_objectives(valid_constraints, full_results) tuple
- abstract n_obj() int
- class mach_opt.mach_opt.Designer(*args, **kwargs)
Bases:
ProtocolParent class for all designers
- class mach_opt.mach_opt.Evaluator(*args, **kwargs)
Bases:
ProtocolParent class for all design evaluators
- exception mach_opt.mach_opt.InvalidDesign(message='Invalid Design')
Bases:
ExceptionException raised for invalid designs
- class mach_opt.mach_opt.OptiData(x, design, full_results, objs)
Bases:
objectObject template for serializing optimization results with Pickle