Skip to content

Commit

Permalink
Merge pull request #1496 from NASA-AMMOS/feature/procedural-scheduling
Browse files Browse the repository at this point in the history
Procedural Scheduling
  • Loading branch information
JoelCourtney authored Sep 9, 2024
2 parents a14b1ec + a974ed3 commit 605c023
Show file tree
Hide file tree
Showing 245 changed files with 6,522 additions and 1,960 deletions.
1 change: 1 addition & 0 deletions .github/scripts/compareDatabasesDown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ PGCBADEXPLAIN=./comparison/badexplanations.txt \
PGDB=postgres \
PGBINDIR=/usr/bin \
PGCOMITSCHEMAS="('hdb_catalog'),('pg_catalog'),('information_schema')" \
PGCEXPLANATIONS=./explanations \
./pgcmp
return_code=$?

Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/explanations
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trigger scheduler scheduler.scheduling_goal_definition."notify_hasura_refreshSchedulingProcedureParameterTypes_INSERT"/"INSERT" missing in 1st DB From_RefreshSchedProcParm_Action 2
trigger scheduler scheduler.scheduling_goal_definition."notify_hasura_refreshSchedulingProcedureParameterTypes_UPDATE"/"UPDATE" missing in 1st DB From_RefreshSchedProcParm_Action 2
3 changes: 3 additions & 0 deletions .github/workflows/deploy-to-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
cp -a ./scheduler-worker/scheduling-dsl-compiler/build/docs ./build/scheduling-edsl-api
- name: Build Java Docs
run: ./gradlew javadoc
- name: Build Kotlin Docs
run: ./gradlew dokkaHtmlMultiModule
- name: Copy Java Docs to Build Directory
run: |
cp -a ./constraints/build/docs/javadoc ./build/javadoc/constraints
Expand All @@ -50,6 +52,7 @@ jobs:
cp -a ./scheduler-driver/build/docs/javadoc ./build/javadoc/scheduler-driver
cp -a ./scheduler-server/build/docs/javadoc ./build/javadoc/scheduler-server
cp -a ./scheduler-worker/build/docs/javadoc ./build/javadoc/scheduler-worker
cp -a ./procedural/build/dokka/htmlMultiModule ./build/procedural-apis
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pgcmp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ jobs:
- name: Compare Databases
id: dbcmp
run: |
cp ./.github/scripts/explanations pgcmp
cp ./.github/scripts/compareDatabasesUp.sh pgcmp/compareDatabases.sh
cd pgcmp
./compareDatabases.sh
Expand Down Expand Up @@ -332,6 +333,7 @@ jobs:
- name: Compare Databases
id: dbcmp
run: |
cp ./.github/scripts/explanations pgcmp
cp ./.github/scripts/compareDatabasesDown.sh pgcmp/compareDatabases.sh
cd pgcmp
./compareDatabases.sh
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
uses: gradle/actions/setup-gradle@v3
- name: Assemble
run: ./gradlew assemble --parallel
- name: Build scheduling procedure jars for testing
run: ./gradlew procedural:examples:foo-procedures:buildAllSchedulingProcedureJars
- name: Start Services
run: |
docker compose -f ./e2e-tests/docker-compose-test.yml up -d --build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gov.nasa.jpl.aerie.constraints.model;

import gov.nasa.jpl.aerie.constraints.time.Interval;
import gov.nasa.jpl.aerie.merlin.driver.ActivityInstanceId;
import gov.nasa.jpl.aerie.types.ActivityInstanceId;
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue;
import gov.nasa.jpl.aerie.types.ActivityDirectiveId;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package gov.nasa.jpl.aerie.constraints.time;

import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Comparator;
import java.util.Objects;

import static gov.nasa.jpl.aerie.constraints.time.Interval.Inclusivity.Exclusive;
Expand Down Expand Up @@ -265,7 +263,7 @@ public boolean contains(Interval x){
}

public boolean isSingleton(){
return this.start.isEqualTo(this.end);
return this.start.equals(this.end);
}

