# How to make unconstrained variables non-negative (as in excel solver) in AMPL?

This is a sequencing problem.

I've got this variables

var z0{i in jobs} binary;
var z{i in jobs, j in jobs : i <> j} binary;
var w{i in jobs, j in jobs : i <> j};
var o{i in jobs};


i and j come from the same set, so z0i is 1 if it's the first job in the sequence, 0 otherwise. zij is 1 if j is after i, 0 otherwise.

I want to calculate w and o with this:

subject to rnueve {i in jobs, j in jobs : i <> j}: (x[j]-f[i]) - 10000 * (1 - z[i,j]) = w[i,j];

subject to rdiez {i in jobs}: x[i] - 10000 * (1 - z0[i]) = o[i];


The thing is, I need to put the M in from of it so when j is not after i, the variables o and w are super negative.

After that, I need to make those negative values equal to zero, but I don't know how without having to make the solution nonlinear.

In excel's solver, there's a button that does this. You mark: Make unconstrained variables non-negative. And this does what I described.

If I try to make w and o >= 0 I get an infeasible solution because, with the big M, there is no posible way to find a solution with w and o being non negative.

What i want to do is get a negative value, and then if it's actually negative, make it zero.