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.

Thanks in advance.

New contributor
Don Quijote is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ Big-M constraints are usually (always?) inequalities. $\endgroup$ Jun 23 at 17:51
  • $\begingroup$ I'm not clear what you're trying to do here. In AMPL you're normally solving for all model variables simultaneously; "get a negative value and then make it zero" isn't how it usually works. $\endgroup$ Jun 24 at 0:05


Your Answer

Don Quijote is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.