-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExampleProblem.py
More file actions
43 lines (38 loc) · 1.31 KB
/
ExampleProblem.py
File metadata and controls
43 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#
# * This class extends the Problem abstract class to implement the problem
# * domain. The class constructs a solution to the problem using an evolved
# * heuristic instead of an existing heuristic. The heuristic has to be
# * calculated for each entity that is added at each point in constructing a
# * solution.
# *
# * Nelishia Pillay
# *
# * 8 October 2016
# *
#
from GeneticProgram.Problem import Problem
from GeneticProgram.examples.ExampleSolution import ExampleSolution
class ExampleProblem(Problem):
#
# * Data elements
#
#
# * Stores the attributes with each character in the string representing a
# * different attribute.
#
attributes = str()
def evaluate(self, heuristic):
#
# * 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(heuristic)
solution.create_solution(self.attributes)
return solution
def set_attributes(self, attributes):
#
# * Sets the attribute string.
#
self.attributes = attributes