All command in mcp problems

Instead of matching each equation with each variable, in GAMS you can use the all command for MCP problems; can the same be done with gamspy? I haven’t found anything.

Hi Marc,
This is possible, but in this case, GAMS will do the matching for you… which then requires that only free (unbounded) variables and equality constraints show up in your model. See: Model and Solve Statements for the matching logic for MCPs in GAMS.

In GAMSPy, you can just leave out the matches keyword in the Model object, and instead pass equations=m.getEquations() to indicate the model should include all equations.

best,
adam

1 Like

Hi adam
I tried to do what you told me with a model that was already working well with the matching done. The model meets the necessary requirements for automatic matching, but it works fine—I simply deleted the matching part and added what you told me. It gives me the following error:

**** Unmatched free variables = 6
prim_fact(NPI)
prim_fact(HH)
prim_fact(GOV)
prim_fact(FC)
prim_fact(NFC)
prim_fact(ROW)

**** Number of unmatched =E= rows : 65
mktp(g1)
mktp(g2)
mktp(g3)
mktact(a1)
mktact(a2)

with the model defined as:

C = Model(
m,
“C”,
problem=Problem.MCP,
equations= m.getEquations(),
)

It appears that you do not have a square system if you use the m.getEquations() syntax – which results in unmatched equations and variables. Are you sure you really want to use this syntax to define your model? Perhaps you can share your working example and the most recent attempt? If this is not possible on a public forum please write to support@gams.com and we can continue the conversation there.