Skip to content

Use itertools#25

Open
gigeresk wants to merge 1 commit into
mainfrom
use_itertools
Open

Use itertools#25
gigeresk wants to merge 1 commit into
mainfrom
use_itertools

Conversation

@gigeresk

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors several deeply nested iteration patterns in the SCIP ILP scheduler to use itertools.product, aiming to simplify the code and reduce indentation depth in the scheduler model construction and solution-dumping logic.

Changes:

  • Replace multiple nested for loops with itertools.product(...) across variable creation and constraint generation.
  • Refactor the solution-dump loops to use product(...) for iterating over (x, y, t, c).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +107 to +114
for p in range(P):
for t in range(T):
enterc[i, j, p, t] = m.addVar(
vtype="B", name=f"enterc_{i}_{j}_{p}_{t}"
)
exitc[i, j, p, t] = m.addVar(
vtype="B", name=f"exitc_{i}_{j}_{p}_{t}"
)
Comment on lines +588 to +592
for x, y, t, c in product(range(Nx), range(Ny), range(T), range(C)):
enterLine = "enter[%d][%d][%d][%d][%d] = %d" % (
x,
y,
c,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants