examples: Fix main default parameter

This commit is contained in:
Corentin Le Molgat
2022-04-14 14:44:13 +02:00
parent ad19407ff6
commit 34e442cd5d
22 changed files with 22 additions and 22 deletions

View File

@@ -2053,7 +2053,7 @@
" bus_driver_scheduling(False, num_drivers)\n", " bus_driver_scheduling(False, num_drivers)\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" solve_bus_driver_scheduling()\n", " solve_bus_driver_scheduling()\n",
"\n", "\n",
"\n", "\n",

View File

@@ -95,7 +95,7 @@
"from ortools.sat.python import cp_model\n", "from ortools.sat.python import cp_model\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" \"\"\"Solves the gate scheduling problem.\"\"\"\n", " \"\"\"Solves the gate scheduling problem.\"\"\"\n",
" model = cp_model.CpModel()\n", " model = cp_model.CpModel()\n",
"\n", "\n",

View File

@@ -160,7 +160,7 @@
" print(f'- total wall time: {solver.WallTime()}ms\\n')\n", " print(f'- total wall time: {solver.WallTime()}ms\\n')\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" solve_golomb_ruler(FLAGS.order)\n", " solve_golomb_ruler(FLAGS.order)\n",
"\n", "\n",
"\n", "\n",

View File

@@ -150,7 +150,7 @@
" print(f'- wall time: {solver.WallTime()}s\\n')\n", " print(f'- wall time: {solver.WallTime()}s\\n')\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" solve_golomb_ruler(FLAGS.order, FLAGS.params)\n", " solve_golomb_ruler(FLAGS.order, FLAGS.params)\n",
"\n", "\n",
"\n", "\n",

View File

@@ -257,7 +257,7 @@
" print(' - wall time : %f s' % solver.WallTime())\n", " print(' - wall time : %f s' % solver.WallTime())\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" for pb in range(1, 7):\n", " for pb in range(1, 7):\n",
" solve_hidato(build_puzzle(pb), pb)\n", " solve_hidato(build_puzzle(pb), pb)\n",
"\n", "\n",

View File

@@ -432,7 +432,7 @@
" solve_with_rotations(data, max_height, max_width)\n", " solve_with_rotations(data, max_height, max_width)\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" solve_knapsack(FLAGS.model)\n", " solve_knapsack(FLAGS.model)\n",
"\n", "\n",
"\n", "\n",

View File

@@ -117,7 +117,7 @@
" 'Some input costs are too large and may cause an integer overflow.')\n", " 'Some input costs are too large and may cause an integer overflow.')\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" RunAssignmentOn4x4Matrix()\n", " RunAssignmentOn4x4Matrix()\n",
"\n", "\n",
"\n", "\n",

View File

@@ -140,7 +140,7 @@
" print('There was an issue with the min cost flow input.')\n", " print('There was an issue with the min cost flow input.')\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" MaxFlow()\n", " MaxFlow()\n",
" MinCostFlow()\n", " MinCostFlow()\n",
"\n", "\n",

View File

@@ -367,7 +367,7 @@
" solver.Solve(model)\n", " solver.Solve(model)\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" rcpsp_parser = pywraprcpsp.RcpspParser()\n", " rcpsp_parser = pywraprcpsp.RcpspParser()\n",
" rcpsp_parser.ParseFile(FLAGS.input)\n", " rcpsp_parser.ParseFile(FLAGS.input)\n",
" SolveRcpsp(rcpsp_parser.Problem(), FLAGS.output_proto, FLAGS.params)\n", " SolveRcpsp(rcpsp_parser.Problem(), FLAGS.output_proto, FLAGS.params)\n",

View File

@@ -483,7 +483,7 @@
" print(' - wall time : %f s' % solver.WallTime())\n", " print(' - wall time : %f s' % solver.WallTime())\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" solve_shift_scheduling(FLAGS.params, FLAGS.output_proto)\n", " solve_shift_scheduling(FLAGS.params, FLAGS.output_proto)\n",
"\n", "\n",
"\n", "\n",

View File

@@ -797,7 +797,7 @@
" print('No solution')\n", " print('No solution')\n",
"\n", "\n",
"\n", "\n",
"def main(_):\n", "def main(_=None):\n",
" if FLAGS.solver == 'sat':\n", " if FLAGS.solver == 'sat':\n",
" steel_mill_slab(FLAGS.problem, FLAGS.break_symmetries)\n", " steel_mill_slab(FLAGS.problem, FLAGS.break_symmetries)\n",
" elif FLAGS.solver == 'sat_table':\n", " elif FLAGS.solver == 'sat_table':\n",

