-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExampleProblem.py
More file actions
23 lines (20 loc) · 818 Bytes
/
ExampleProblem.py
File metadata and controls
23 lines (20 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# * This class implements a problem domain and implements ProblemDomain abstract
# * class.
# *
# * N. Pillay
# *
# * 30 August 2016
#
from GeneticAlgorithm.Problem import Problem
from GeneticAlgorithm.examples.ExampleSolution import ExampleSolution
class ExampleProblem(Problem):
# Methods that are abstract in ProblemDomain that need to be implemented
def evaluate(self, heuristic_combination):
# Implements the abstract method to create a solution using heuristicComb
# using an instance of the Solution class which is also used to calculate
# the fitness using the objective value of the created solution.
solution = ExampleSolution()
solution.set_heuristic_combination(heuristic_combination)
solution.create_solution()
return solution