-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: nearby selection pinning support (#614)
- Loading branch information
Showing
20 changed files
with
181 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...ver/core/impl/testdata/domain/list/pinned/index/TestdataPinnedWithIndexDistanceMeter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ai.timefold.solver.core.impl.testdata.domain.list.pinned.index; | ||
|
||
import ai.timefold.solver.core.impl.heuristic.selector.common.nearby.NearbyDistanceMeter; | ||
import ai.timefold.solver.core.impl.testdata.domain.TestdataObject; | ||
|
||
/** | ||
* For the sake of test readability, planning values (list variable elements) are placed in a 1-dimensional space. | ||
* An element's coordinate is represented by its ({@link TestdataObject#getCode() code}. If the code is not a number, | ||
* it is interpreted as zero. | ||
*/ | ||
public class TestdataPinnedWithIndexDistanceMeter | ||
implements NearbyDistanceMeter<TestdataPinnedWithIndexListValue, TestdataObject> { | ||
|
||
@Override | ||
public double getNearbyDistance(TestdataPinnedWithIndexListValue origin, TestdataObject destination) { | ||
return Math.abs(coordinate(destination) - coordinate(origin)); | ||
} | ||
|
||
static int coordinate(TestdataObject o) { | ||
try { | ||
return Integer.parseInt(o.getCode()); | ||
} catch (NumberFormatException e) { | ||
return 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.