Linearity of mod and div operators

13 views
Skip to first unread message

Ronicass

unread,
May 19, 2018, 8:39:39 AM5/19/18
to AMPL Modeling Language
Good evening,
here's my mod file:
param dim;
param c integer
;

set I := 1..dim by 1;
set J := 1..dim by 1;

var x{I,J} integer := 0;
var y{I,J} integer := 0;

minimize touch
:
    sum
{i in I, j in J} x[i,j];
   
s
.t. con1{i in I, j in J}:
        y
[i,j]=c-1;
       
s
.t. con2{i in I, j in J}:
        y
[i,j] <= x[i,j] mod c;
where dim and c are defined and initialized in the dat file.
I am getting the error "Constraint _scon[1] is a nonquadratic nonlinear constraint.", I suppose for the mod operator. The same thing happens when, instead of mod, I use this equivalent expression: x[i,j]-(c*(x[i,j] div c)).
Are the mod and div operators non-linear?
Thanks in advance!

AMPL Google Group

unread,
May 20, 2018, 10:12:21 PM5/20/18
to Ampl Modeling Language
The mod and div operators are not linear, even when the right-hand operand is a constant.

--
Paras Tiwari
am...@googlegroups.com
{#HS:584039207-8107#}
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.



Reply all
Reply to author
Forward
0 new messages