Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document function macro #168

Closed
mforets opened this issue Sep 11, 2020 · 3 comments
Closed

Document function macro #168

mforets opened this issue Sep 11, 2020 · 3 comments

Comments

@mforets
Copy link
Contributor

mforets commented Sep 11, 2020

We could add an example in https://juliaintervals.github.io/IntervalConstraintProgramming.jl/latest/

Example:

using IntervalConstraintProgramming, IntervalArithmetic, Plots

dom = IntervalBox(-2 .. 2, -2 .. 2)
@function gg(x, y) = (x^4 + y^4 - 1) * (x^2 + y^2 - 2) + x^5 * y
C = @constraint gg(x, y) <= 0
p = pave(C, dom, 0.01)

plot(p.inner, lw=1, ratio=1, lab="f(x, y) ≤ 0", title="")
plot!(p.boundary, lw=1, ratio=1, lab="boundary")

Screenshot from 2020-09-11 14-41-28

@dpsanders
Copy link
Member

dpsanders commented Sep 11, 2020

These days I would tend to do that using ModelingToolkit and a standard Julia function instead:

using IntervalConstraintProgramming, IntervalArithmetic, ModelingToolkit, Plots

dom = IntervalBox(-2..2, -2..2)
	
gg(x, y) = (x^4 + y^4 - 1) * (x^2 + y^2 - 2) + x^5 * y
	
vars = @variables x, y
	
C = Separator(vars, gg(x, y) < 0)
p = pave(C, dom, 0.05)
	
plot(p.inner, lw=0, ratio=1, lab="f(x, y) ≤ 0", title="")
plot!(p.boundary, lw=0, ratio=1, lab="boundary")

@lucaferranti
Copy link
Member

We have an example about ModelingToolkit with ICP.jl in the webpage now: https://juliaintervals.github.io/pages/tutorials/tutorialConstraintProgramming/#constraint_programming_with_modelingtoolkit

@mforets
Copy link
Contributor Author

mforets commented Feb 23, 2021

=> this issue can be closed i suppose.

@mforets mforets closed this as completed Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants