error msg: Constraint _scon[1] is not convex quadratic since it is an equality constraint.

831 views
Skip to first unread message

shihuai chen

unread,
Oct 28, 2011, 1:00:42 AM10/28/11
to AMPL Modeling Language
Hello,

when I try to run through AMPL with CPLEX solver for my problem as
below:

subject to C3{p in V,q in 1..n-1}:

if (Payload[p,q]=0) && (Payload[p,q+1]!=0) then Reversestop[p] = q+1;

subject to C4{p in V,q in 1..n-1}:

if (Payload[p,q]!=0) && (Payload[p,q+1]=0) then Reversestart[p] = q+1;


I got the error msg:

Constraint _scon[1] is not convex quadratic since it is an equality
constraint.

I suspect it may caused by improper "if -then" statements, would
somebody help me figure out the root cause and afford your proper
representation for this constraints.


Thanks heaps!

Tommy

TommyChen

unread,
Oct 28, 2011, 1:15:39 AM10/28/11
to am...@googlegroups.com

Hello,

representation for these constraints.


Thanks heaps!

Tommy
--
View this message in context: http://old.nabble.com/error-msg%3A-Constraint-_scon-1--is-not-convex-quadratic-since-it-is-an-equality-constraint.-tp32736044p32736044.html
Sent from the AMPL mailing list archive at Nabble.com.

Paul

unread,
Oct 28, 2011, 6:08:14 PM10/28/11
to am...@googlegroups.com
For starters, "not equal" is not a valid constraint in a mathematical programming model, unless you are comparing two integer quantities -- in which case a != b becomes (a >= b+1) OR (a <= b-1).

Robert Fourer

unread,
Oct 30, 2011, 6:32:46 PM10/30/11
to am...@googlegroups.com
In your constraint C3, the part on the left of the = is an expression that
takes the value Reversestop[p] if the condition following "if" is true and
equals 0 otherwise, so your constraint says that Reversestop[p] = q+1 if the
condition is true or 0 = q+1 otherwise -- which is probably not what you had
in mind.

Moreover an if-expression that has a formula involving variables following
the "if" is not a linear expression, and CPLEX is unable to handle nonlinear
= constraints. In fact the only nonlinear constraints that CPLEX can handle
are convex quadratic inequality constraints -- hence the seemingly strange
error message.

To express this sort of constraint in CPLEX, you have to introduce binary
(zero-one integer) variables. In particular if you can define a binary
variable U[p,q] to be constrained such that (Payload[p,q]=0) &&
(Payload[p,q+1]!=0) implies U[p,q] = 1, then you can introduce a constraint

subject to C3{p in V,q in 1..n-1}:

U[p,q] = 1 ==> Reversestop[p] = q+1;

where "==>" is the AMPL logical operator for "implies". Just how and
whether you can define and constrain U[p,q] in the desired way, depends on
how Payload is defined earlier in the model.

Bob Fourer
4...@ampl.com

TommyChen

unread,
Oct 31, 2011, 9:23:29 PM10/31/11
to am...@googlegroups.com

Thanks Bob, I tried the alternative way just as you suggested: D[p,q], E[p,q]
are binary variables.

subject to C3{p in V,q in 1..n-1}:

Payload[p,q]*M + Payload[p,q+1] <= Payload[p,q+1]*D[p,q];



subject to C4{p in V,q in 1..n-1}:

D[p,q] = 1 ==> Reversestop[p] = q+1;

subject to C5{p in V,q in 1..n-1}:

Payload[p,q+1]*M + Payload[p,q]<= Payload[p,q]*E[p,q];

subject to C6{p in V,q in 1..n-1}:

E[p,q] = 1 ==> Reversestart[p] = q+1;

There is no AMPL 5189 error msg anymore when I run it.

However, I still can not solve this problem with cplex solver. I got
following error msg when I run it.


ampl: solve;
CPLEX 12.3.0.0: IBM ILOG CPLEX Optimization Studio Preview Edition good for
85 more days.
The CPLEX Optimizers will solve problems up to 500 variables and 500
constraints.
QP Hessian is not positive semi-definite.
0 MIP simplex iterations
0 branch-and-bound nodes
No basis.

my whole script is as below, please help me figure out the reason, Is it
caused by logical constraints statements?
set U; #Unit scalar set
set V; #Unit scalar set

param P{U}; #original terrain profile
param Q{U}; #target terrain profile
param n>0; #num of pile divisions
param m>0; #maximum passes
param BS>0; #blade size
param DW>0; #dozer weight
param T{V}; #Passes penalizing factors
param M; #big M method param1

var Payload{p in V,q in U}; #blade payload matrix during movement
var Movements{p in V,q in U}; #dirt movements matrix during movement
var Reversestop{p in V} integer; #reverse path start scalar
var Reversestart{p in V} integer; #reverse path stop scalar
var D{p in V,q in U} binary;
var E{p in V,q in U} binary;

minimize Total_Cost:

sum {p in 1..m-1, q in U}
(T[p]*((DW+Payload[p,q])+DW*(Reversestart[p]-Reversestop[p+1])));


