Feasbility First (Parameter-less Approach)¶
Most algorithms follow the so-called feasibility first (also known as a parameter-less approach). There, the constraint violation measure is chosen from a practical standpoint. In order to evaluate a solution, any designer will first check if the solution is feasible. Suppose the solution is infeasible (that is, at least one constraint is violated). In that case, the designer will never bother to compute its objective function value (such as the cost of the design). It does not make sense to compute the objective function value of an infeasible solution because the solution simply cannot be implemented in practice. Motivated by this argument, we devise the following penalty term where infeasible solutions are compared based on only their constraint violation values:
This constraint handling method is straightforward to integrate into a framework because it applies to many different algorithms that are either based on sorting or use the comparison of solutions. For more details please consult .
from pymoo.algorithms.soo.nonconvex.ga import GA from pymoo.optimize import minimize problem = ConstrainedProblem() algorithm = GA(pop_size=100) res = minimize(problem, algorithm, seed=1, verbose=False) print("Best solution found: \nX = %s\nF = %s\nCV = %s" % (res.X, res.F, res.CV))
Compiled modules for significant speedup can not be used! https://pymoo.org/installation.html#installation To disable this warning: from pymoo.config import Config Config.warnings['not_compiled'] = False Best solution found: X = [0.50357872 0.49642274] F = [0.50002706] CV = [0.]