Closed pranav-super closed 4 months ago
edit: code formatting for readability
reproduced with integration test
@Test
void testBugValueAt() {
final var growBananaDuration = Duration.of(1, Duration.HOUR);
final var results = runScheduler(
BANANANATION,
List.of(new ActivityDirective(
Duration.HOUR,
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(3),
"growingDuration", SerializedValue.of(growBananaDuration.in(Duration.MICROSECONDS))),
null,
true),
new ActivityDirective(
Duration.MINUTE.times(55),
"ChangeProducer",
Map.of(
"producer", SerializedValue.of("Company")),
null,
true)),
List.of(new SchedulingGoal(new GoalId(0L, 0L), """
export default () => Goal.CoexistenceGoal({
forEach: Real.Resource("/fruit").greaterThan(4.0),
activityTemplate: interval => ActivityTemplates.ChangeProducer({producer: Discrete.Resource("/producer").valueAt(Spans.FromInterval(interval).starts())}),
startsAt: TimingConstraint.singleton(WindowProperty.START).minus(Temporal.Duration.from({ minutes : 5}))
})
""", true)),
PLANNING_HORIZON);
}
Checked for duplicates
No - I haven't checked
Is this a regression?
No - This is a new bug
Version
2.5.0
Describe the bug
The bug occurs when a
CoexistenceGoal
with aforEach
focused on a resource window, where theactivityTemplate
usesvalueAt
s has astartsAt
with a negative offset. A clearer example follows:This goal works fine if the
.minus
in thestartsAt
is not present, or if it is but the forEach depends on an activity, like so:Reproduction
To reproduce this issue:
resourceName
, of enum typeresourceEnum
.ActivityName
with parameterresourceEnumParam
.ActivityName
using the following logic:Logs
System Info
Severity
Minor