Skip to content

Instantly share code, notes, and snippets.

@zenna

zenna/cond.jl

Last active Mar 25, 2019
Embed
What would you like to do?
using Omega
using Debugger
using Omega: mem
"Return sequence bounded between lb ad ub"
function f_(ω)
lb = -1.0
ub = 1.0
xs = Float64[]
x = rand(ω)
for i = 1:10
x += rand(ω)
cond(ω, x <ₛ ub)
cond(ω, lb <ₛ x)
push!(xs, x)
end
xs
end
f = ciid(f_)
g = ciid-> (f(ω); f(ω)))
ω = defΩ()()
@show indomainₛ(f, ω)
# returns: Omega.Soft.DualSoftBool{SoftBool{Float64}}(ϵ:-0.0, ϵ:-30830.490459499295)
@show indomainₛ(g, ω)
# returns: Omega.Soft.DualSoftBool{SoftBool{Float64}}(ϵ:-0.0, ϵ:-61660.980918998575)
@show indomainₛ(mem(g), ω)
# returns Omega.Soft.DualSoftBool{SoftBool{Float64}}(ϵ:-0.0, ϵ:-30830.490459499295)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment