Questions tagged [pyomo]

0

votes
0

answer
8

Views

Python does not interpret pyomo as a package

I am having problems importing the pyomo environment. from pyomo.environ import * ModuleNotFoundError: No module named 'pyomo.environ'; 'pyomo' is not a package However, pyomo does appear under conda list. I know there has been an issue or two that is similar to mine. I did try to read them but have...
vbjerknes
1

votes
0

answer
6

Views

Get coefficients of a polynomial pyomo constraint

In addition to the question here I would like to know how to obtain the coefficients of an arbitrary polynomial constraint of a pyomo model. So, for m= ConcreteModel() m.x_1 = Var() m.x_2 = Var() m.x_3 = Var(within = Integers) m.x_4 = Var(within = Integers) m.c= Constraint(expr=2*m.x_1**2 + 5*m.x_1*...
Nat1
1

votes
2

answer
319

Views

How to define an Integral as an objective function in pyomo?

I want to be able to define an integral in pyomo as part of an objective function. I cannot figure out what kind of expression is needed for the integral. Here's my best guess: model = ConcreteModel() model.t = ContinuousSet(bounds = (0,1)) model.y = Var(model.t) model.dydt = DerivativeVar(model.y,...
simple
0

votes
0

answer
2

Views

How to Setup ASL Solvers in Pyomo

I am using Pyomo on Windows. I wanted to use nonlinear solvers such as BONMIN and I noticed that they are available using ASL. How can I use ASL?
Arthur
2

votes
1

answer
121

Views

Use Gurobi's presolve function for a pyomo model

Using gurobipy, I can presolve a mixed integer linear optimization model by calling the presolve function, i.e. model = read('milp.mps') model.presolve(). I would like to apply Gurobi's presolving step to some model, which is only restricted by the linear constraints of a mixed integer nonlinear py...
Christoph Neumann
3

votes
2

answer
2.2k

Views

Pyomo: Access Solution From Python Code

I have a linear integer programme I want to solve. I installed solver glpk (thanks to this answer) and pyomo. I wrote code like this: from pyomo.environ import * from pyomo.opt import SolverFactory a = 370 b = 420 c = 2 model = ConcreteModel() model.x = Var([1,2], domain=NonNeg...
ken_a
3

votes
2

answer
942

Views

How to set Pyomo solver timeout?

How to set the timeout for Pyomo solve() method ? More specifically, to tell pyomo, after x seconds, return the optimal solution currently found ?
zyzo
1

votes
1

answer
433

Views

Installing/Running Pyomo (command not found)

I installed Pyomo on my Ubuntu 15.10 according to the install guide using pip install pyomo which worked fine and returned Successfully installed pyomo PyUtilib appdirs ply nose six. (I installed pip and scientific python first.) However, if I now test it with pyomo --help, I get pyomo: command not...
CGFoX
2

votes
1

answer
366

Views

Python/Pyomo with glpk Solver - Error

I am trying to run some simle example with Pyomo + glpk Solver (Anaconda2 64bit Spyder): from pyomo.environ import * model = ConcreteModel() model.x_1 = Var(within=NonNegativeReals) model.x_2 = Var(within=NonNegativeReals) model.obj = Objective(expr=model.x_1 + 2*model.x_2) model.con1 = Constraint(e...
lars111
1

votes
1

answer
349

Views

How to create two dimensional set objects under pyomo.environ module

I tried to create a LP model by using pyomo.environ. However, I'm having a hard time on creating sets. For my problem, I have to create two sets. One set is from a bunch of nodes, and the other one is from several arcs between nodes. I create a network by using Networkx to store my nodes and arcs. T...
whh1294
3

votes
0

answer
70

Views

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 this: simple: simple_var indexed: indexed_var[index_name] where index_name is a value from a p...
omu_negru
1

votes
1

answer
676

Views

Set initial primal and dual values for variables pyomo

I wan't to set initial primal and dual values in a program's variables. Is there a specific way to do this. I can see there is a initialize option in the Var object but i'm not sure how to use it in this manner
iriniapid
3

votes
1

answer
189

Views

How to get `nl` file from `pyomo` from inside `pyomo` script solver?

I am building many models using pyomo, and from what I understand, pyomo reformulates models before solving them. I want to know exactly what the model looks like when it gets passed to the solver files ipopt and couenne. From what I see here it is not clear to me how to get the nl file from a scr...
Hunle
2

votes
1

answer
172

Views

Which characteristics from commercial Algebraic Modeling Languages are still missing from open source ones?

Which characteristics the main commercial Algebraic Modeling Languages (AML), like GAMS or AMPL, have, that open source AMLs, like Pyomo or JuMP, do not yet have (aside obviously the user base and availability of established models) ?
Antonello
2

votes
1

answer
212

Views

Pyomo Ipopt does not return solution

my script is: from __future__ import division import numpy import scipy from pyomo.environ import * from pyomo.dae import * from pyomo.opt import SolverFactory m=ConcreteModel() m.x3=Var(within=NonNegativeReals) m.u=Var(within=NonNegativeReals) def _con(m): return m.x3 >=3 m.con=Constraint(rule=_co...
Paul Rousseau
1

votes
2

answer
300

Views

how to use the ipopt optimizer with pyomo on linux

I've followed the ipopt coinor website instructions and managed to install the ipopt optimizer. That produced some static object files in the build dir, but it did NOT produce any bin folder. Now, when trying to get pyomo to use ipopt, the only way to to that i've seen used is to specify the execut...
omu_negru
2

votes
1

answer
337

Views

Pyomo: Limit number of iterations

I have a Pyomo model that eventually gets solved like so: solver = SolverFactory('ipopt') results = solver.solve(model,tee=False) The model current runs for 3000 iterations before giving up. In my mind, there must be a way to use one of these two lines to limit the number of iterations. How can I d...
Richard
2

votes
1

answer
418

Views

Using PATH AMPL solver with Pyomo on Intel Mac OS X

I'm trying to use the PATH solver (http://pages.cs.wisc.edu/~ferris/path.html) together with Pyomo on Mac OS X (10.11, Intel). I'm using the most recent Anaconda install with Python 3.5. Pyomo can make use of AMPL libraries. From http://prod.sandia.gov/techlib/access-control.cgi/2015/155584.pdf I'm...
JoernR
2

votes
1

answer
158

Views

Pyomo ValueError: PositiveReals is not a valid domain

I'm trying to solve a constraint mixed integer non linear optimization problem using PyOMO. Specifically, I'm trying to find gear diameters and tooth numbers such that two given gear ratios are met. I'm really quite cornfused about how to use Set() and Var(). I've been reading the documentation but...
denbjornen505
1

votes
1

answer
100

Views

Distinguishing between linear and non-linear constraints in Pyomo

How can I distinguish between linear and non-linear constraints in Pyomo? Lets say they all got constructed with the constraint constructor and not with linear_constraint constructor.
lymbot
1

votes
2

answer
371

Views

Access all variables occurring in a pyomo constraint

I am working on an algorithm in python that needs to modify concrete (mixed-integer nonlinear) pyomo models. In particular, I need to know which variables are present in a general algebraic constraint. E.g. for a constraint model.con1 = Constraint(expr=exp(model.x_1) + 2*model.x_2
Christoph Neumann
3

votes
1

answer
329

Views

Suggesting a lower bound for an ILP solver

I have an integer linear programming problem that takes very long to solve by the solvers I've tried (CPLEX, CBC), even though they find the optimal solution early on. They just take forever to fully prove it. It's easy to calculate a trivial lower bound for the objective value of my minimization pr...
bela_a_holdon
5

votes
1

answer
125

Views

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 "C:\OCT-1.0b1\Python27\scripts\ipython-script.py", line 5, in from pkg_resources import load_ent...
AssMero
3

votes
2

answer
989

Views

Performance of pyomo to generate a model with a huge number of constraints

I am interested in the performance of Pyomo to generate an OR model with a huge number of constraints and variables (about 10e6). I am currently using GAMS to launch the optimizations but I would like to use the different python features and therefore use Pyomo to generate the model. I made some tes...
Dimitri Tomanos
2

votes
1

answer
135

Views

New academic cplex expired license message

I've been trying to use cplex with pyomo to solve some LP, nevertheless when running I found the following error message [ 0.00] Setting up Pyomo environment [ 0.00] Applying Pyomo preprocessing actions [ 0.00] Creating model [ 0.02] Applying solver The license for this version of CPLEX...
esv
1

votes
1

answer
125

Views

Pyomo Util Module Not Found

So I asked a question a month ago. I had a really nice answer to that question. I wanted to test if the answer works right now. But I am getting ModuleNotFoundError. I did following before testing: conda install -c conda-forge pyomo conda install -c conda-forge pyomo.extras I want to run this scrip...
oakca
2

votes
0

answer
165

Views

Data of abstract model resolution

I'm starting with pyomo and I have some questions. I create an abstract model and the correspondenting data file. I would like to solve it in the script in order to use the solutions of the variables later. I tried to do it with the next code: data = DataPortal() data.load(filename="Datos\Datos_rea...
2

votes
1

answer
180

Views

pyomo and cplex parallel computing for mixed integer linear programming

I am using pyomo for mixed-integer linear programming model. I call cplex in pyomo to solve the model. The problem I am solving is large, which require parallel computing. Should I set parallel in pyomo or in cplex? In pyomo, I found this syntax, but seems not working. solver_manager = SolverManag...
Lei
2

votes
1

answer
362

Views

Double summation in Pyomo

I'm just starting to use Pyomo and I've been unable to figure out how to code a double summation. Something like this. Can someone give me a hint? Thanks for your help guys!!
ascub
1

votes
1

answer
291

Views

Error in pyomo expression generation with sum using python 3.6

I am using pyomo Pyomo 5.1.1 (CPython 3.6.0 on Linux 3.16.0-4-amd64) under Python 3.6, and I get an error message when I want to build an Expression in a model using a summation. Here is a minimal example : from pyomo.environ import * from pyomo.opt import SolverFactory model=ConcreteModel() model.H...
Paulin Jacquot
1

votes
1

answer
944

Views

Solving MINLP with PYOMO and BONMIN

Is it possible to solve a mixed-interger-non-linear-problem (MINLP) with the help of PYOMO and the BONMIN solver?
user2161065
2

votes
2

answer
95

Views

Pyomo: When using python script, are there any quick ways to show the Objective value after solving the ILP?

I finished an ILP before and it works properly. opt = SolverFactory('glpk') model = AbstractModel() model.obj = Objective(...) # variables, constraints ... instance = model.create_instance() results = opt.solve(instance) since I want to get the value of each variable but also the objective function...
ironcircle
3

votes
1

answer
493

Views

How to warm-start pyomo with cplex?

I am currently using cplex with pyomo from the command line using pyomo -solver=cplex model.py data.dat the results are saved in the file results.json. How can I start cplex again using the previous results as a starting solution?
algor207
1

votes
1

answer
630

Views

Install Ipopt solver to use with Pyomo in ubuntu

How can I install ipopt solver to use it with pyomo in ubuntu??? I have already download the zip file of ipopt but I don'n find any specific instructions how to install it and use it with pyomo.
Filippos Ser
2

votes
3

answer
7.2k

Views

How do you install glpk-solver along with pyomo in Winpython

I want to use "pyomo" for my studies. I installed pyomo via easy_install coopr install instructions, Pyomo needs a solver to work so I wanted to install the (GNU Linear Programming Kit) glpk_webpage, pyomo seems to be installed just right because I can import it in spyder (i am using WinPython-64bi...
Hiatus
2

votes
1

answer
470

Views

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 the new Pyomo-Gams interface, it should from my und...
Theo
3

votes
1

answer
747

Views

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", executable=executable,solver_io='nl') opt.options['nlp_scaling_method'] = 'user-scaling' This works fine. If i tr...
Anthonydouc
2

votes
0

answer
118

Views

Pyomo cannot find GLPK solver on Docker machine

I have a Docker machine running Linux. I am using Pyomo with the GLPK solver. I installed GLPK from the shell command line for the Docker image, using apt-get install glpk-utils I have all my code saved under the subfolder /code I can see glpsol is installed under path: /usr/bin I can see that /usr/...
Ry John
3

votes
0

answer
253

Views

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 uninitialized NumericValue object" errors for constraints invol...
David Oliver
2

votes
1

answer
927

Views

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 = ConcreteModel() model.x1 = Var(within=NonNegativeIntegers) model.x2 = Var(w...
pat96

View additional questions