<jupyter_start><jupyter_text>The following commands are used to declare data:- The set command declares set data.- The param command declares a table of parameter data, which can also include the declaration of the set data used to index the parameter data.- The table command declares a two-dimensional table of parameter data.- The load command defines how set and parameter data is loaded from external data sources, including ASCII table files, CSV files, XML files, YAML files, JSON files, ranges in spreadsheets, and database tables.The following commands are also used in data command files:- The include command specifies a data command file that is processed immediately.- The data and end commands do not perform any actions, but they provide compatibility with AMPL scripts that define data commands.- The namespace keyword allows data commands to be organized into named groups that can be enabled or disabled during model construction.The following data types can be represented in a data command file:- Numeric value: Any Python numeric value (e.g. integer, float, scientific notation, or boolean).- Simple string: A sequence of alpha-numeric characters.- Quoted string: A simple string that is included in a pair of single or double quotes. A quoted string can include quotes within the quoted string<jupyter_code># sodacan-pyomo.py

from pyomo.environ import *
from math import pi

m = ConcreteModel()

m.r = Var(bounds=(0,None))
m.h = Var(bounds=(0,None))

m.o = Objective(expr=2*pi*m.r*(m.r + m.h))
m.c = Constraint(expr=pi*m.h*m.r**2 == 355)

solver = SolverFactory('ipopt')
status = solver.solve(m)

print("Status = %s" % status.solver.termination_condition)

print("%s = %f" % (m.r, value(m.r)))
print("%s = %f" % (m.h, value(m.h)))
print("Objective = %f" % value(m.o))<jupyter_output>Status = optimal
r = 3.837215
h = 7.674430
Objective = 277.545024<jupyter_text>Telecom Tower Problem<jupyter_code>from pyomo.environ import *
from math import pi

m = ConcreteModel()

m.x = Var(initialize=1e-10)#(bounds=(1e-10, None))
m.y = Var(initialize=1e-10)#(bounds=(1e-10, None))

m.a = Param([1,2,3,4],  initialize={1:0, 2:-110, 3:-130, 4:-250})
m.b = Param([1,2,3,4],  initialize={1:0, 2:60, 3:20, 4:100})

m.c1 = Constraint(expr= ((m.x - m.a[1])**2 + (m.y - m.b[1])**2)**0.5 <= 160)
m.c2 = Constraint(expr= ((m.x - m.a[2])**2 + (m.y - m.b[2])**2)**0.5 <= 160)
m.c3 = Constraint(expr= ((m.x - m.a[3])**2 + (m.y - m.b[3])**2)**0.5 <= 160)
m.c4 = Constraint(expr= ((m.x - m.a[4])**2 + (m.y - m.b[4])**2)**0.5 <= 160)
m.o = Objective(expr= 
                ((m.x - m.a[1])**2 + (m.y - m.b[1])**2)**0.5 + \
                ((m.x - m.a[2])**2 + (m.y - m.b[2])**2)**0.5 + \
                ((m.x - m.a[3])**2 + (m.y - m.b[3])**2)**0.5 + \
                ((m.x - m.a[4])**2 + (m.y - m.b[4])**2)**0.5 , sense=minimize)

solver = SolverFactory('ipopt')
status = solver.solve(m)

print("Status = %s" % status.solver.termination_condition)

print("%s = %f" % (m.x, value(m.x)))
print("%s = %f" % (m.y, value(m.y)))
print("Objective = %f" % value(m.o))
m.a[2]
(250**2 + 0**2)**0.5<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17860584645036942, 'fraction_numerical': 0.04786379698040476, 'mean_word_length': 3.8962264150943398, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '190625', 'license': 'MIT', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1140, 'n_words': 343, 'path': 'IIMB-Assignments/Assgn-4/ref/NLP-pyomo-exampla.ipynb', 'repo_name': 'rahasayantan/Work-For-Reference', 'size': '3113'}