최적화/jmetal

Chapter 3 (1)

Dong Uk Won 2021. 11. 18. 01:06
반응형

1. Solution 

Q. 인코딩을 어떻게할 것인지?
 - Solution은 Variable들의 집합
 - Variable은 다양한 타입을 가질 수 있다는 점
 - Q. Variable 자체도 내가 새로 커스텀 정의할 수 있나?
Q. 아무튼 다양한 type의 변수들을 조합해서 새로운 Solution Type을 정할 수 있고, 혹은 기존에 일단 제공되는 Solution Type도 있음. 
- A: 새로 커스텀 soluton type 가능. 단 Solution Tyhpe이라는 추상클래스를 상속받아서, createVariable 메서드 재정의!


ㅁ 결국 좀 더 하이레벨에서 보면 Problem이 Solution Type을 결정함. 



2. Operators

메타휴리스틱은, 기본적으로, 방금 만든 솔루션을 생성 및 수정한다! (연결고리) 

(E.g., EA alogrithm -->Crossover opeartor for modifying solution)

 

- 프레임워크가 기본적으로 다음의 Operator 제공.

  • Crossover
  • Mutation
  • Selection
  • Local Search

Each operator contains the setParameter() and getParameter() methods

 

- 주의: operator는 특정 solutoin type에만 적용될 수 있다.

UQ. operator를 configure하는 작업이 어느 클래스에서 이루어지는지? -->아마도 알고리즘 클래스 어딘가?

configure된 operator는 알고리즘에서 사용된다. 

 

ㅁ 예) SBX crossover operator의 내부 구현을 살펴보자.

1번 (line 14-15) :아까도 말했듯이 특정 operator는 허용된 데이터 타입이 정해져 있다. 

(lines 19-26) The constructor  merely gets the map received as argument and checks whether some of the parameters have to be set

- The execute() method receives as a parameter a generic Java Object (line 37), which must represent an array of two solutions, the parent solutions (line 38).

- 파라미터로 generic Java Object가 넘어오니까 따라서 valid Type인지 검사해주어야함.  We can see in lines 46-51 how the VALID TYPES is used to check that the parent solutions have valid encodings. 

 


3 Problems

 

- All the problems inherits from class Problem

- This class contains two basic methods: evaluate() & evaluateConstraints()

- Both methods receive a Solution representing a candidate solution to the problem;

- All the problems have to define the evaluate() method, while only problems having side constraints need to define evaluateConstraints().

  • evaluate() : evaluates Solution
  • evaluateConstraints() determines the overall constraint violation of this Solution.

 

- A key design feature in jMetal :  the problem defines the allowed solutions types that are suitable to solve it.

( 당연하다.)

 

 


3.1.4 Algorithms

 

사전에, Operator의 execute()는 먼저 구현되어있어야한다. In particular, the abstract method execute() must be implemented; this method is intended to run the algorithm, and it returns as a result a SolutionSet

- An instance object of Algorithm may require some application-specific parameters, that can be added and accessed by using the methods addParameter() and getParameter(), respectively. Similarly, an algorithm may also make use of some operators, so methods for incorporating operators (addOperator()) and to get them (getOperator()) are provided.

- A detailed example of algorithm can be found in Section 3.3, where the implementation of NSGA-II is explained.