public static Interval betweenClosedOpen(final Duration start, final Duration end) {
Expand All @@ -286,7 +284,7 @@ public int compareTo(final Interval o) {

public static int compareStartToStart(final Interval x, final Interval y) {
// First, order by absolute time.
if (!x.start.isEqualTo(y.start)) {
if (!x.start.equals(y.start)) {
return x.start.compareTo(y.start);
}

Expand All @@ -300,7 +298,7 @@ public static int compareStartToStart(final Interval x, final Interval y) {

public static int compareEndToEnd(final Interval x, final Interval y) {
// First, order by absolute time.
if (!x.end.isEqualTo(y.end)) {
if (!x.end.equals(y.end)) {
return x.end.compareTo(y.end);
}

Expand Down Expand Up @@ -348,7 +346,7 @@ public static int compareEndToStart(final Interval x, final Interval y) {
}

public static boolean meets(final Interval x, final Interval y) {
return (x.end.isEqualTo(y.start)) && (x.endInclusivity != y.startInclusivity);
return (x.end.equals(y.start)) && (x.endInclusivity != y.startInclusivity);
}

public static boolean metBy(final Interval x, final Interval y) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static Interval strictUpperBoundsOf(final Interval x) {
*/
public static boolean startBeforeStart(Interval x, Interval y) {
return x.start.shorterThan(y.start) ||
(x.start.isEqualTo(y.start) && (x.includesStart() && !y.includesStart()));
(x.start.equals(y.start) && (x.includesStart() && !y.includesStart()));
}

/**
Expand All @@ -123,7 +123,7 @@ public static boolean startBeforeStart(Interval x, Interval y) {
*/
public static boolean endBeforeStart(Interval x, Interval y) {
return x.end.shorterThan(y.start) ||
(x.end.isEqualTo(y.start) && (!x.includesEnd() || !y.includesStart()));
(x.end.equals(y.start) && (!x.includesEnd() || !y.includesStart()));
}

/**
Expand All @@ -135,7 +135,7 @@ public static boolean endBeforeStart(Interval x, Interval y) {
*/
public static boolean endBeforeEnd(Interval x, Interval y) {
return x.end.shorterThan(y.end) ||
(x.end.isEqualTo(y.end) && (!x.includesEnd() && y.includesEnd()));
(x.end.equals(y.end) && (!x.includesEnd() && y.includesEnd()));
}

/**
Expand Down Expand Up @@ -265,7 +265,7 @@ static boolean startsStrictlyAfter(Interval x, Interval y) {
static boolean endsStrictlyBefore(Interval x, Interval y) {
if (x.isEmpty() || y.isEmpty()) return false;
return x.end.shorterThan(y.start) ||
(x.end.isEqualTo(y.start) && (!x.includesEnd() && !y.includesStart()));
(x.end.equals(y.start) && (!x.includesEnd() && !y.includesStart()));
}

/**
Expand All @@ -277,7 +277,7 @@ static boolean endsStrictlyBefore(Interval x, Interval y) {
*/
static boolean meets(Interval x, Interval y) {
if (x.isEmpty() || y.isEmpty()) return false;
return x.end.isEqualTo(y.start) && (x.endInclusivity != y.startInclusivity);
return x.end.equals(y.start) && (x.endInclusivity != y.startInclusivity);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import org.apache.commons.lang3.function.TriFunction;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
Expand Down Expand Up @@ -84,7 +83,7 @@ private static <V> boolean invariantsMet(Iterable<Segment<V>> segments) {
if (segment.interval().isEmpty() ||
(oldSegment != null &&
(!endBeforeStart(oldSegment.interval(), segment.interval()) ||
(segment.interval().start.isEqualTo(oldSegment.interval().end) && Objects.equals(segment.value(), oldSegment.value()))))) {
(segment.interval().start.equals(oldSegment.interval().end) && Objects.equals(segment.value(), oldSegment.value()))))) {
segmentsOkay = false;
break;
}
Expand Down Expand Up @@ -324,7 +323,7 @@ IntervalMap<R> map2(
if (!leftDone && (!leftGetNext || leftIter.hasNext())) {
if (leftGetNext) leftNextDefinedSegment = leftIter.next();
leftGetNext = false;
if (leftNextDefinedSegment.interval().start.shorterThan(startTime) || (leftNextDefinedSegment.interval().start.isEqualTo(startTime) && !leftNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
if (leftNextDefinedSegment.interval().start.shorterThan(startTime) || (leftNextDefinedSegment.interval().start.equals(startTime) && !leftNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
leftInterval = leftNextDefinedSegment.interval();
leftValue = Optional.of(leftNextDefinedSegment.value());
leftGetNext = true;
Expand All @@ -345,7 +344,7 @@ IntervalMap<R> map2(
if (!rightDone && (!rightGetNext || rightIter.hasNext())) {
if (rightGetNext) rightNextDefinedSegment = rightIter.next();
rightGetNext = false;
if (rightNextDefinedSegment.interval().start.shorterThan(startTime) || (rightNextDefinedSegment.interval().start.isEqualTo(startTime) && !rightNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
if (rightNextDefinedSegment.interval().start.shorterThan(startTime) || (rightNextDefinedSegment.interval().start.equals(startTime) && !rightNextDefinedSegment.interval().startInclusivity.moreRestrictiveThan(startInclusivity))) {
rightInterval = rightNextDefinedSegment.interval();
rightValue = Optional.of(rightNextDefinedSegment.value());
rightGetNext = true;
Expand All @@ -363,7 +362,7 @@ IntervalMap<R> map2(
rightValue = Optional.empty();
}

if (leftInterval.end.isEqualTo(rightInterval.end)) {
if (leftInterval.end.equals(rightInterval.end)) {
endTime = leftInterval.end;
if (leftInterval.includesEnd() && rightInterval.includesEnd()) {
endInclusivity = Inclusive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public static <D extends Dynamics<?, D>> Resource<D> shift(Resource<D> resource,
if (interval.shorterThan(ZERO)) {
throw new IllegalArgumentException("Cannot shift resource by negative interval: " + interval);
}
if (interval.isEqualTo(ZERO)) {
if (interval.equals(ZERO)) {
return resource;
}
var cell = resource(initialDynamics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
import org.apache.commons.math3.complex.Complex;

import java.util.Arrays;
import java.util.Optional;
import java.util.function.BiPredicate;
import java.util.function.DoublePredicate;
import java.util.function.Predicate;
import java.util.stream.Stream;

import static gov.nasa.jpl.aerie.contrib.streamline.core.Expiring.expiring;
import static gov.nasa.jpl.aerie.contrib.streamline.core.Expiry.NEVER;
import static gov.nasa.jpl.aerie.contrib.streamline.core.Expiry.expiry;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.EPSILON;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.SECOND;
import static gov.nasa.jpl.aerie.contrib.streamline.modeling.discrete.Discrete.discrete;
Expand Down Expand Up @@ -64,7 +61,7 @@ public Double extract() {

@Override
public Polynomial step(Duration t) {
return t.isEqualTo(ZERO) ? this : polynomial(shift(coefficients(), t.ratioOver(SECOND)));
return t.equals(ZERO) ? this : polynomial(shift(coefficients(), t.ratioOver(SECOND)));
}

public int degree() {
Expand Down
Loading

0 comments on commit 605c023

Please sign in to comment.