SepShr / MLCSHE

This repo houses the ML-Component Systemic Hazard Envelope project, or MILSCHE (pronounced /'mɪlʃ/).
MIT License
3 stars 0 forks source link

granularity of breeding? #23

Closed donghwan-shin closed 3 years ago

donghwan-shin commented 3 years ago

Hi @SepShr,

I found that the current implementation works well when the scale of x and y gets larger. For example, consider the following code.

def evaluate_joint_fitness(c):
    x = c[0][0]
    y = c[1][0]
    f1 = 1 - 100*pow(x-5, 2) - 100*pow(y-10, 2)  # global maximum = 1 when x = 5 and y = 10
    # f2 = 1 - 100*pow(x - 0.05, 2) - 100*pow(y - 0.1, 2)  # global maximum = 1 when x = 0.05 and y = 0.1
    return (f1, )

Basically, f1 and f2 are the same, except that f1 is maximized when (x=5, y=10) whereas f2 is maximized when (x=0.05, y=0.1). Interestingly, the current implementation works very well for f1 (see f1-gen50.txt) but very poor for f2 (see f2-gen50.txt).

It means the overall implementation is okay, but the granularity of varying x and y (i.e., individuals) is too coarse to solve f2. I believe there should be some parameters that we can control to adjust the granularity for a given problem.

Anyway, based on the same idea, I tried to slightly change the MTQ problem as follows:

...
    f_1 = h_1 * \
        (1 - ((16.0/s_1) * pow((c[0][0]/10 - x_1), 2)) -
         ((16.0/s_1) * pow((c[1][0]/10 - y_1), 2)))
...
    f_2 = h_2 * \
        (1 - ((16.0/s_2) * pow((c[0][0]/10 - x_2), 2)) -
         ((16.0/s_2) * pow((c[1][0]/10 - y_2), 2)))
...

Notice that I only replaced c[0][0] with c[0][0]/10 and c[1][0] with c[1][0]/10 to compensate the coarse-grained breeding. Then, as you can see here (MTQ-modified-gen50.txt), the algorithm works better!

I guess you can figure out how to control the granularity in the implementation. :-)