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
5
votes
1 answer
Breakdown an integer value to an array of integer maintaining the sum
I am working on a project where I need to breakdown an integer value according to an array of percentage values.
My end array must contain integer value and the sum of the array must be equal to the initial integer.
Below is a fake example. We have…

Michael
- 2,436
- 1
- 36
- 57
5
votes
3 answers
pyomo list available solvers
To instance a solver in pyomo, usually a solver factory is used:
from pyomo.opt import SolverFactory
opt = SolverFactory('glpk')
Is there a way to know which strings will SolverFactory accept?
A solution would look…

jabozzo
- 591
- 1
- 6
- 17
5
votes
1 answer
Setting ipopt options through pyomo
I am having trouble setting the ipopt options through pyomo.
For some options one can simply use
executable = os.getcwd()+'/Ipopt/Ipopt/build/bin/ipopt.exe'
opt = SolverFactory("ipopt",…

Anthonydouc
- 3,334
- 1
- 16
- 29
5
votes
1 answer
How to find which constraint is violated from pyomo's ipopt interface?
I am running an optimization problem using pyomo's ipopt solver. My problem is sort of complicated, and it is declared infeasible by IPOPT. I will not post the entire problem unless needed. But, one thing to note is, I am providing a warm start…

makansij
- 9,303
- 37
- 105
- 183
5
votes
1 answer
Pyomo: constraint with if statements
I am currently trying to solve this problem. I need to maximize the profit of this company.
That s the code I currently have:
from pyomo.environ import *
from pyomo.opt import *
opt = solvers.SolverFactory("ipopt")
model =…

pat96
- 51
- 1
- 2
5
votes
1 answer
Python/Pyomo error within JModelica
I have installed a commercial solver package (OCT) for JModelica (python-based) --> When I want to open JModelica via "Ipython" i get the following error message:
Traceback (most recent call last):
File…

AssMero
- 239
- 1
- 5
4
votes
1 answer
Pyomo Cannot iterate over abstract Set before it has been constructed
I constructed an abstract model in Pyomo and it worked well.
However, when I try to use a dictionary to instantiate the abstract model, I got the following errors "ERROR: Rule failed when generating expression for objective value:
RuntimeError:…

Wilson
- 125
- 8
4
votes
1 answer
How do I add a matrix constraint `Ax=b` to a Pyomo model efficiently?
I want to add the constraints Ax=b to a Pyomo model with my numpy arrays A and b as efficient as possible. Unfortunately, the performance is very bad currently. For the following example
import time
import numpy as np
import…

PanchoVarallo
- 145
- 1
- 9
4
votes
3 answers
How to install CBC for Pyomo locally on Windows machine?
My goal is to connect the open-source CBC solver with Pyomo in Spyder. I am working on a Windows 10 machine and it is not an option for me to use the NEOS server due to company policy.
I have downloaded the binaries from Bintray…

SimonLindahl
- 41
- 1
- 2
4
votes
1 answer
How to access objective function value in pyomo?
I am trying to output the objective value from my pyomo model. I did access to the variable values but I cannot get access to the objective function value. My codes are:
instance = model.create_instance(data)
opt = SolverFactory('cplex')
results…

StillLearning
- 43
- 1
- 4
4
votes
2 answers
How can I set a value of an indexed variable? - Pyomo
I'm working on a project related with AC OPF (Optimal Power Flow) and I was trying to solve a problem in python, using pyomo.
There are 3 buses and the bus voltage and bus angle are limited. However, the 1st bus must have a voltage=1 and an angle=0.…

cata oliveira
- 41
- 3
4
votes
1 answer
how to write piecewise linear objective function in Pyomo
I want to create a linear model in Pyomo that has piecewise linear function in its objective function.
I managed to create the following code:
model = AbstractModel()
breakpoints = [-5,0,5]
values = [10,0, 10]
model.X = Var(bounds=(-5,5))
model.Y=…

kfurmanska
- 51
- 4
4
votes
0 answers
AttributeError: Module 'pip' has no attribute 'logging'
I'm new to Python and have been trying to install pyomo on windows.
I've installed python version 3.7.3
Following pyomo documentation (http://www.pyomo.org/installation), I've installed the module using pip:
pip install pyomo
after I've run
pyomo…

Presti
- 41
- 1
4
votes
1 answer
How to use (/install) the pardiso linear solver in ipopt using the pyomo modelling framework?
I am developing an optimization model using pyomo with python (python 3 - i manage packages with anaconda on windows). I need to use a non-linear solver, ipopt. It seems that the default linear solver used by ipopt (mumps or ma27) is relatively slow…

Jean Martin
- 81
- 3
4
votes
2 answers
How to use/choose/install a Mixed-Integer Nonlinear solver in pyomo
Online I can read that it is posible to solve Mixed-Integer Nonlinear problems with pyomo. But I don´t understand how.
I solved problems with “glpk” and “ipopt” solvers but both don´t work for my current problem (ipopt doesn´t respect a boolean…

Schn5
- 129
- 2
- 8