I am new in coding and need your help. I get the following error:
line 159, in _get_solution
xs = np.array(ms.get_values(self.int_var)).reshape(self.path_n, self.orderbook_n)
AttributeError: 'NoneType' object has no attribute 'get_values'
after reaching this part of the code:
line 159, in _get_solution
xs = np.array(ms.get_values(self.int_var)).reshape(self.path_n, self.orderbook_n)
When I use: print(dir(ms))
to check what could causing this it gives me the following:
['__bool__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
How could I proceed to get the code running?
The complete code for this part is:
def _get_solution(self):
'''function to solve the optimization model, save result and print outputs'''
self.print_content = ''
self.trade_solution = OrderedDict()
ms = self.solve()
xs = np.array(ms.get_values(self.int_var)).reshape(self.path_n, self.orderbook_n)
zs = xs * self.precision_matrix
nonzeroZ = list(zip(*np.nonzero(zs)))
nonzeroZ = sorted(nonzeroZ, key=lambda x: x[0])