Re: [AMPL 24715] Re: Problem with AMPL and logical constraint _slogcon[1] is not an indicator constraint

Dear Dr. Paras, dear AMPL group,

I am also new to AMPL and get the same CPLEX error, and I can not figure out what’s wrong (probably some syntax error).

I attach the .mod and .dat files.

If I expand the model I get:

maximize WELFARE:
650X[1] + 620X[2] + 536X[3] + 520X[4] + 448X[5] + 378X[6] +
366X[7] - 495X[8] - 477X[9] - 627X[10] - 627X[11] - 354X[12] -
354*X[13];

subject to CONVEXITY[1]:X[1] + X[2] < 1;

subject to CONVEXITY[2]:X[3] + X[4] < 1;

subject to CONVEXITY[3]:X[6] + X[7] < 1;

subject to CONVEXITY[4]:X[8] + X[9] < 1;

subject to CONVEXITY[5]:X[10] + X[11] < 1;

subject to CONVEXITY[6]:X[12] + X[13] < 1;

subject to BALANCE[1,1]:
10X[1] - 9X[8] - 11*X[10] = 0;

Which is suspicious, since there is no line break after the ‘:’ in the convexity constraints.

Thank You

AMPL Google Group a következőt írta (2018. november 1., csütörtök, 18:36:47 UTC+1):

aggrEU_1.dat (753 Bytes)

aggrEU_1.mod (1.82 KB)

The parentheses around the CONVEXITY constraint – a ( at the beginning of the constraint expression and a ) at the end – are causing an error in processing the constraint. You can fix the problem by removing those parentheses, and also changing < to <= :

subject to CONVEXITY {i in conv_bid_sets} :
     sum {j in start_index[i]..end_index[i] }
	(X[j])<=1+eps;

In general, we recommend that you do not put parentheses around a whole constraint expression. Even when the constraint is handled properly, the extra parentheses only make it harder to read.