Table Of Contents

Previous topic

genetic_algorithm.py

Next topic

jlp.py

This Page

hero.py

class Hero(Optimizer):

SIMO metaheuristic HERO optimization algorithm.

Initialize with arameters:

repeats=10
initial_solutions=100
maximum_iterations=100

def __init__(self, logger, logname, optlogger, taskdef, simdbin, opdbin, simdbout, opdbout, **keywords):

Initialize optimizer:

>>> epsilon = 0.00001
>>> from simo.optimization.hero import HERO
>>> execfile('optimization/test/mocks4optimizer.py')
>>> chart_path = 'optimization/test'

>>> hero = HERO(logger, logname, taskdef, simdbin, simdbout, False, False,
...             False, chart_path, True, 'test', True,
...             keyword1='test-kw')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "repeats" missing!')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "initial_solutions" missing!')
Called Logger.log_message(
    'optimization-test',
    'ERROR',
    'Parameter "maximum_iterations" missing!')

>>> hero = HERO(logger, logname, taskdef, simdbin, simdbout, False, False,
...             False, chart_path, True, 'test', True,
...             repeats=2,
...             initial_solutions=3,
...             maximum_iterations=2)

def optimize(self):

Run HERO optimization algorithm

def _run_HERO(self):

Run HERO algorithm for a single iteration/repeat

>>> hero._stat_logger = ologger  # replace stat logger with a mock
>>> hero._data = omatrix2  # replace data handler with another mock
>>> hero._analyze_data()  
Called OMatrix.analyze_data(
    <Mock ... SimInputDB>,
    <bound method HERO._add_info of
    <simo.optimization.hero.HERO object at ...>>)
True
>>> hero.set_data(0)  
Called OMatrix.construct_data(0)
True
>>> hero._run_HERO()  
Called OMatrix.solution_feasibility(array([0, 0, 0, 0, 0]))
Called OMatrix.solution_utility(array([0, 0, 0, 0, 0]))
Called OMatrix.compare_utilities(None, 1.0)
Called OMatrix.solution_feasibility(array([1, 0, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 0, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 0, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 0, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 2, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 2, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 3, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 3, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 4, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 4, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 5, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 0, 0, 0]))
Called OMatrix.solution_utility(array([1, 5, 0, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 1, 0, 0]))
Called OMatrix.solution_utility(array([1, 5, 1, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 0, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 0, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 1, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 1, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 2, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 2, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OLogger.add_round(array([1, 5, 2, 3, 0]), 1.0, 1.0)
Called OMatrix.solution_feasibility(array([0, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([0, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 0, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 0, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 2, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 2, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 3, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 3, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 4, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 4, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 0, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 0, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 1, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 1, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 0, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 0, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 1, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 1, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 2, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 2, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OMatrix.solution_feasibility(array([1, 5, 2, 3, 0]))
Called OMatrix.solution_utility(array([1, 5, 2, 3, 0]))
Called OMatrix.compare_utilities(1.0, 1.0)
Called OLogger.add_round(array([1, 5, 2, 3, 0]), 1.0, 1.0)