PyJobShop / PyJobShop

Solving scheduling problems with constraint programming in Python.
https://pyjobshop.readthedocs.io/
MIT License
23 stars 2 forks source link

OR-Tools docs #198

Closed leonlan closed 1 month ago

leonlan commented 2 months ago

This issue collects things I encounter with OR-Tools that I want to document for future reference.

leonlan commented 2 months ago

add_min_equality with an empty list is infeasible.

from ortools.sat.python.cp_model import CpModel, CpSolver

model = CpModel()

start = model.new_int_var(0, 10, '')
end = model.new_int_var(0, 10, '')
duration = model.new_int_var(5, 5, '')
interval_var = model.new_interval_var(start, duration, end, name='')

model.add_min_equality(start, [])

solver = CpSolver()
solver.parameters.log_search_progress = True
solver.log_callback = lambda x: print(x)

status = solver.solve(model)
solver.status_name(status)

I encountered this when spanning job variables with task variables.

leonlan commented 2 months ago

Optional interval vars

leonlan commented 1 month ago

add_min_equality with an empty list is infeasible.

from ortools.sat.python.cp_model import CpModel, CpSolver

model = CpModel()

start = model.new_int_var(0, 10, '')
end = model.new_int_var(0, 10, '')
duration = model.new_int_var(5, 5, '')
interval_var = model.new_interval_var(start, duration, end, name='')

model.add_min_equality(start, [])

solver = CpSolver()
solver.parameters.log_search_progress = True
solver.log_callback = lambda x: print(x)

status = solver.solve(model)
solver.status_name(status)

I encountered this when spanning job variables with task variables.