examples: Fix main default parameter
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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':
|
||||||
|
|||||||
Reference in New Issue
Block a user