In reply to dave_59:
Hi Dave,
Thanks for your response.
Exactly, i and j are just a nesting of foreach.
Assume there is an auxiliary array storing the difference between respective elements of pos and neg arrays. Something like:
foreach(aux[i]) aux[i] = pos[i] - neg[i];
Then, the third constraint could be expressed in pseudocode as:
aux[i].max() - aux[i].min() <= relative_c;