moead_framework.problem.combinatorial.rmnk.Rmnk

class moead_framework.problem.combinatorial.rmnk.Rmnk(instance_file=None, rho=None, m=None, n=None, k=None, links=None, tables=None)[source]

Bases: moead_framework.problem.problem.Problem

Implementation of the multiobjective NK landscapes with tunable objective correlation. The problem is compatible with files generated by the mocobench generator http://mocobench.sourceforge.net/index.php?n=Problem.RMNK

Example:

>>> from moead_framework.problem.combinatorial import Rmnk
>>>
>>> # The file is available here : https://github.com/moead-framework/data/blob/master/problem/RMNK/Instances/rmnk_0_2_100_1_0.dat
>>> # Others instances are available here : https://github.com/moead-framework/data/tree/master/problem/RMNK/Instances
>>> instance_file = "moead_framework/test/data/instances/rmnk_0_2_100_1_0.dat"
>>> rmnk = Rmnk(instance_file=instance_file)
>>>
>>> # Generate a new solution
>>> solution = rmnk.generate_random_solution()
>>>
>>> # Print all decision variables of the solution
>>> print(solution.decision_vector)
>>>
>>> # Print all objectives values of the solution
>>> print(solution.F)
__init__(instance_file=None, rho=None, m=None, n=None, k=None, links=None, tables=None)[source]

Constructor of the problem

Parameters

objective_number – {integer}

Methods

__init__([instance_file, rho, m, n, k, …])

Constructor of the problem

evaluate(x)

Evaluate the given solution for the current problem and store the outcome

f(function_id, decision_vector)

Evaluate the decision_vector for the objective function_id

generate_random_solution()

Generate a random solution for the current problem

init_with_data(rho, m, n, k, links, tables)

init_with_instance_file(instance_file)

load_links(file_content)

Load links from the instance file

load_tables(file_content)

Load tables from the instance file

sigma(function_id, solution_array, item)

Compute the sigma value

dtype

alias of builtins.float

evaluate(x: Union[moead_framework.solution.base.Solution, Sequence]) → moead_framework.solution.one_dimension_solution.OneDimensionSolution

Evaluate the given solution for the current problem and store the outcome

Parameters

x – A {Solution} containing all decision variables

Returns

OneDimensionSolution

f(function_id: int, decision_vector: numpy.ndarray)[source]

Evaluate the decision_vector for the objective function_id

Parameters
  • function_id – {integer} index of the objective

  • decision_vector – {OneDimensionSolution} solution to evaluate

Returns

{float} fitness value

generate_random_solution()[source]

Generate a random solution for the current problem

Returns

{OneDimensionSolution}

Load links from the instance file

Parameters

file_content – {list<float>} content of the instance file

Returns

{integer} the number of line

load_tables(file_content)[source]

Load tables from the instance file

Parameters

file_content – {list<float>} content of the instance file

Returns

sigma(function_id, solution_array, item)[source]

Compute the sigma value

Parameters
  • function_id – {integer} index of the objective function

  • solution_array – {list<integer>} representation of the solution

  • item – {integer} index of the variable

Returns