Esempio n. 1
0
                    my_plan.placeBuilding(building)
                    nb_cells += building.project.nb_cells
                    cpt += 1
                else:
                    retry.append((row, column))
            else:
                retry.append((row, column))
            i += 1
            # display progress...
            if i % step == 0 and i >= step:
                percent = 100 * nb_cells / (my_plan.nb_rows *
                                            my_plan.nb_columns)
                print(cpt, "(", percent, "%)")
        free_cells = retry
        retry = []
        shuffle(free_cells)
        print("retry", len(free_cells), "cells")

    # save output file and more
    print("Processing score...")
    my_plan.calcScore()
    percent = 100 * np.sum(np.where(
        my_plan.cellsVal != 0, 1, 0)) / (my_plan.nb_rows * my_plan.nb_columns)
    print(cpt, "buildings (", percent, "%)")
    print("Score :", my_plan.score)
    #print()
    #print(my_plan.cellsVal)
    #print()
    #print(my_plan.cellsId)
    my_plan.savePlan()