Questions tagged [pyomo]

Pyomo is a Python-based open-source software package that supports a diverse set of optimization capabilities for formulating, solving, and analyzing optimization models.

1504 questions
3
votes
2 answers

Define parameter in pyomo from pandas DataFrame

First time pyomo user here. I have a function that defines a model def define_problem(SET_gen, SET_time, SET_buses, demand): model = pyo.ConcreteModel() #Define sets model.SET_GEN = pyo.Set(initialize =…
CamiloMagnere
  • 43
  • 1
  • 8
3
votes
2 answers

Why am I getting an unallowed character error in Pyomo with CPLEX?

I am trying to use CPLEX with a simple Pyomo example: from pyomo.environ import * model = ConcreteModel() model.x = Var( initialize=-1.2, bounds=(-2, 2) ) model.y = Var( initialize= 1.0, bounds=(-2, 2) ) model.obj = Objective( expr=…
Jim
  • 105
  • 1
  • 7
3
votes
2 answers

Conda list shows python package but error 'module not found' occurs

I am forced to work on windows and I need to install pyomo. Seems like anaconda is the way to do that. I installed the package via conda install and conda list also shows me that it's installed. But when I run jupyter notebook via the anaconda…
programmar
  • 594
  • 6
  • 19
3
votes
1 answer

Pyomo: Error No value for uninitialized NumericValue object Pyomo

I have a problem with a new algorithm, here I show my code to understand it better. import pyomo.environ from pyomo.core import * from pyomo.opt import SolverFactory model = ConcreteModel() model.JOBS = RangeSet(1,3) model.STATIONS =…
Carlos Dlc
  • 81
  • 1
  • 1
  • 6
3
votes
1 answer

Accessing constraints/objective

I'm using a toolbox that internally calls Pyomo to solve an optimization problem. I am interested in accessing the Pyomo model it constructs so I can modify the constraints/objective. So my question is, suppose I get the following output:…
3
votes
1 answer

Pyomo Setting bounds of indexed variables differently

I am trying to create an indexed variable in pyomo, but I want to sets the bounds of the various indexes differently like this: model.vProduct = Var(SC, N, G, bounds=(0, limit[g]) Where SC, N and G are ranges so it has 3 indexes. (Which dos not…
Christian P
  • 83
  • 2
  • 12
3
votes
0 answers

Pyomo: ERROR: evaluating expression: No value for uninitialized NumericValue object

I am working on an Pyomo optimization script. It is moderately complex with indexed parameters and variables and 8 constraints. If I leave the decision variables with no initial value, I get "ERROR: evaluating expression: No value for…
David Oliver
  • 127
  • 2
  • 9
3
votes
1 answer

Pyomo Blocks: indexed vs not-indexed blocks on time-dependent problems

The Pyomo book proposes this structure of blocks for a time-dependent problem. There is a Pyomo Block 'Electrical Grid Model' which is repeated for every time step, means indexed by the time series. model.T = range(120) def…
programmar
  • 594
  • 6
  • 19
3
votes
1 answer

Using Pyomo with PyInstaller

Is it possible to create a standalone executable file with PyInstaller which solves an optimization problem with Pyomo? For example, I can solve the optimization problem min_x {2*x_1 + 3*x_2 : x_i >= 0, 3*x_1 + 4*x_2 >= 1} by creating a file…
Garrett
  • 181
  • 5
3
votes
4 answers

Retrieving Pyomo solution without using for loop

I am struggling to find an efficient way of retrieving the solution to an optimization problem. The solution consists of around 200K variables that I would like in a pandas DataFrame. After searching online the only approaches I found for accessing…
Jasper
  • 93
  • 1
  • 9
3
votes
1 answer

Using GAMS/CPLEX from Python PYOMO

I noticed that Pyomo 5.3 offers a GAMS solver plugin. https://github.com/Pyomo/pyomo/blob/master/pyomo/solvers/plugins/solvers/GAMS.py This is very exciting, as we have a GAMS/CPLEX license where we can use CPLEX as solver, but only via GAMS. With…
Theo
  • 53
  • 2
  • 5
3
votes
1 answer

How do I save a Pyomo solution and reload into a separate runtime environment?

My optimizations take several hours to solve on a high performance server. I want to save solutions to disk then reload them on my laptop into a model instance. This would let me interactively explore the results in a python command line, and…
JosiahJohnston
  • 103
  • 1
  • 9
3
votes
0 answers

SymPy fails to parse pyomo expression containing multi index variable references

I'm trying to parse an expression resulting from optimizing a pyomo model using SymPy. The model contains both simple and indexed variable references, which are represented in the resulting expression like…
omu_negru
  • 4,642
  • 4
  • 27
  • 38
3
votes
1 answer

Error when setting SCIP as solver with PYOMO

I am trying to solve a MILP problem set up in PYOMO whith SCIP as solver. I run the problem from within PyDev using the python ANACONDA interpreter. I can run and solve the problem with other solvers, namely CBC, GLPK, and IPOPT. However, it does…
sasap
  • 33
  • 1
  • 4
3
votes
1 answer

Pyomo constraints for specific range

Following is a part from an optimization code I'm trying to run. from pyomo.environ import * model = ConcreteModel() ## Define sets model.k = Set(initialize=['Diesel','Diesel_hybrid', 'Battery_electric'], doc='Vehicle Type') model.i =…
Adrita
  • 31
  • 1
  • 2