Skip to content Skip to sidebar Skip to footer

Gekko Error: Matrix Is Structurally Singular. How Can Solve It?

I am trying to follow the suggestions from: How to apply m.connection from Gekko using arrays? and now I am getting these errors: Error return from MC23A because matrix is structur

Solution 1:

To run the script, I uncommented this region of the code:

hocl=m.Array(m.Var,2)
nh3=m.Array(m.Var,2)
nh2cl=m.Array(m.Var,2,lb=1e-10)
nh2cl_meas=m.Array(m.Param,2)
nhcl2=m.Array(m.Var,2,lb=1e-10)
h=m.Array(m.Var,2)
oh=m.Array(m.Var,2)
I=m.Array(m.Var,2,lb=1e-10)
ocl=m.Array(m.Var,2)
nh4=m.Array(m.Var,2)
h2co3=m.Array(m.Var,2)
hco3=m.Array(m.Var,2)
co32=m.Array(m.Var,2)
alk=m.Array(m.Var,2)
DOC1=m.Array(m.Var,2)
DOC2=m.Array(m.Var,2)
cnh3=m.Array(m.Var,2)
cnh2cl=m.Array(m.Var,2)

The code runs but gives suspicious results with negative concentrations or rates.

Negative concentrations

The error Structurally Singular means that there are problems with finding the search direction from solving the Ax=b equation with linear solver in IPOPT. A singular matrix is not invertible. A matrix is singular if its determinant is zero or for numerical solutions if the A matrix has particular properties that prevent the Ax=b solution. There is more information on how that Ax=b linear solve is used in the Interior Point algorithm. For your problem, it is likely because the problem is numerically difficult to solve or that a variable swap in degrees of freedom does not have an associated equation or objective to determine that variable.

Post a Comment for "Gekko Error: Matrix Is Structurally Singular. How Can Solve It?"