# MINLP problem

Hi everyone! I’m fairly new to Julia.
I’m trying to solve a MINLP problem with Juniper. I have 4 continuous variables (x[1:4]) and a binary variable (xbin).
I have the following relationship between x and xbin:
if x>0
xbin=1
else
xbin=0
end

If xbin=1 an additional cost is inserted in the objective function.
If this cost is little (0.2) xbin should be setted equal to 1, otherwise (i.e. addcost=20) xbin should be 0, but with the following code only one option is considered.
Does anyone knows why this happens? Thanks in advance

``````using Juniper, Ipopt, JuMP, Cbc

#input data
l=70
cost=[0.04,0.19,0.02]
e=[-6.1e-05 7.8e-03 1; 4.4e-04 -4.3e-03 3]
#model
m = Model(with_optimizer(
Juniper.Optimizer;
nl_solver = with_optimizer(Ipopt.Optimizer, print_level = 0),
mip_solver = with_optimizer(Cbc.Optimizer, logLevel=0)
)
)
#upper bounds
up=[58,30,30,28]
#variable
@variable(m, 0<= x[i=1:4]<= up[i])
@variable(m, xbin, Bin)
#NLconstraint
@NLconstraint(m, x-x-x==0)
@NLconstraint(m, (e[1,1]*x^3+e[1,2]*x^2+e[1,3]*x)*xbin+e[2,1]*x^3+e[2,2]*x^2+e[2,3]*x-l==0)
#objective function
It looks like you are missing the constraint between `x` and `xbin`.
``````@constraint(model, x <= up * xbin)