# ACCURACY print("Accuracy") print("--------") if len(error_pieces) == 0: print('All pieces are labelled with correct shapeID and pieceID.') else: print( 'WARNING: {} pieces have a wrong shapeID. They are labelled in image of the solution, and they are: {}.' .format(len(error_pieces), error_pieces)) total_blocks = sum([sum(row) for row in target]) total_blocks_solution = total_blocks - missing + excess print("The number of blocks in the TARGET is {:.0f}.".format( total_blocks)) print("The number of blocks in the SOLUTION is {:.0f}.".format( total_blocks_solution)) print( "There are {} MISSING blocks ({:.4f}%) and {} EXCESS blocks ({:.4f}%).\n" .format(missing, 100 * missing / total_blocks, excess, 100 * excess / total_blocks)) # VISUALISATION # NOTE: for large sizes (e.g., 100x100), visualisation will take several seconds and might not be that helpful. # Feel free to comment out the following lines if you don't need the visual feedback. print("Displaying solution...") utils.visualisation(target, solution)
print("WARNING: Time is over 10 minutes! The solution is not valid") else: print("Time performance") print("----------------") print("The running time was {:.5f} seconds.\n".format(time_set)) # ACCURACY print("Accuracy") print("--------") print('All pieces are labelled with correct shapeID and pieceID.') print('No forbidden pieces are used.') total_blocks = sum([sum(row) for row in target]) total_blocks_solution = total_blocks - missing + excess print("The number of blocks in the TARGET is {:.0f}.".format(total_blocks)) print("The number of blocks in the SOLUTION is {:.0f}.".format(total_blocks_solution)) print("There are {} MISSING blocks ({:.4f}%) and {} EXCESS blocks ({:.4f}%).\n".format (missing, 100 * missing / total_blocks, excess, 100 * excess / total_blocks)) # VISUALISATION # NOTE: for large sizes (e.g., 100x100), visualisation will take several seconds and might not be that helpful. # Feel free to comment out the following lines if you don't need the visual feedback. print("Displaying solution...") utils.visualisation(target, solution, the_forbidden_pieces) utils.visual_perfect(perfect_solution, solution, the_forbidden_pieces)