View File

@@ -1989,7 +1989,7 @@ def solve_bus_driver_scheduling():
bus_driver_scheduling(False, num_drivers) bus_driver_scheduling(False, num_drivers)
def main(_): def main(_=None):
solve_bus_driver_scheduling() solve_bus_driver_scheduling()

View File

@@ -28,7 +28,7 @@ from ortools.sat.python import visualization
from ortools.sat.python import cp_model from ortools.sat.python import cp_model
def main(_): def main(_=None):
"""Solves the gate scheduling problem.""" """Solves the gate scheduling problem."""
model = cp_model.CpModel() model = cp_model.CpModel()

View File

@@ -93,7 +93,7 @@ def solve_golomb_ruler(order):
print(f'- total wall time: {solver.WallTime()}ms\n') print(f'- total wall time: {solver.WallTime()}ms\n')
def main(_): def main(_=None):
solve_golomb_ruler(FLAGS.order) solve_golomb_ruler(FLAGS.order)

View File

@@ -85,7 +85,7 @@ def solve_golomb_ruler(order, params):
print(f'- wall time: {solver.WallTime()}s\n') print(f'- wall time: {solver.WallTime()}s\n')
def main(_): def main(_=None):
solve_golomb_ruler(FLAGS.order, FLAGS.params) solve_golomb_ruler(FLAGS.order, FLAGS.params)

View File

@@ -189,7 +189,7 @@ def solve_hidato(puzzle, index):
print(' - wall time : %f s' % solver.WallTime()) print(' - wall time : %f s' % solver.WallTime())
def main(_): def main(_=None):
for pb in range(1, 7): for pb in range(1, 7):
solve_hidato(build_puzzle(pb), pb) solve_hidato(build_puzzle(pb), pb)

View File

@@ -369,7 +369,7 @@ def solve_knapsack(model):
solve_with_rotations(data, max_height, max_width) solve_with_rotations(data, max_height, max_width)
def main(_): def main(_=None):
solve_knapsack(FLAGS.model) solve_knapsack(FLAGS.model)

View File

@@ -49,7 +49,7 @@ def RunAssignmentOn4x4Matrix():
'Some input costs are too large and may cause an integer overflow.') 'Some input costs are too large and may cause an integer overflow.')
def main(_): def main(_=None):
RunAssignmentOn4x4Matrix() RunAssignmentOn4x4Matrix()

View File

@@ -72,7 +72,7 @@ def MinCostFlow():
print('There was an issue with the min cost flow input.') print('There was an issue with the min cost flow input.')
def main(_): def main(_=None):
MaxFlow() MaxFlow()
MinCostFlow() MinCostFlow()

View File

@@ -300,7 +300,7 @@ def SolveRcpsp(problem, proto_file, params):
solver.Solve(model) solver.Solve(model)
def main(_): def main(_=None):
rcpsp_parser = pywraprcpsp.RcpspParser() rcpsp_parser = pywraprcpsp.RcpspParser()
rcpsp_parser.ParseFile(FLAGS.input) rcpsp_parser.ParseFile(FLAGS.input)
SolveRcpsp(rcpsp_parser.Problem(), FLAGS.output_proto, FLAGS.params) SolveRcpsp(rcpsp_parser.Problem(), FLAGS.output_proto, FLAGS.params)

View File

@@ -419,7 +419,7 @@ def solve_shift_scheduling(params, output_proto):
print(' - wall time : %f s' % solver.WallTime()) print(' - wall time : %f s' % solver.WallTime())
def main(_): def main(_=None):
solve_shift_scheduling(FLAGS.params, FLAGS.output_proto) solve_shift_scheduling(FLAGS.params, FLAGS.output_proto)

View File

@@ -736,7 +736,7 @@ def steel_mill_slab_with_mip_column_generation(problem):
print('No solution') print('No solution')
def main(_): def main(_=None):
if FLAGS.solver == 'sat': if FLAGS.solver == 'sat':
steel_mill_slab(FLAGS.problem, FLAGS.break_symmetries) steel_mill_slab(FLAGS.problem, FLAGS.break_symmetries)
elif FLAGS.solver == 'sat_table': elif FLAGS.solver == 'sat_table':