# Solving equations with iterations

Hi All,
I have to optimize a set of equations that have cyclic iterations. I have a pyomo code as below. I tried with a couple of solvers, but all of them hang. Is there a way to handle cycles?

Thanks and Regards

from pyomo.environ import *

from vmplib import *

import sys

import traceback

#sys.setrecursionlimit(90000)

model = ConcreteModel()

model.limits = ConstraintList()

#Taxpayer v0.2>Taxpayer v0.2 Plan Criterion Set>Start cash>Start cash Value MeasurementMC

model.x8 = Var(within=NonNegativeReals,initialize=1000.0000)

#Taxpayer v0.2>Taxpayer v0.2 Plan Criterion Set>Cash>Cash Value MeasurementMC

model.x4 = Objective()

model.x4.set_sense(maximize)

#Cash model Package>Employment network>Employer>Net salary>Net salary amount>Net salary amount Value MeasurementMC

model.x7 = Var(within=NonNegativeReals,initialize=25000.0000)

#Cash model Package>Cash network>Banker>Savings account>Interest rate>Interest rate Value MeasurementMC

model.x5 = Var(within=NonNegativeReals,initialize=5.0000)

#Cash model Package>Cash network>Taxpayer>Tax>Tax rate>Tax rate Value MeasurementMC

model.x3 = Var(within=NonNegativeReals,initialize=50.0000)

#Cash model Package>Cash network>Saver>Revenue streams>Net income from labor>Net income from labor Value MeasurementMC

model.x6 = Expression()

#Cash model Package>Cash network>Saver>Revenue streams>Income from interest>Income from interest Value MeasurementMC

model.x2 = Expression()

#Cash model Package>Cash network>Saver>Cost structures>Tax payment>Tax payment Value MeasurementMC

model.x1 = Expression()

#Taxpayer v0.2>Taxpayer v0.2 Plan Criterion Set>Cash>Cash Value MeasurementMC

model.x4.set_value(model.x8+model.x6+ model.x2-model.x1)

model.c4 = Constraint(expr=model.x4 >= 0)

#Cash model Package>Cash network>Saver>Revenue streams>Net income from labor>Net income from labor Value MeasurementMC

model.x6.set_value(model.x7)

model.c6 = Constraint(expr=model.x6 >= 0)

#Cash model Package>Cash network>Saver>Revenue streams>Income from interest>Income from interest Value MeasurementMC

model.x2.set_value(model.x4-0.01*model.x5)

model.c2 = Constraint(expr=model.x2 >= 0)

#Cash model Package>Cash network>Saver>Cost structures>Tax payment>Tax payment Value MeasurementMC

model.x1.set_value(model.x2 - 0.01*model.x3)

model.c1 = Constraint(expr=model.x1 >= 0)

def maxz(m):

return m.x4 <= 26666.6666

model.constz = Constraint(rule = maxz)

solver = SolverFactory(‘couenne’)

solver.options[‘max_iter’] = 6000

try:

results = solver.solve(model, tee=True)

except:

traceback.print_exc()

response = {‘error’: ‘error handling request’}

traceback.print_exc()

Dear Rajender,

This forum provides advice for using the AMPL modeling language and system. To get help with Pyomo, post a question on the Pyomo Forum at https://groups.google.com/g/pyomo-forum.