Pyomo is a Python-based open-source software package that supports a diverse set of optimization capabilities for formulating, solving, and analyzing optimization models.
Questions tagged [pyomo]
1504 questions
-1
votes
1 answer
Building a MINLP Heuristic Model in Python
I am currently building a MINLP model which has around 200k decision variables and upto 100 constraints. I have access to only open source solvers which are BONMIN and COUENNE.
When I try to solve the problem, I see that the solver keeps on running…

linearprogrammer
- 53
- 1
- 11
-1
votes
1 answer
How to update the dual variable in the objective function such that it influences the decisions?
In bi-level programming, I have variable that is the dual variable of a constraint of the sub-model. It means that, after a decision is made, the dual variable from the sub-model will be updated in the objective and this changes the decisions.
Is is…

nwa
- 11
- 3
-1
votes
2 answers
obtain parameters from another parameters
How to convert parameters bigger than a certain number into 1 and smaller than a certain number into 0.
For exmaple, I set parameters
model.distance = Param(model.dc,model.location,domain=NonNegativeReals)
param distance :=
DC1 Shelter1 0.61
DC1…

rzhli
- 1
- 1
-1
votes
1 answer
Initializing a pyomo parameter with summed values of a dict
I got a pyomo parameter, which I want to initialize with the values of a python dictionary.
dictionary(example) looks like following:
dict
{('A', 'B', 'x', 'y'): 100,
('A', 'C', 'x', 'y'): 10,
('D', 'E', 'x', 'y'): 20,
('D', 'A', 'x', 'y'):…

oakca
- 1,408
- 1
- 18
- 40
-1
votes
1 answer
Can I model model.a>= max(f(model.x1), g(model.x2)) as constraint in PYOMO
model.a, model.x1 and model.x2 are three variables, f and g are two function. I try to formulate like this to make code concise, but get errors

Xi Duan
- 1
-1
votes
1 answer
Pyomo: AttributeError: 'dict' object has no attribute '__default_objective__'
This https://github.com/amianAA/ALNS has files written in python and pyomo with ALNS algorithm to optimise MINLP railroad network models (applied to Madrid's network). Everything works fine but i got error in this function:
def solveFO(instance):
…

Anas Musah
- 9
- 4
-1
votes
2 answers
Make a list of two indexes in Pyomo (Python)
Good morning,
I've been searching through the internet a way to make a list or table with 2 indexes. Currently I've build a code for 1 index that is mass = list(range(0,value(m.n)+1)) and I fill this list with this expression mass[i] =…
-1
votes
2 answers
Pyomo calling the value of a set
Let us consider the following set:
m.sub_sit = pyomo.Set(
initialize=[site],
doc='site of sub problem')
in this case m.sub_sit is created by create_model() function with the argument 'Mid':
inst = create_model(site='Mid')
what I get by…

oakca
- 1,408
- 1
- 18
- 40
-1
votes
1 answer
Using Pyomo with heuristic solvers
I am using Pyomo to model my optimization problem (MILP) and solve it using Gurobi.
What would be the best, fastest or easiest way to find a heuristic solution using the Pyomo model, knowing that I do not care about the Gap bounds.
Note: I know that…

stepj
- 151
- 1
- 2
- 8
-1
votes
1 answer
Pyomo solves over NVIDIA Cuda
I would like to know if there is a way to solve an Pyomo Concrete Model over a GPU with using the NVIDIA Cuda.
I checked out https://developer.nvidia.com/how-to-cuda-python, and saw a video about it. And It turns out if your input parameters are…

oakca
- 1,408
- 1
- 18
- 40
-1
votes
1 answer
I cant solve my script with cplex or glpk... in python
I wrote my code in python with pyomo...
at the end, when I want to run my script, I've faced this error:
WARNING: "[base]/site-packages/pyomo/solvers/plugins/solvers/GLPK.py", 150, _default_executable
Could not locate the 'glpsol' executable,…

arman nemat pasand
- 21
- 3
-1
votes
2 answers
How can i avoid the getting this error in pyomo "Error retrieving component Pd[1]: The component has not been constructed."
I am new to pyomo. I am trying to run a simple maximization problem, but i keep getting this error message: Error retrieving component Pd[1]: The component has not been constructed. . Only the last 5 constraints give me this problem, the first three…

Juan Arteaga
- 3
- 3
-2
votes
1 answer
Pyomo Buy and Sell Optimization
I'm trying to write a pyomo optimization that takes a non convex set of prices and solves to determine the best time to purchase and sell within that list of prices. However, I'm unable to get the model to converge and finding difficulty with the…

Luemas91
- 1
- 1
-2
votes
1 answer
How do I solve a MILP problem (code) using PYOMO?
I'm trying to solve a MILP problem using PYOMO and gurobi solvers but I'm not sure about the formulation of my code. Can I have an example (code) of how to solve a simple MILP problem please ?
Thank you in advance

Gopee Yanandlall
- 1
- 1
-2
votes
1 answer
Cannot iterate over AbstractOrderedScalarSet 'i' before it has been constructed (initialized): '__iter__' is an attribute on an Abstract component
I am trying to convert impedance into admittance by using a for loop, however it does not work and shows that
Cannot iterate over AbstractOrderedScalarSet 'i' before it has been constructed (initialized): '__iter__' is an attribute on an Abstract…

ZHEHAN ZHAO
- 37
- 1
- 1
- 5