本文整理汇总了Python中input_reader.InputReader.read方法的典型用法代码示例。如果您正苦于以下问题:Python InputReader.read方法的具体用法?Python InputReader.read怎么用?Python InputReader.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类input_reader.InputReader
的用法示例。
在下文中一共展示了InputReader.read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from input_reader import InputReader [as 别名]
# 或者: from input_reader.InputReader import read [as 别名]
def __init__(self):
input_reader = InputReader()
self.state = input_reader.read(0)
self.output_writer = OutputWriter('naive')
self.num_rows = self.state['numRows']
self.num_cols = self.state['numCols']
self.num_drones = self.state['numDrones']
self.num_turns = self.state['numTurns']
self.max_payload = self.state['maxPayload']
self.num_product_types = self.state['numProductTypes']
self.product_weights = self.state['productWeights']
self.num_warehouses = self.state['numWarehouses']
# warehouse: liste auf dicts: x, y, items -> itemstock
self.warehouse_data = self.state['warehousesData']
# order data: liste auf dicts: x, y, numorders, items
self.order_data = self.state['orderData']
# get list of items
self.item_lists = numpy.zeros((len(self.order_data), len(self.product_weights)), dtype=int)
self.turns_used = numpy.zeros(self.num_drones)
self.drone_location = numpy.zeros((self.num_drones, 2))
for order_idx in numpy.arange(len(self.order_data)):
for item in self.order_data[order_idx]['items']:
self.item_lists[order_idx][item] += 1
for n in numpy.arange(self.num_drones):
self.drone_location[n] = [0, 0]