Ajay Joshi wrote: > Hi, > I have the following code > > var x{NODES} integer; > var y{NODES} integer; > . > . > . > . > . > s.t. dist{i in NODES, j in NODES}: dis[i,j] = abs(x[i] - x[j]) + > abs(y[i] -y[j]); > > When I ran this code using glpsol, it gave me an error > > wpm.mod:75: argument for abs has invalid type > Context: , j ] == 1 ) then dis [ i , j ] = abs ( x [ i ] - x [ j ] ) > Model processing error > > > How do I correct this error? > > Thanks, > Ajay >
The abs() function cannot be used on variables since it introduces nonlinearity. It is available for expressions that involve parameters only. To do what you are trying with GLPK, you will probably need to use integer variables. Exactly how to do it depends a bit on the rest of your model. Brady -- Brady Hunsaker Assistant Professor Industrial Engineering University of Pittsburgh http://www.engr.pitt.edu/hunsaker/ _______________________________________________ Help-glpk mailing list Help-glpk@gnu.org http://lists.gnu.org/mailman/listinfo/help-glpk