Hello @odow , I know this is an old post but I think my problem is related to the one you were discussing here.
I think I can provide an example:
model = Model(Ipopt.Optimizer)
@variable(model, w >= 0)
@variable(model, -1 <= x <= 1)
@NLobjective(model, Min, w)
@constraint(model, 2*w == 2)
@NLconstraint(model, x*w + (1-x)*w == 0)
@NLconstraint(model, x^2 * w + (-x)^2 * w == 2/3)
# set_optimizer_attribute(model, "fixed_variable_treatment", "make_parameter_nodual")
termination_status = $(termination_status(model))
primal_status = $(primal_status(model))
objective_value = $(objective_value(model))
println("w = ", value(w), "\nx = ", value(x))
solution_summary(model; verbose = true)
This code should recover Gaussian quadrature points in 1D. There are two points and two weights, but since the problem is symmetric, only two variables are needed. The constraints impose integrating exactly the polynomials 1, x, and x^2.
If one tries to solve the problem by hand, one sees that the first constraint leads to w=1. Then, the second constraint is 0=0, and the third constraint reduces to a second order equation in x, with solution x = 1/sqrt(3) and x=-1/sqrt(3). Therefore, the problem has a unique feasible solution (and agrees with the Gauss integration rule).
However, IPOPT throws the error “too few degrees of freedom”. I have tried all the possible “fixed_variable_treatment” options but the problem persists. Is it possible to solve this issue? Is it possible to disable the check regarding the number of variables and the number of constraints?
Thank you very much,
EDIT: There was a copy-paste error detected by odow. The second constraint should read
@NLconstraint(model, x*w + (-x)*w == 0). Unfortunately, this change does not solve the problem though.