Example #1
0
def Constructor(file, instance):
    """ Constructor function. Reads a file and builds the Instance Object.

        Args:
            file      (File)                 - The instance file to base the instance object off of.
            instance  (Instance.Instance)    - The instance object to be built

        Returns:
            instance  (Instance.Instance)    - The built instance object

        Globals:
            None

        Called By:
            init()

        Calls:
            parser()
    """
    start = file.readline()
    for id in range(int(start)):
        line = file.readline()
        x, y = parser(line)
        instance.Centers.append(Instance.Centers(id, x, y))
        print(str(instance.Centers[id].x) + ", " + str(instance.Centers[id].y))

    line = file.readline()
    for x in range(int(line)):
        line = file.readline()
        x, y = parser(line)
        instance.Pointers.append(Instance.Points(x, y))

    return instance