Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 23-performance-improv…
Browse files Browse the repository at this point in the history
…ements-by-multithreading

# Conflicts:
#	buildSrc/src/main/kotlin/tools.aqua.stars.kotlin-conventions.gradle.kts
  • Loading branch information
dominikmaeckel committed Feb 13, 2024
2 parents d2ed446 + dd56637 commit f8927d7
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,4 @@ tasks.test {
testLogging { events(FAILED, PASSED, SKIPPED) }
}

kotlin.target.compilations.all {
kotlinOptions {
jvmTarget = "17"
// allWarningsAsErrors = true
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xjvm-default=all")
}
}
kotlin { jvmToolchain(17) }
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ import tools.aqua.stars.core.metric.metrics.evaluation.ValidTSCInstancesPerProje
import tools.aqua.stars.core.metric.providers.Loggable
import tools.aqua.stars.core.metric.providers.PostEvaluationMetricProvider
import tools.aqua.stars.core.tsc.TSCMonitorResult
import tools.aqua.stars.core.tsc.node.TSCNode
import tools.aqua.stars.core.tsc.projection.TSCProjection
import tools.aqua.stars.core.types.EntityType
import tools.aqua.stars.core.types.SegmentType
import tools.aqua.stars.core.types.TickDataType

/**
* This metric implements the [PostEvaluationMetricProvider] and tracks the number of failed
* monitors.
* This metric implements the [PostEvaluationMetricProvider] and tracks the formulas specified as
* [TSCNode.monitorFunction]s that evaluate to 'false'.
*
* This class implements the [Loggable] interface. It logs and prints the count of missing Monitors
* for each [TSCProjection]. It logs the missing [TSCMonitorResult]s for each [TSCProjection].
* This class implements the [Loggable] interface. It logs and prints the count and names of all
* failing [TSCNode.monitorFunction]s for each [TSCProjection]. It logs the failing
* [TSCMonitorResult]s for each [TSCProjection].
*/
@Suppress("unused")
class FailedMonitorsMetric<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ fun convertJsonData(
}
val egoTickData = checkNotNull(referenceTickData).map { it.clone() }

// Remove all existing ego flags when useEveryVehicleAsEgo is set
if (useEveryVehicleAsEgo) {
egoTickData.forEach { tickData ->
tickData.actors.filterIsInstance<Vehicle>().forEach { it.egoVehicle = false }
}
}

// Set egoVehicle flag for each TickData
var isTickWithoutEgo = false
egoTickData.forEach { tickData ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,47 @@ fun <E1 : E, E : EntityType<E, T, S>, T : TickDataType<E, T, S>, S : SegmentType
if (entity::class.isInstance(previousEntity)) phi(entity::class.cast(previousEntity))
else false
})

/**
* CMFTBL implementation of the previous operator for two entities.
*
* @param E1 [EntityType]
* 1.
* @param E2 [EntityType]
* 2.
* @param E [EntityType].
* @param T [TickDataType].
* @param S [SegmentType].
* @param entity1 Current [EntityType]
* 1.
* @param entity2 Current [EntityType]
* 2.
* @param interval Observation interval.
* @param phi Predicate.
*/
fun <
E1 : E,
E2 : E,
E : EntityType<E, T, S>,
T : TickDataType<E, T, S>,
S : SegmentType<E, T, S>> previous(
entity1: E1,
entity2: E2,
interval: Pair<Double, Double> = Pair(0.0, Double.MAX_VALUE),
phi: (E1, E2) -> Boolean
): Boolean {
require(entity1.tickData == entity2.tickData) {
"the two entities provided as argument are not from same tick"
}
return previous(
entity1.tickData,
interval,
phi = { td ->
val previousEntity1 = td.entity(entity1.id)
val previousEntity2 = td.entity(entity2.id)
if (entity1::class.isInstance(previousEntity1) &&
entity2::class.isInstance(previousEntity2))
phi(entity1::class.cast(previousEntity1), entity2::class.cast(previousEntity2))
else false
})
}

0 comments on commit f8927d7

Please sign in to comment.