Python API: ModelInstance QCP - Modifier on quadratic objective term

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
Jan
User
User
Posts: 10
Joined: 7 years ago

Python API: ModelInstance QCP - Modifier on quadratic objective term

Post by Jan »

test_qp_modelinstance.txt
Instantiating of electricity dispatch model LP and QCP
(5.23 KiB) Downloaded 311 times
Hello,

I want to instantiate a QCP model with modifiers in the objective function. As an example, the attached file contains the QCP and LP version of a simple electricity dispatch model with objective functions:

Code: Select all

obj_qp..    WELFARE         =E=     dem_a/dem_b*DEM - 1/(2*dem_b)*(DEM*DEM) - COST;
obj_lp..    COST            =E=     sum(g, X(g)*c(g)) + sum(m(g,f), pf(f)*X(g)/eta(g));
Demand DEM and generation X are model variables. The rest are parameters.

Instantiating with modifiers on linear terms (e.g., fuel prices pf or demand intercept dem_a) works well and the model solves to optimality.

However, as soon as I add a modifier on the quadratic objective term, i.e., add demand slope dem_b, instantiating fails. It seems, by adding the modifier on the quadratic term, the solve no longer recognizes the model as quadratic:
=E "General nonlinearity detected in row " 1 ""
=C*** Could not load data from file: Detected 1 general nonlinear rows in model
Is there any way to add a modifier to the quadratic term of a QCP still being able to solve the model as a QCP?

Best regards
Jan

P.S. The attached file reproduces the error under the GAMS version 31.1.0 with the API installed for Python 3.8
User avatar
bussieck
Moderator
Moderator
Posts: 1033
Joined: 7 years ago

Re: Python API: ModelInstance QCP - Modifier on quadratic objective term

Post by bussieck »

Jan,

From the docs (https://www.gams.com/latest/docs/API_PY_OVERVIEW.html): Moreover, GamsModelInstances are not available for quadratic model types (QCP, MIQCP, RMIQCP). You need to solve as NLP. Solvers like KNITRO and IPOPTH should okay on convex QP and QCP formulated as NLP.

-Michael
Jan
User
User
Posts: 10
Joined: 7 years ago

Re: Python API: ModelInstance QCP - Modifier on quadratic objective term

Post by Jan »

Dear Michael,

thanks for the quick reply. I did not see in the documentation. I will give a try to the NLP solution with the solvers you mentioned.

Best
Jan
Post Reply