Skip to content

Commit

Permalink
examples: cleanup python samples
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Jul 18, 2023
1 parent baf4a82 commit 8f5f186
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 202 deletions.
5 changes: 3 additions & 2 deletions examples/python/cover_rectangle_sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def cover_rectangle(num_squares):
print("%s found in %0.2fs" % (solver.StatusName(status), solver.WallTime()))

# Prints solution.
if status == cp_model.OPTIMAL or status == cp_model.FEASIBLE:
solution_found = status == cp_model.OPTIMAL or status == cp_model.FEASIBLE
if solution_found:
display = [[" " for _ in range(size_x)] for _ in range(size_y)]
for i in range(num_squares):
sol_x = solver.Value(x_starts[i])
Expand All @@ -107,7 +108,7 @@ def cover_rectangle(num_squares):

for line in range(size_y):
print(" ".join(display[line]))
return status == cp_model.OPTIMAL
return solution_found


def main(argv: Sequence[str]) -> None:
Expand Down
Loading

0 comments on commit 8f5f186

Please sign in to comment.