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:
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. :-)
Hi @SepShr,
I found that the current implementation works well when the scale of
x
andy
gets larger. For example, consider the following code.Basically,
f1
andf2
are the same, except thatf1
is maximized when(x=5, y=10)
whereasf2
is maximized when(x=0.05, y=0.1)
. Interestingly, the current implementation works very well forf1
(see f1-gen50.txt) but very poor forf2
(see f2-gen50.txt).It means the overall implementation is okay, but the granularity of varying
x
andy
(i.e., individuals) is too coarse to solvef2
. 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:
Notice that I only replaced
c[0][0]
withc[0][0]/10
andc[1][0]
withc[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. :-)