opytimizer.optimizers.evolutionary.hs

Harmony Search-based algorithms.

class opytimizer.optimizers.evolutionary.hs.HS(params: Optional[Dict[str, Any]] = None)

A HS class, inherited from Optimizer.

This is the designed class to define HS-related variables and methods.

References

Z. W. Geem, J. H. Kim, and G. V. Loganathan. A new heuristic optimization algorithm: Harmony search. Simulation (2001).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
HMCR

Harmony memory considering rate.

PAR

Pitch adjusting rate.

bw

Bandwidth parameter.

_generate_new_harmony(agents: List[opytimizer.core.agent.Agent]) → opytimizer.core.agent.Agent

It generates a new harmony.

Parameters:agents – List of agents.
Returns:A new agent (harmony) based on music generation process.
Return type:(Agent)
update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function) → None

Wraps Harmony Search over all agents and variables.

Parameters:
  • space – Space containing agents and update-related information.
  • function – A Function object that will be used as the objective function.
class opytimizer.optimizers.evolutionary.hs.IHS(params: Optional[Dict[str, Any]] = None)

An IHS class, inherited from HS.

This is the designed class to define IHS-related variables and methods.

References

M. Mahdavi, M. Fesanghary, and E. Damangir. An improved harmony search algorithm for solving optimization problems. Applied Mathematics and Computation (2007).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
PAR_min

Minimum pitch adjusting rate.

PAR_max

Maximum pitch adjusting rate.

bw_min

Minimum bandwidth parameter.

bw_max

Maximum bandwidth parameter.

update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function, iteration: int, n_iterations: int) → None

Wraps Improved Harmony Search over all agents and variables.

Parameters:
  • space – Space containing agents and update-related information.
  • function – A Function object that will be used as the objective function.
  • iteration – Current iteration.
  • n_iterations – Maximum number of iterations.
class opytimizer.optimizers.evolutionary.hs.GHS(params: Optional[Dict[str, Any]] = None)

A GHS class, inherited from IHS.

This is the designed class to define GHS-related variables and methods.

References

M. Omran and M. Mahdavi. Global-best harmony search. Applied Mathematics and Computation (2008).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
_generate_new_harmony(agents: List[opytimizer.core.agent.Agent]) → opytimizer.core.agent.Agent

It generates a new harmony.

Parameters:agents – List of agents.
Returns:A new agent (harmony) based on music generation process.
Return type:(Agent)
class opytimizer.optimizers.evolutionary.hs.SGHS(params: Optional[Dict[str, Any]] = None)

A SGHS class, inherited from HS.

This is the designed class to define SGHS-related variables and methods.

References

Q.-K. Pan, P. Suganthan, M. Tasgetiren and J. Liang. A self-adaptive global best harmony search algorithm for continuous optimization problems. Applied Mathematics and Computation (2010).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
HMCR

Harmony memory considering rate.

PAR

Pitch adjusting rate.

LP

Learning period.

HMCRm

Mean harmony memory considering rate.

PARm

Mean pitch adjusting rate.

bw_min

Minimum bandwidth parameter.

bw_max

Maximum bandwidth parameter.

lp

Current learning period.

HMCR_history

Historical harmony memory considering rates.

PAR_history

Historical pitch adjusting rates.

compile(space: opytimizer.core.space.Space) → None

Compiles additional information that is used by this optimizer.

Parameters:space – A Space object containing meta-information.
_generate_new_harmony(agents: List[opytimizer.core.agent.Agent]) → opytimizer.core.agent.Agent

It generates a new harmony.

Parameters:agents – List of agents.
Returns:A new agent (harmony) based on music generation process.
Return type:(Agent)
update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function, iteration: int, n_iterations: int) → None

Wraps Self-Adaptive Global-Best Harmony Search over all agents and variables.

Parameters:
  • space – Space containing agents and update-related information.
  • function – A Function object that will be used as the objective function.
  • iteration – Current iteration.
  • n_iterations – Maximum number of iterations.
class opytimizer.optimizers.evolutionary.hs.NGHS(params: Optional[Dict[str, Any]] = None)

A NGHS class, inherited from HS.

This is the designed class to define NGHS-related variables and methods.

References

D. Zou, L. Gao, J. Wu and S. Li. Novel global harmony search algorithm for unconstrained problems. Neurocomputing (2010).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
pm

Mutation probability.

_generate_new_harmony(best: opytimizer.core.agent.Agent, worst: opytimizer.core.agent.Agent) → opytimizer.core.agent.Agent

It generates a new harmony.

Parameters:
  • best – Best agent.
  • worst – Worst agent.
Returns:

A new agent (harmony) based on music generation process.

Return type:

(Agent)

update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function) → None

Wraps Novel Global Harmony Search over all agents and variables.

Parameters:
  • space – Space containing agents and update-related information.
  • function – A Function object that will be used as the objective function.
class opytimizer.optimizers.evolutionary.hs.GOGHS(params: Optional[Dict[str, Any]] = None)

A GOGHS class, inherited from NGHS.

This is the designed class to define GOGHS-related variables and methods.

References

Z. Guo, S. Wang, X. Yue and H. Yang. Global harmony search with generalized opposition-based learning. Soft Computing (2017).

__init__(params: Optional[Dict[str, Any]] = None) → None

Initialization method.

Parameters:params – Contains key-value parameters to the meta-heuristics.
_generate_opposition_harmony(new_agent: opytimizer.core.agent.Agent, agents: List[opytimizer.core.agent.Agent]) → opytimizer.core.agent.Agent

It generates a new opposition-based harmony.

Parameters:
  • new_agent – Newly created agent.
  • agents – List of agents.
Returns:

A new agent (harmony) based on opposition generation process.

Return type:

(Agent)

update(space: opytimizer.core.space.Space, function: opytimizer.core.function.Function) → None

Wraps Generalized Opposition Global-Best Harmony Search over all agents and variables.

Parameters:
  • space – Space containing agents and update-related information.
  • function – A Function object that will be used as the objective function.