-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #171 from NASA-AMMOS/prototype/AERIE-1812--cardina…
…lity-mutex [AERIE-1812] Add cardinality goal (with implied mutex) to the scheduling eDSL
- Loading branch information
Showing
16 changed files
with
367 additions
and
42 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
constraints/src/main/java/gov/nasa/jpl/aerie/constraints/tree/WindowsOf.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,53 @@ | ||
package gov.nasa.jpl.aerie.constraints.tree; | ||
|
||
import gov.nasa.jpl.aerie.constraints.model.ActivityInstance; | ||
import gov.nasa.jpl.aerie.constraints.model.SimulationResults; | ||
import gov.nasa.jpl.aerie.constraints.model.Violation; | ||
import gov.nasa.jpl.aerie.constraints.time.Window; | ||
import gov.nasa.jpl.aerie.constraints.time.Windows; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
public final class WindowsOf implements Expression<Windows> { | ||
public final Expression<List<Violation>> expression; | ||
|
||
public WindowsOf(Expression<List<Violation>> expression) { | ||
this.expression = expression; | ||
} | ||
|
||
@Override | ||
public Windows evaluate(SimulationResults results, final Window bounds, Map<String, ActivityInstance> environment) { | ||
final var ret = new Windows(bounds); | ||
final var unsatisfiedWindows = this.expression.evaluate(results, bounds, environment); | ||
for(var unsatisfiedWindow : unsatisfiedWindows){ | ||
ret.intersectWith(unsatisfiedWindow.violationWindows); | ||
} | ||
return ret; | ||
} | ||
|
||
@Override | ||
public void extractResources(final Set<String> names) { | ||
this.expression.extractResources(names); | ||
} | ||
|
||
@Override | ||
public String prettyPrint(final String prefix) { | ||
return this.expression.prettyPrint(prefix); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (!(obj instanceof WindowsOf)) return false; | ||
final var o = (WindowsOf)obj; | ||
|
||
return Objects.equals(this.expression, o.expression); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(this.expression); | ||
} | ||
} |
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
Oops, something went wrong.