As I answered on mail to you, you have to do modelling using binary variables and implies operators.
if x == y
z should be 5
end
Model= [implies(x == y, z = 5)]
This is a very ill-conditioned model though if x and y are continuous variables, as the condition is pretty much undefined when |x-y| is smaller than the solver tolerance (starting at, say, 1e-6)
Generally, try to write logical models as implies(binary variable, condition) and then impose logics using additional constraints on the binary variables. That way, you know what you are doing and nothing strange can happen
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Commands.ImpliesThe model above would be something like
binvar negative positive zero
margin = 0.001 % or whatever you think is close enough to zero)
Model = [implies(negative, x <= y-margin), implies(zero, -margin <= x - y <= margin), implies(positive, x >= y + margin)];
Model = [Model, implies(zero, z == 5);
Model = [Model, negative+zero+positive == 1]
As always in big-M based models, you have to explicit good bounds on all involved variables (x and y)