TimefoldAI / TimefoldAI/timefold-solver

Filters for KOptListMove don't work yet?

Open
#572 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

process/needs triage
Dominant language
Java
Stars
1.8k
Forks
228
Avg merge
1d 13h
Merged PRs (30d)
46

Description

Hello.
Describe the bug
After you made KOptListMove public, I tried to create trivial filter for it, but it didn't work. https://stackoverflow.com/questions/77619677/timefold-is-it-possible-to-filter-out-all-trivial-2opt-moves-for-planninglistva.

public class KOptFilter implements SelectionFilter<Table, KOptListMove> {
    @Override
    public boolean accept(ScoreDirector<Table> scoreDirector, KOptListMove kOptListMove) {
        System.out.println(kOptListMove.getSimpleMoveTypeDescription() +" "+kOptListMove.getPlanningEntities().size()+" "+kOptListMove.getPlanningValues().size());
        System.out.println(kOptListMove);
        return true;
    }
}

Expected behavior
I expected some information in log, which would help me to understand, how filter out moves with firstEndpointIndex == secondEndpointIndex + 1

Actual behavior
But I haven't got any information in log. Instead I've got warning messages:
2024-01-16 11:26:26,118 WARN [ai.tim.sol.cor.imp.heu.sel.mov.dec.FilteringMoveSelector] (pool-7-thread-1) Bailing out of neverEnding selector (Filtering(ai.timefold.solver.core.impl.heuristic.selector.move.generic.list.kopt.KOptListMoveSelector@4b8a1b5)) after (0) attempts to avoid infinite loop.
And looks like k-opt moves weren't accepted at all. I couldn't find any "firstEndpointIndex" in log.

To Reproduce
Create any filter for KOptListMove

Environment

Timefold Solver Version or Git ref:
1.6.0

Output of java -version:
java version "21" 2023-09-19 LTS
Java(TM) SE Runtime Environment (build 21+35-LTS-2513)
Java HotSpot(TM) 64-Bit Server VM (build 21+35-LTS-2513, mixed mode, sharing)

Output of uname -a or ver:
Microsoft Windows [Version 10.0.22621.3007]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported filter with KOptListMove and inspect the KOptListMoveSelector and FilteringMoveSelector behavior described in the warning. Check why the filter receives no moves and why the never-ending selector bails out after zero attempts. Done means a KOptListMove filter is invoked and can identify or reject the reported trivial moves without the selector warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.