Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schedule.cpp's left-edge computation is placeholder #15

Open
ixchow opened this issue Oct 26, 2021 · 0 comments
Open

schedule.cpp's left-edge computation is placeholder #15

ixchow opened this issue Oct 26, 2021 · 0 comments

Comments

@ixchow
Copy link
Member

ixchow commented Oct 26, 2021

The current left-edge computation in the scheduler is placeholder code. Notice all the TODOs:

autoknit/schedule.cpp

Lines 1635 to 1654 in 0021de3

//TODO: build penalties between active storages at each step by looking at stitch ancestors
//TODO: some sort of actual optimization or something!
for (uint32_t si = 0; si < active.size(); ++si) {
gaps[si].assign(gaps[si].size(), 1); //just a 'lil space between everything
}
std::vector< std::vector< int32_t > > lefts; //left edge of each active storage
lefts.reserve(steps.size());
for (uint32_t si = 0; si < steps.size(); ++si) {
std::vector< int32_t > left;
if (!active[si].empty()) {
left.emplace_back(0);
for (uint32_t i = 0; i < gaps[si].size(); ++i) {
left.emplace_back(left.back() + storage_widths[active[si][i]] + gaps[si][i]);
}
}
//TODO: shift storage left positions based on penalties
lefts.emplace_back(std::move(left));
}

Particularly, what this code should do to match the scheduler described in the paper is to use dynamic programming to find coordinates adjustments to the gaps / left edges that minimize the total number of stitches moved at optimal alignment.

Without these steps, tubes end up moved long distances for no reason (e.g., when knitting the cactus, each tube is shifted all the way to the left after the split instead of staying on its expected needles).

(Aside: it appears we also have this code as placeholder in the visualknit scheduler. I am surprised that it works.)

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

No branches or pull requests

1 participant