From 0a9268a9fb78a687ce1f1428805b0efe5d600b1a Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 18 May 2024 20:20:45 +0200 Subject: [PATCH] ok here I discovered `dsense` --- src/base/types/MATModel.jl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/base/types/MATModel.jl b/src/base/types/MATModel.jl index ebdf968ff..b9f9c059e 100644 --- a/src/base/types/MATModel.jl +++ b/src/base/types/MATModel.jl @@ -104,14 +104,18 @@ Extracts the coupling constraints. Currently, there are several accepted ways to function coupling_bounds(m::MATModel) nc = n_coupling_constraints(m) if _mat_has_squashed_coupling(m.mat) + c = reshape(m.mat["b"], length(m.mat["b"]))[n_reactions(m)+1:end] + csense = reshape(m.mat["csense"], length(m.mat["csense"]))[n_reactions(m)+1:end], ( - reshape(m.mat["b"], length(m.mat["b"]))[n_reactions(m)+1:end], - reshape(m.mat["b"], length(m.mat["b"]))[n_reactions(m)+1:end], + [sense in ["G", "E"] ? val : -Inf for (val, sense) in zip(c, csense)], + [sense in ["L", "E"] ? val : Inf for (val, sense) in zip(c, csense)], ) - elseif haskey(m.mat, "d") + elseif haskey(m.mat, "d") && haskey(m.mat, "dsense") + d = reshape(m.mat["d"], nc) + dsense = reshape(m.mat["dsense"], nc) ( - reshape(get(m.mat, "d", fill(-Inf, nc, 1)), nc), - reshape(get(m.mat, "d", fill(Inf, nc, 1)), nc), + [sense in ["G", "E"] ? val : -Inf for (val, sense) in zip(d, dsense)], + [sense in ["L", "E"] ? val : Inf for (val, sense) in zip(d, dsense)], ) else (