Skip to content

Commit

Permalink
Merge pull request #1175 from NASA-AMMOS/refactor-ActivityExpression-…
Browse files Browse the repository at this point in the history
…hierarchy

Refactor of ActivityExpression and derived classes
  • Loading branch information
adrienmaillard authored Oct 13, 2023
2 parents b730f33 + 67bb88a commit 4543e78
Show file tree
Hide file tree
Showing 25 changed files with 549 additions and 1,278 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RootFindingResult<T, History> findRoot(Function<T, History> f,

public interface Function<T, History> {
T valueAt(T x, History historyType);
boolean isApproximation();
}

public static class ZeroDerivativeException extends Exception{
Expand Down Expand Up @@ -89,11 +88,6 @@ public RootFindingResult<Duration, History> findRoot(
public Duration valueAt(final Duration x, final History history) {
return f.valueAt(x, history).minus(y);
}

@Override
public boolean isApproximation() {
return f.isApproximation();
}
};

double x_nminus1_double = x0.in(Duration.MICROSECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import gov.nasa.jpl.aerie.constraints.model.EvaluationEnvironment;
import gov.nasa.jpl.aerie.constraints.time.Windows;
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import gov.nasa.jpl.aerie.scheduler.constraints.activities.ActivityCreationTemplate;
import gov.nasa.jpl.aerie.scheduler.constraints.activities.ActivityExpression;
import gov.nasa.jpl.aerie.scheduler.goals.ActivityTemplateGoal;

import java.util.Optional;
Expand All @@ -28,7 +28,7 @@ public class MissingActivityTemplateConflict extends MissingActivityConflict {
public MissingActivityTemplateConflict(
ActivityTemplateGoal goal,
Windows temporalContext,
ActivityCreationTemplate template,
ActivityExpression template,
EvaluationEnvironment evaluationEnvironment,
int cardinality,
Optional<Duration> totalDuration)
Expand Down Expand Up @@ -95,9 +95,9 @@ public ActivityTemplateGoal getGoal() {
/**
* The conflict can constraint the goal template to guide the search
*/
private final ActivityCreationTemplate template;
private final ActivityExpression template;

public ActivityCreationTemplate getActTemplate() {
public ActivityExpression getActTemplate() {
return template;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public Windows computeRange(final SimulationResults simulationResults, final Pla
if(minTimepoint.isPresent() && maxTimepoint.isPresent()) {
final var anchorActSearch = new ActivityExpression.Builder()
.basedOn(actTemplate)
.startsIn(inter).build(); //check if it exists IN the windows, not just the upper and lower bounds of the interval
//.startsIn(inter)
.build(); //check if it exists IN the windows, not just the upper and lower bounds of the interval
final var anchorActs = plan.find(anchorActSearch, simulationResults, new EvaluationEnvironment());
for (var anchorAct : anchorActs) {
var endInclusivity = Interval.Inclusivity.Exclusive;
Expand Down
Loading

0 comments on commit 4543e78

Please sign in to comment.