max
√
x
1
+
√
x
2
+
√
x
3
subject to:
x
2
1
+ 2x
2
2
+ 3x
2
3
≤ 1
x
1
, x
2
, x
3
≥ 0
(1)
Let us code each solution by a chromosome V = (x
1
, x
2
, x
3
). Then the subfunction of checking
the feasibility of V may be written as follows,
If (x
1
< 0||x
2
< 0||x
3
< 0) return 0;
If (x
2
1
+ 2x
2
2
+ 3x
2
3
> 1) return 0;
Return 1;
where 0 represents infeasible, 1 feasible. It is easy to know that the feasible set is contained in
the following hypercube
©
(x
1
, x
2
, x
3
)
¯
¯
0 ≤ x
1
≤ 1, 0 ≤ x
2
≤ 1, 0 ≤ x
3
≤ 1
ª
which is simple for the computer because we can easily sample points from it. For example, we
can take
x
1
= U(0, 1), x
2
= U(0, 1), x
3
= U(0, 1) (2)
where the function U(a, b) generates uniformly distributed variables on the interval [a, b]. If this
chromosome is infeasible, then we reject it and regenerate one by (2). If the generated chromosome
is feasible, then we accept it as one in the population. After finite times, we can obtain 30 feasible
chromosomes.
A run of GA with 400 generations shows that the optimal solution is
x
∗
= (0.636, 0.395, 0.307)
whose objective value is 1.980.
1