Feasible on GAMS, Infeasible on Pyomo.. why?

11 views
Skip to first unread message

Jungung Choi

unread,
Jul 1, 2024, 11:20:08 AM (7 days ago) Jul 1
to Pyomo Forum
Hi everyone, I am trying to solve the optimization problem in the paper 
'System-level analysis of lignin valorization in lignocellulosic biorefineries'
I solved the problem before using GAMS, and now, to get familiar with Pyomo structure,
I have been trying to solve it by Pyomo.
Unfortunately, I've found that the three constraints conflicts each others together. But it never happened in GAMS.
I have revisited all the data and codes, but there was no error.
I'm wondering if there is an inherent difference between GAMS and Pyomo when it comes to dealing with constraints.
So I hope you guys can help me. Please check the codes and file, thank you :)

In GAMS (no conflicts)
*** Energy Balance
EnergyBal_CB_HeatIn(j,pp)$(jcb(j) and pout_j(j,pp))..
EOUT('Heat',pp) =e= sum((i,p)$(ii(i)+ir(i) and pin_j(j,p)), eta(i,p,'Heat',pp)*FIN(i,p)) ;

EnergyBal_CB_HeatBal(j,pp)$(jcb(j) and pout_j(j,pp))..
kappa*EOUT('Heat',pp) =e= EUT('Heat') + EW + sum(p$(pin(p) and chi('Heat',pp,p)=1), EC('Heat',pp,p)) ;

EnergyBal_HeatUtil(i)$ie(i)..
EUT(i) =e= sum(j$jconv(j), mu(i,j)*X(j)) ;

In Pyomo (confilcts)

        def _rule_EnergyBal_CB_HeatIn():
            self.EnergyBal_CB_HeatIn = ConstraintList()
            set_j = list(self.JCB)
            set_pp = list(self.POUT)
            all_combinations = product(set_j, set_pp)
            for (j,pp) in all_combinations:
                if (j,pp) not in self.POUT_J:
                    continue
                self.EnergyBal_CB_HeatIn.add(self.EOUT['Heat',pp]== sum(self.eta[i,p,'Heat',pp] * self.FIN[i,p]
                                                                        for i in (self.II | self.IR)
                                                                        for p in self.PIN if (j,p) in self.PIN_J and (i,p,'Heat',pp) in self.eta))
        _rule_EnergyBal_CB_HeatIn()    

        def _rule_EnergyBal_CB_HeatBal():
            self.EnergyBal_CB_HeatBal = ConstraintList()
            set_j = list(self.JCB)
            set_pp = list(self.POUT)
            all_combinations = product(set_j, set_pp)
            for (j,pp) in all_combinations:
                if (j,pp) not in self.POUT_J:
                    continue
                self.EnergyBal_CB_HeatBal.add(self.kappa * self.EOUT['Heat',pp] == self.EUT['Heat'] + self.EW + sum(self.EC['Heat',pp,p]
                                                                                                                for p in self.PIN if ('Heat',pp,p) in self.chi and self.chi['Heat',pp,p] == 1))
        _rule_EnergyBal_CB_HeatBal()

        def _rule_EnergyBal_HeatUtil(_m, i):
            return _m.EUT[i] == sum(_m.mu[i,j] * _m.X[j]
                                    for j in _m.JCONV
                                    if (i,j) in _m.mu)
        self.EnergyBal_HeatUtil = Constraint(self.IE, rule=_rule_EnergyBal_HeatUtil)
lig_pyomo0630.xlsx
Ligval_Pyomo_0630.py
Reply all
Reply to author
Forward
0 new messages