Skip to content

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

@ixchow

Description

@ixchow

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions