use black on examples/python
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Test linear sum assignment on a 4x4 matrix.
|
||||
|
||||
Example taken from:
|
||||
@@ -27,8 +28,7 @@ def run_assignment_on_4x4_matrix():
|
||||
"""Test linear sum assignment on a 4x4 matrix."""
|
||||
num_sources = 4
|
||||
num_targets = 4
|
||||
cost = [[90, 76, 75, 80], [35, 85, 55, 65], [125, 95, 90, 105],
|
||||
[45, 110, 95, 115]]
|
||||
cost = [[90, 76, 75, 80], [35, 85, 55, 65], [125, 95, 90, 105], [45, 110, 95, 115]]
|
||||
expected_cost = cost[0][3] + cost[1][2] + cost[2][1] + cost[3][0]
|
||||
|
||||
assignment = linear_sum_assignment.SimpleLinearSumAssignment()
|
||||
@@ -38,23 +38,24 @@ def run_assignment_on_4x4_matrix():
|
||||
|
||||
solve_status = assignment.solve()
|
||||
if solve_status == assignment.OPTIMAL:
|
||||
print('Successful solve.')
|
||||
print('Total cost', assignment.optimal_cost(), '/', expected_cost)
|
||||
print("Successful solve.")
|
||||
print("Total cost", assignment.optimal_cost(), "/", expected_cost)
|
||||
for i in range(0, assignment.num_nodes()):
|
||||
print('Left node %d assigned to right node %d with cost %d.' %
|
||||
(i, assignment.right_mate(i), assignment.assignment_cost(i)))
|
||||
print(
|
||||
"Left node %d assigned to right node %d with cost %d."
|
||||
% (i, assignment.right_mate(i), assignment.assignment_cost(i))
|
||||
)
|
||||
elif solve_status == assignment.INFEASIBLE:
|
||||
print('No perfect matching exists.')
|
||||
print("No perfect matching exists.")
|
||||
elif solve_status == assignment.POSSIBLE_OVERFLOW:
|
||||
print(
|
||||
'Some input costs are too large and may cause an integer overflow.')
|
||||
print("Some input costs are too large and may cause an integer overflow.")
|
||||
|
||||
|
||||
def main(argv: Sequence[str]) -> None:
|
||||
if len(argv) > 1:
|
||||
raise app.UsageError('Too many command-line arguments.')
|
||||
raise app.UsageError("Too many command-line arguments.")
|
||||
run_assignment_on_4x4_matrix()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
app.run(main)
|
||||
|
||||
Reference in New Issue
Block a user