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
1 answer

Pandas dataframe to nested dictionary with a name space as None

I have a pd dataframe like this and need to convert into dictionary with a None namespace and dataframe as nested? pandas dataframe data = {None: { 'Periods': {None: 8759}, 'Years': {None: 20}, 'Scenarios': {None: 1}, …
Sa K
  • 31
  • 2
3
votes
1 answer

How to count distinct number of decision variables - Linear programming

I have 5 decision variables (say) x1 - x5, lower bound for each = 5, and upper bound for each = 30 and they are allowed to take only integer values. These decision variables are leveraged to calculate gross margin (via some function), and objective…
3
votes
0 answers

Calculation of standard deviation in pyomo if variance is avaiable

I have constructed a pyomo code in which I calculate the weighted mean of 3 vectors as def meanX_definition(model, i): return m.meanX[i] ==(m.x1[i]+4*m.x2[i]+m.x3[i])/6 m.meanX_const = Constraint(m.N, rule = meanX_definition) And then, I have…
slow_learner
  • 337
  • 1
  • 2
  • 15
3
votes
1 answer

Install IPOPT solver to use with pyomo in windows

How can I install IPOPT solver to use it with pyomo in windows. I tried pip install ipopt but I got this error (ERROR: Failed building wheel for ipopt) I am working on windows 10 and Python 3.7.4
TSobhy
  • 95
  • 1
  • 1
  • 9
3
votes
0 answers

How to solve "Gurobipy.GurobiError: Network error" for running pyomo with gurobi-cloud in docker container

I am running a python application in a docker container that uses pyomo to formulate a mathematical optimization problem and uses the Gurobi-cloud solver (gurobi_direct) to solve the optimization problem. However, the first few times after building…
Pieter86
  • 31
  • 2
3
votes
1 answer

Best way to change the value of an indexed parameter

I am new to Pyomo, and am wanting to know how to change the value of an already existing model parameter that has one or more index. I have seen some examples for scalar parameters, i.e. no index. For example: model5 = ConcreteModel() model5.data2…
Andrewfreestuff
  • 161
  • 1
  • 14
3
votes
2 answers

How to use Pyomo decorator within a class

Below is a simple Pyomo script using the decorator syntax - I would like to understand how to use this syntax within a class - in this case inside Model. None-class version from pyomo.environ import * import random random.seed(1000) model =…
Michael
  • 2,436
  • 1
  • 36
  • 57
3
votes
0 answers

Python pyomo : Maximizing the sum of maximum in the objective function

This problem is an extension of an earlier question I aksed Python pyomo : how and where to store sumproduct involving decision variables (1d array) and fixed data (matrix) (i have solved this piece). Brief background : I am trying to solve an…
3
votes
1 answer

How do you specify for CPLEX to use only one thread in pyomo?

How do you specify for CPLEX to use only one thread in pyomo? CPLEX by default uses up to 32 threads, capped by the number of processors. But how do you specify using pyomo to only use one thread? Assume my code already has the following: import…
JoseOrtiz3
  • 1,785
  • 17
  • 28
3
votes
2 answers

How to specify GAMS solver-specific options through Pyomo?

I am trying to solve an MINLP problem with the ANTIGONE solver (licensed in GAMS), and I am having difficulties to change the advanced settings of the solver. First, I call the solver from Pyomo as follows. solver =…
bburnak
  • 31
  • 2
3
votes
1 answer

How to solve error while using Pyomo in Flask web server?

I try to built web UI for solving optimization problem by using Flask as web framework, Pyomo as optimization library and CBC as optimization engine. The error appear when I call solver while running web server. If I run only optimization task, I…
ssiwapol
  • 33
  • 2
3
votes
2 answers

Constrained Optimization of battery scheduling in microgrid

Given inputs such as electricity consumption, generation from solar panel, price, (All at a given time t), we have a battery, and we want to evaluate how much it should (dis)/charge at any given time. The Problem can be formulated as follows: Pt =…
usman Farooq
  • 151
  • 1
  • 12
3
votes
1 answer

pyomo documentation with function signatures

Where do I find documentation of pyomo functions and their arguments? For example, what arguments does the solve method take? By looking at many examples, I have seen tee and logfile being used, but it must be documented somewhere? Python's…
Michal Kaut
  • 1,421
  • 1
  • 14
  • 25
3
votes
1 answer

Error running Pyomo in a virtual environment

I want to solve an optimization problem with pyomo in a virtual conda-environment. I installed pyomo and the glpk-Solver with "conda install-n envname packagename". When I test the solver I get the following error: (venvconda)…
ni33na
  • 31
  • 2
3
votes
1 answer

using Bonmin Counne and Ipopt for NLP

I want to just be sure that I am eligible to use Bonmin and Couenne for solving just the NLP problem (Still I do not have integer variable) and I am eager to obtain global optimum not local. I also read that Ipopt first search for the global answer…