12 self.
fs = open(f
'{name}.sta',
'w')
13 self.
fd = open(f
'{name}.lst',
'w')
16 def message(self, smsg, dmsg, nmsg, msgv):
18 print(
'\n'.join(msgv[:smsg]))
19 self.
fs.write(
'{}\n'.format(
'\n'.join(msgv[:smsg])))
22 self.
fd.write(
'{}\n'.format(
'\n'.join(msgv[:dmsg])))
29 errormsg += f
'Variable {colno} : '
31 errormsg += f
'Equation {rowno} : '
33 errormsg += f
'Variable {colno} appearing in Equation {rowno} : '
35 errormsg += f
'{msg}\n'
37 self.
fd.write(errormsg)
38 self.
fs.write(errormsg)
43 name = conopt.getName()
44 with open(f
'{name}.rc',
'w')
as fc:
45 fc.write(f
'{name}: {msg}\n')
48def checkSolve(conopt, expected_objective, coi_error, tol = 0.000001):
50 if conopt.modelStatus() != 2
or conopt.solutionStatus() != 1:
51 python_log(conopt,
"Incorrect Model or Solver Status")
53 elif abs( conopt.objectiveValue() - expected_objective ) > tol:
54 python_log(conopt,
"Incorrect objective returned")
The message handler class.
errorMessage(self, rowno, colno, posno, msg)
virtual method for handling error messages.
message(self, smsg, dmsg, nmsg, msgv)
virtual method for handling the messages.
checkSolve(conopt, expected_objective, coi_error, tol=0.000001)