How to define a multi-objective problem for nsga2/3?

38 views
Skip to first unread message

Alan Zandie

unread,
Jan 27, 2025, 7:22:39 AMJan 27
to deap-users
Hello,

I have been reading through the tutorials available for DEAP package, there are examples for nsga 2/3 where an already defined problem (named zdt1..zdt4), but I am looking for a way to define my problem instead of the code below:
----------
PROBLEM = "dtlz2"
NOBJ = 3
K = 10
NDIM = NOBJ + K - 1
P = 12
H = factorial(NOBJ + P - 1) / (factorial(P) * factorial(NOBJ - 1))
BOUND_LOW, BOUND_UP = 0.0, 1.0
problem = pymop.factory.get_problem(PROBLEM, n_var=NDIM, n_obj=NOBJ)
------------
I have created this below:

def MIMO(data):

    Q = data[0]
    ....my calculations here....
    return Visibility, Temperature, Velocity, Pressure, Q
     
PROBLEM = "MIMO"
NOBJ = 1
K = 10
NDIM = NOBJ + K - 1
P = 12
H = factorial(NOBJ + P - 1) / (factorial(P) * factorial(NOBJ - 1))
BOUND_LOW, BOUND_UP = 0.0, 1.0
problem = pymop.factory.get_problem(PROBLEM, n_var=NDIM, n_obj=NOBJ)
--------------

but it says my problem "mimo" is not defined.
I am wondering if you could help me with this issue, thank you

François-Michel De Rainville

unread,
Jan 27, 2025, 1:06:22 PMJan 27
to deap-...@googlegroups.com

This part is just for the toy problems, you should remove the pymop line.


--
You received this message because you are subscribed to the Google Groups "deap-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deap-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/deap-users/55dad890-6f9e-4746-925c-82b355726310n%40googlegroups.com.

Alan Zandie

unread,
Jan 28, 2025, 3:51:34 AMJan 28
to deap-users
Could you please expand a bit more? thank you

François-Michel De Rainville

unread,
Jan 28, 2025, 8:04:09 AMJan 28
to deap-...@googlegroups.com

pymop is a multi objective framework that provides toy problems. This line only serve to create the problem within pymop. That's where your objective function should be.


Warriors Defence Academy

unread,
Apr 21, 2025, 4:37:05 AMApr 21
to deap-users

Sure! Here's how to define a multi-objective problem for NSGA-II/NSGA-III in short:


✅ Steps to Define a Multi-Objective Problem:
  1. Decision Variables:
    Define variables with type and bounds.
    Example: x ∈ [0, 1], y ∈ [0, 1]

  2. Objective Functions:
    Define 2 or more conflicting objectives.
    Example:

    • f1(x, y) = x² + y² (minimize)

    • f2(x, y) = (x - 1)² + (y - 1)² (minimize)

  3. Constraints (Optional):
    Define any rules the solution must follow.
    Example: x + y ≤ 1

  4. Encoding & Evaluation:
    Represent the problem in code (e.g., DEAP, pymoo, Platypus).
    Evaluation function should return a tuple: (f1, f2)

  5. Choose Algorithm:

    • Use NSGA-II for 2–3 objectives

    • Use NSGA-III for 4+ objectives (requires reference points)


Thank You
Warriors 

Reply all
Reply to author
Forward
0 new messages