hdavid16 / DisjunctiveProgramming.jl

A JuMP extension for Generalized Disjunctive Programming
MIT License
27 stars 3 forks source link

infer bigM needs to support `@NLconstraint` #5

Closed hdavid16 closed 3 years ago

hdavid16 commented 3 years ago

prelim code:

using JuMP

m=Model()
@variable(m,0<=x[i=1:2]<=1)
@variable(m,0<=y<=1)
@NLconstraint(m,e[i=1:2],exp(x[i]) + y >= 0)

e1 = string(e[1])
e1split = split(e1," ")
idx = findfirst(part -> occursin(r"[>=,<=,==]",part), e1split)
e1join = join(e1split[1:idx-1])

vars = all_variables(m)
varnames = [split(string(var),"[")[1] for var in vars]
union!(varnames)