subject to C1{p in V,q in U}: 0<= Payload[p,q] <=BS;

subject to C2 {p in V,q in U}:

Payload[p,q] = sum{k in 1..q} Movements[p,k];

subject to C3{p in V,q in 1..n-1}:

Payload[p,q]*M + Payload[p,q+1] <= Payload[p,q+1]*D[p,q];



subject to C4{p in V,q in 1..n-1}:

D[p,q] = 1 ==> Reversestop[p] = q+1;

subject to C5{p in V,q in 1..n-1}:

Payload[p,q+1]*M + Payload[p,q]<= Payload[p,q]*E[p,q];

subject to C6{p in V,q in 1..n-1}:

E[p,q] = 1 ==> Reversestart[p] = q+1;

subject to C7{p in V}: sum{q in U} Movements[p,q]==0;

subject to C8{q in U}: sum{p in V} Movements[p,q]==P[q]-Q[q];

Thanks!

Tommy

> --
> You received this message because you are subscribed to the Google Groups
> "AMPL Modeling Language" group.
> To post to this group, send email to am...@googlegroups.com.
> To unsubscribe from this group, send email to
> ampl+uns...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ampl?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/error-msg%3A-Constraint-_scon-1--is-not-convex-quadratic-since-it-is-an-equality-constraint.-tp32736044p32756497.html

TommyChen

unread,
Nov 1, 2011, 10:17:47 PM11/1/11
to am...@googlegroups.com

Dear Bob,

Thank you for your guidance! would you help check if my binary variables
expression sound?

prototype:

for p=1:m
for q=1:n
{ if Payload[p,q]=0 && Payload[p,q+1]>0, then Reversestop=q+1
if Payload[p,q]>0 && Payload[p,q+1]=0, then Reversestart=q+1
}
end
end

In AMPL:


var D{p in V,q in U} binary; #binary variables

var E{p in V,q in U} binary; #binary varaibles

subject to C3{p in V,q in 1..n-1}:

Payload[p,q]*M + (1-D[p,q])*BS + 0.01 <= Payload[p,q+1];

subject to C4{p in V,q in 1..n-1}:

D[p,q] = 1 ==> Reversestop[p] = q+1;

subject to C5{p in V,q in 1..n-1}:

Payload[p,q+1]*M + (1-E[p,q])*BS + 0.01 <= Payload[p,q];

subject to C6{p in V,q in 1..n-1}:

E[p,q] = 1 ==> Reversestart[p] = q+1;


unfortunately, when I run with it, AMPL with CPLEX comes out with below msg:


CPLEX 12.3.0.0: iisfind 1

Refine conflict on 212 members...

Iteration Max Members Min Members
1 159 0
2 133 0
3 120 0
4 113 0
5 110 0
6 83 0
7 43 0
8 23 0
9 13 0
10 11 0
11 10 0
12 4 0
13 4 1
14 4 2
15 4 3
16 4 4
IBM ILOG CPLEX Optimization Studio Preview Edition good for 84 more days.


The CPLEX Optimizers will solve problems up to 500 variables and 500
constraints.

CPLEX 12.3.0.0: integer infeasible.


0 MIP simplex iterations
0 branch-and-bound nodes

Returning an IIS of 2 variables and 2 constraints.
No basis.

suffix iis symbolic OUT;


Thank you!

Tommy

> --
> You received this message because you are subscribed to the Google Groups
> "AMPL Modeling Language" group.
> To post to this group, send email to am...@googlegroups.com.
> To unsubscribe from this group, send email to
> ampl+uns...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ampl?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/error-msg%3A-Constraint-_scon-1--is-not-convex-quadratic-since-it-is-an-equality-constraint.-tp32736044p32763105.html

Robert Fourer

unread,
Nov 4, 2011, 1:54:21 PM11/4/11
to am...@googlegroups.com
CPLEX finds that your formulation has no feasible solution in which all of
the integer variables are actually integer-valued. I can't be sure of the
correctness of your expressions since they contain certain
variables/parameters whose definitions and values are not given. But in any
case you need to figure out why there is no feasible solution. The IIS
feature may help, but you need to follow the instructions in the AMPL-CPLEX
documentation to display those variables and constraints that are in the
IIS.

Bob Fourer
4...@ampl.com


> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com]
> On Behalf Of TommyChen
> Sent: Tuesday, November 01, 2011 9:18 PM
> To: am...@googlegroups.com
> Subject: RE: [AMPL 5193] error msg: Constraint _scon[1] is not convex
> quadratic since it is an equality constraint.
>

TommyChen

unread,
Nov 7, 2011, 10:35:28 PM11/7/11
to am...@googlegroups.com

Thank you for your advice! I will make an effort to use IIS to locate the
source of infeasibility.

> --
> You received this message because you are subscribed to the Google Groups
> "AMPL Modeling Language" group.
> To post to this group, send email to am...@googlegroups.com.
> To unsubscribe from this group, send email to
> ampl+uns...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ampl?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/error-msg%3A-Constraint-_scon-1--is-not-convex-quadratic-since-it-is-an-equality-constraint.-tp32736044p32800973.html

Reply all
Reply to author
Forward
0 new messages