Skip to content

Commit

Permalink
convert globals used in requirements to distributions as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
dfremont committed Jul 9, 2024
1 parent 322eca6 commit 45b9ae6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/scenic/core/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import rv_ltl
import trimesh

from scenic.core.distributions import Samplable, needsSampling
from scenic.core.distributions import Samplable, needsSampling, toDistribution
from scenic.core.errors import InvalidScenarioError
from scenic.core.lazy_eval import needsLazyEvaluation
from scenic.core.propositions import Atomic, PropositionNode
Expand Down Expand Up @@ -71,6 +71,10 @@ def compile(self, namespace, scenario, syntax=None):
bindings, ego, line = self.bindings, self.egoObject, self.line
condition, ty = self.condition, self.ty

# Convert bound values to distributions as needed
for name, value in bindings.items():
bindings[name] = toDistribution(value)

# Check whether requirement implies any relations used for pruning
canPrune = condition.check_constrains_sampling()
if canPrune:
Expand Down

0 comments on commit 45b9ae6

Please sign in to comment.