From ad4595b313a2740d99a22ddf1720325650ef46d1 Mon Sep 17 00:00:00 2001 From: Andrew Freiburger Date: Wed, 26 Aug 2026 14:49:02 -0500 Subject: [PATCH] Sync modelseedpy/fbapkg/objconstpkg.py from freiburgermsu fork File-level sync to the state of this file in freiburgermsu/ModelSEEDpy@971df5d, submitted as an individual PR so each module's divergence can be reviewed independently. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_017rcBA87xipNeaukuFW8N2G --- modelseedpy/fbapkg/objconstpkg.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/modelseedpy/fbapkg/objconstpkg.py b/modelseedpy/fbapkg/objconstpkg.py index 0963e190..4b965b54 100644 --- a/modelseedpy/fbapkg/objconstpkg.py +++ b/modelseedpy/fbapkg/objconstpkg.py @@ -2,31 +2,17 @@ from __future__ import absolute_import -import logging from modelseedpy.fbapkg.basefbapkg import BaseFBAPkg # Base class for FBA packages class ObjConstPkg(BaseFBAPkg): - def __init__(self, model): + def __init__(self,model): BaseFBAPkg.__init__(self, model, "objective constraint", {}, {"objc": "none"}) - - def build_package(self, lower_bound, upper_bound): - return self.build_constraint(lower_bound, upper_bound) - - def build_constraint(self, lower_bound, upper_bound): + + def build_package(self,lower_bound,upper_bound): coef = self.model.solver.objective.get_linear_coefficients( self.model.solver.objective.variables ) - #Check if the constraint already exists and if so, just updating bounds in place - for name in self.constraints["objc"]: - constraint = self.constraints["objc"][name] - existing_coef = constraint.get_linear_coefficients( - constraint.variables - ) - if coef == existing_coef: - constraint.lb = lower_bound - constraint.ub = upper_bound - return constraint return BaseFBAPkg.build_constraint( self, "objc", lower_bound, upper_bound, coef, None )