私はPythonを初めて使用します。「未定義の変数」というエラーが表示されます。私はそれを理解できませんでした。コード内のステートメントは次のとおりです。
Classroom1 = Classroom(FirstCourseStartTime = 8, LastCourseEndTime = 7.75)
m_count = 0
h_count = 0
t_count = 0
l_count = 0
loopsize = 10000
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)
def Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize):
for i in range(0, loopsize):
Mutated = Classroom()
Mutated = Classroom1.CopyOfClassroom(Mutated)
Mutated.Mutate()
HardConstraintClassroomMet = Classroom1.ComputeHardConstraint()
HardConstraintMutatedMet = Mutated.ComputeHardConstraint()
if HardConstraintClassroomMet == False and HardConstraintMutatedMet == False:
h_count + 1
t_count + 1
Classroom1.Mutate()
continue
if Mutated.FitnessValue() > Classroom1.FitnessValue():
m_count + 1
t_count + 1
Classroom1 = Mutated
if Classroom1.ComputeHardConstraint() == False:
l_count + 1
temp = l_count*loopsize
print "Unable to meet hard consraints in %d" % temp
Loop(Classroom1, m_count, h_count, t_count, l_count, loopsize)