jMetal / jMetalPy

A framework for single/multi-objective optimization with metaheuristics
https://jmetal.github.io/jMetalPy/index.html
MIT License
498 stars 150 forks source link

New Problem sets #49

Closed ClaudioLucioLopes closed 4 years ago

ClaudioLucioLopes commented 4 years ago

How do I extend the problem class. I need the WFG problem sets and the MaF as well? Is there any plans to incorporate these problem sets in the jMetalPy?

ajnebro commented 4 years ago

Hi Claudio. We don't have plans to incorporate the WFG and MaF problems immediately into jMetalPy.

To add new problems you can follow as example the implementation of some of the problems already provided. For instance, the code of the ZDT1 is the following:

class ZDT1(FloatProblem):
    """ Problem ZDT1.

    .. note:: Bi-objective unconstrained problem. The default number of variables is 30.
    .. note:: Continuous problem having a convex Pareto front
    """

    def __init__(self, number_of_variables: int=30):
        """ :param number_of_variables: Number of decision variables of the problem.
        """
        super(ZDT1, self).__init__()
        self.number_of_variables = number_of_variables
        self.number_of_objectives = 2
        self.number_of_constraints = 0

        self.obj_directions = [self.MINIMIZE, self.MINIMIZE]
        self.obj_labels = ['x', 'y']

        self.lower_bound = self.number_of_variables * [0.0]
        self.upper_bound = self.number_of_variables * [1.0]

    def evaluate(self, solution: FloatSolution) -> FloatSolution:
        g = self.eval_g(solution)
        h = self.eval_h(solution.variables[0], g)

        solution.objectives[0] = solution.variables[0]
        solution.objectives[1] = h * g

        return solution

You can use it as a template. Anyway, if you have any question about this issue, please feel free to comment it to us.