pymoo icon indicating copy to clipboard operation
pymoo copied to clipboard

AGEMOEA2 has too many error when benchmarked by test problems.

Open muazhari opened this issue 1 year ago • 2 comments

from pymoo.termination import get_termination
from pymoo.algorithms.moo.age import AGEMOEA
from pymoo.algorithms.moo.sms import SMSEMOA
from pymoo.util.ref_dirs import get_reference_directions, LayerwiseRieszEnergyReferenceDirectionFactory
from pymoo.algorithms.moo.ctaea import CTAEA
from pymoo.algorithms.moo.age2 import AGEMOEA2
from pymoo.core.variable import Binary, Choice, Integer, Real
from pymoo.core.problem import LoopedElementwiseEvaluation, RayParallelization
from pymoo.algorithms.moo.nsga2 import RankAndCrowding, NSGA2
from pymoo.core.mixed import MixedVariableGA, MixedVariableMating, MixedVariableDuplicateElimination, \
    MixedVariableSampling
from pymoo.optimize import minimize

from pymoo.problems.many import C1DTLZ1, DC1DTLZ1, DC1DTLZ3, DC2DTLZ1, DC2DTLZ3, DC3DTLZ1, DC3DTLZ3, C1DTLZ3, \
    C2DTLZ2, C3DTLZ1, C3DTLZ4, DTLZ1
from pymoo.core.problem import ElementwiseProblem
import ray
import numpy as np


benchmark_algorithms = [
    # SMSEMOA(),
    AGEMOEA2(),
]


benchmark_problems = [
    C1DTLZ1, DC1DTLZ1, DC1DTLZ3, DC2DTLZ1, DC2DTLZ3, DC3DTLZ1, DC3DTLZ3, C1DTLZ3, C2DTLZ2, C3DTLZ1, C3DTLZ4
]



def run_benchmark(problem, algorithm):
    res = minimize(
        problem(),
        algorithm,
        verbose=True,
        seed=1
    )

    result = {
        "problem": problem,
        "algorithm": algorithm,
        "result": res
    }

    return result
    
tasks = []
for problem in benchmark_problems:
    for algorithm in benchmark_algorithms:
        tasks.append(ray.remote(run_benchmark).remote(problem, algorithm))
result = ray.get(tasks) 

Output: image

muazhari avatar Jul 17 '24 06:07 muazhari

AGE-MOEA2 was added here #272.

@apanichella Have you tested the implementation on these test problems as well?

blankjul avatar Jul 22 '24 00:07 blankjul

I did some tests for constraints problem in the original MATLAB implementation and it worked well. I think that happens when there are not enough points for the derivative.

I am doing some tests to check this. A fix will follow later today :)

apanichella avatar Aug 13 '24 12:08 apanichella