CPLEX QP Hessian is not positive semi-definite


I’m trying to run a model for reconfiguring electrical power grids that considers non-technical losses separately. To do this, I’m adding parameters (PDNT and QDNT) and a variable (Isqr_NT) to an existing model (MISOCP) which uses CPLEX. However, it returns this message (CPLEX QP Hessian is not positive semi-definite).

I searched on this forum and found some commands (like option cplex_options ‘reqconvex=3’;), but I was unsuccessful.

Can anybody help me?


set N;					#Set of nodes (buses)
set B within N cross N;	#Set of branches

param Tb{N};			#Node (Bus) type (Load= 0, Subestation= 1)
param PD{N};			#Active demand
param QD{N};			#Reactive demand
param PDNT{N};			#Active demand of nontechnical losses
param QDNT{N};			#Reactive demand of nontechnical losses
param R{B};				#Resistance
param X{B};				#Reactance
param Z2{B};			#Square of the impedance magnitude
param Imax{B};			#Current limit for main branches
param Sbase;			#Base Power
param Vnom;				#Nominal voltage
param Vbase;			#Base voltage
param Vmax;				#Maximum voltage magnitude
param Vmin;				#Minimum voltage magnitude

var Isqr{B} >= 0;		    #Square of the current magnitude
var Isqr_NT{B} >= 0;		#Square of the current magnitude for nontechnical losses
var P{B};				#Active power flow
var Q{B};				#Reactive power flow
var b{B};				#Slack variable
var y{B} >= 0, <= 1;	#Status of the switch
var beta{N cross N} binary;		#For radiality constraint

#Objective function
minimize FO:		#(Per unit)
	sum {(i,j) in B}(R[i,j]*Isqr[i,j]) + sum {(i,j) in B}(R[i,j]*Isqr_NT[i,j]);

subject to active_balance {i in N}:
	sum {(k,i) in B}(P[k,i]) + PS[i] = sum {(i,j) in B}(P[i,j])	+ sum {(i,j) in B}(R[i,j]*Isqr[i,j] + R[i,j]*Isqr_NT[i,j]) + PD[i] + PDNT[i];

subject to reactive_balance {i in N}:
	sum {(k,i) in B}(Q[k,i]) + QS[i] = sum {(i,j) in B}(Q[i,j])	+ sum {(i,j) in B}(X[i,j]*Isqr[i,j] + X[i,j]*Isqr_NT[i,j]) + QD[i] + QDNT[i];

subject to voltage_drop {(i,j) in B}:
	Vsqr[i] = Vsqr[j] + b[i,j] - 2*(R[i,j]*P[i,j] + X[i,j]*Q[i,j]) + Z2[i,j]*Isqr[i,j]+ Z2[i,j]*Isqr_NT[i,j];

subject to current_calculation {(i,j) in B}:
	Vsqr[j]*Isqr[i,j] + Vsqr[j]*Isqr_NT[i,j] >= P[i,j]^2 + Q[i,j]^2;

subject to slack_variable_1 {(i,j) in B}:
	b[i,j] >= -(Vmax^2 - Vmin^2)*(1 - y[i,j]);

subject to slack_variable_2 {(i,j) in B}:
	b[i,j] <= (Vmax^2 - Vmin^2)*(1 - y[i,j]);

subject to current_max {(i,j) in B}:
	Isqr[i,j] + Isqr_NT[i,j] <= Imax[i,j]^2*y[i,j];

subject to voltage_limits {i in N}:
	Vmin^2 <= Vsqr[i] <= Vmax^2;

#Additional constraints to decrease the run time
subject to P_max1 {(i,j) in B}:
	P[i,j] <= Vmax*Imax[i,j]*y[i,j];

subject to P_max2 {(i,j) in B}:
	-Vmax*Imax[i,j]*y[i,j] <= P[i,j];

subject to Q_max1 {(i,j) in B}:
	Q[i,j] <= Vmax*Imax[i,j]*y[i,j];

subject to Q_max2 {(i,j) in B}:
	-Vmax*Imax[i,j]*y[i,j] <= Q[i,j];

subject to radiality1 {(i,j) in B}:
	beta[i,j] + beta[j,i] = y[i,j];

subject to radiality2 {(i,j) in B: Tb[i]==1}:
	beta[i,j] = 0;

subject to radiality3 {(i,j) in B: Tb[j]==1}:
	beta[j,i] = 0;

subject to radiality4 {i in N: Tb[i]==0}:
	sum {j in N: (i,j)in B || (j,i) in B}(beta[i,j])=1;

Your objective function appears to be linear, so the message must be referring to a constraint.

Even with reqconvex=3, CPLEX accepts only quadratic constraints that it can determine to be convex. “QP Hessian is not positive semi-definite” is the usual CPLEX message that appears when a quadratic constraint is rejected for nonconvexity.

To get more specific help, you’ll need to upload a file that contains the complete model. (Note that PS, QS, and Vsqr are used in your model but are not defined in any param or var statements.) If you can upload data, that will also be helpful.

reconfig.dat (872 Bytes)
reconfig.run (383 Bytes)
reconfig_fj.mod (3.0 KB)
sistema33nos.dat (2.6 KB)

Thanks for your help! Here is the files I’m using.
I tried to solve with knitro but it doesn’t work too.

Your constraint current_calculation contains quadratic expressions on both sides:

subject to current_calculation {(i,j) in B}:
	Vsqr[j]*(Isqr[i,j] + Isqr_NT[i,j]) >= P[i,j]^2 + Q[i,j]^2;

CPLEX cannot detect the feasible region for this constraint as being convex, and so this constraint is rejected by CPLEX with the “QP Hessian is not positive semi-definite” message. Setting reqconvex=3 does not make any difference here, because the reqconvex option only affects CPLEX’s handling of convex quadratic objective functions.

You can tell that this is the only nonconvex quadratic expression in the model, because after this constraint is dropped, CPLEX accepts the model:

ampl: drop current_calculation;
ampl: solve;
CPLEX reqconvex=3
CPLEX integer infeasible.
162754 MIP simplex iterations
7288 branch-and-bound nodes

However, now CPLEX reports “integer infeasible” which means that the remaining constraints have no feasible solution with integer values of the y variables.

Knitro accepts all of your constraints (including current_calculation) and terminates successfully with a report that it cannot find a feasible solution:

Knitro 13.2.0: Convergence to an infeasible point. Problem may be locally infeasible.
objective 0.5154911795; optimality gap 1.8e+308
24935 nodes; 25497 subproblem solves

Also you can try Gurobi, which accepts all nonconvex quadratic expressions in the objective and the constraints. However, Gurobi also reports that there is no feasible solution:

Gurobi 11.0.0: infeasible problem
47707 simplex iterations
2841 branching nodes

So, you will need to study the model and data to determine why no integer-feasible solution is possible, after which you can make some corrections so that the problem becomes feasible. Once the feasibility issue is resolved, you can try again solving with Knitro (which finds locally optimal solutions) or with Gurobi 11 (which finds globally optimal solutions, but might take longer).

I found a conceptual error in the model which was resulting in this problem. Once corrected, it was possible to solve using CPLEX. Thank you so much for explanations!