What are the exact limitations on the Freeze Model capability?

Hi all,

I am exploring the Freeze model capability to solve models iteratively for various scenarios. I encountered few challenges:

  • parameter in the non-linear term:
    I tried to add to modifiables the parameter that is involved in the coefficient of the quadratic term of the QP objective function. It produces the following error:
GamsException: Could not load model instance: Detected 1 general nonlinear rows in model

- parameter that is involved in calculations of other parameters:
I have a parameter, which is an aggregation of scalars, that I do not have only in the model equations but also to calculate values of other parameters (before solving). When I add such a parameter to modifiables I get a GAMS error:

**** The following parameters were remapped into variables
**** scalars_mod
**** The resulting model is invalid. The following errors were detected
**** Parameter symbol scalars_mod not part of model

My question is what are the exact limitations of freeze function in terms of parameters? Are the ones above bugs or intended limitations? I understand the second one, but if this is a limitation, it should probably throw an error on the Python side before being compiled in GAMS. The second one I don’t understand why the coefficient at the non-linear term cannot be changed.

Best,

Adan

Hi,

Frozen models do have limitations. GAMSPy implements the update mechanism to frozen models by turning the parameters into variables and fixes these variables at the value provided by the user. This all works well if the resulting model is a linear or a general non-linear model. It does not work well with model with quadratic terms when the solver link extracts the quadratic terms from the model instance. First, the extraction does not work properly because the term is not quadratic any more (there is another variable even if it is fixed, this is where the error you get originates) and secondly, many solvers that extract the quadratic terms don’t allow to update these quadratic terms efficiently (e.g. Gurobi). So for solvers that extract the quadratic terms (like Cplex, Gurobi, Xpress, …) frozen models do not work if you have modifiable parameters that effect the quadratic term. Other solvers, e.g. Ipopt, Knitro, or Conopt should work okay, because they don’t extract the quadratic term but just work with general gradients and second order information.

The second part of your question is not clear to me. The error message indicates that the parameter scalars_mod is actually not part of any equation definition. Perhaps, you can share a small example that demonstrates this error and then we can see more clearly what is going on.

-Michael