I want do the following in JuMP but I don’t know how to do it. Suppose I already have a model m. In model m, I defined variables x (for simplicity let’s just represent all the variables in x, which is a R^n vector). I also have nonlinear constraints g(x)<=0 in model m. The nonlinear constraints are defined using macro @NLconstraint. In this case, g(x)<=0 could correspond to several @NLconstraint we defined in a JuMP model. Now, I want to generate a new model n based on model m. In model n, I have variables y, which is R^n, and variable lambda, which is R^1. I want to define constraint lambda*g(y/lambda)<=0 in model n, which is like the perspective function of g(x).
Suppose someone else give me a model m written in JuMP, it there some ways to generate the corresponding model n in JuMP automatically by writing a parser?
More specifically, I guess my question is 1. how to obtain the expression in NLconstraint?
2. Is there some symbolic library in Julia that can do the following: given an expression g(x), is there any ways to generate the expression lambda*g(x/lambda)? Also would the symbolic library work for the expression in JuMP? If not, how to translate a JuMP expression to an expression that can be parsed by the symbolic library?
Thanks a lots!