Questions tagged [pyomo]

For questions related to the Python optimization modeling package Pyomo.

Filter by
Sorted by
Tagged with
0
votes
1answer
39 views

Mutable parameter in Pyomo causes a problem

I am defining a Pyomo model that should have some mutable Big-M parameters whose values should be dynamically assigned (once). However, I am having a problem with a difference equation as described in ...
0
votes
0answers
37 views

Error message in difference equation in Pyomo

I have a problem with a difference equation in Pyomo that I just do not understand. Let's say I would like to implement just a very easy difference equation of the form: Temperature(t) = Temperature (...
0
votes
0answers
36 views

How to find out which constraint causes problems in Pyomo

I have a Pyomo model with many constraints and variables. When solving it with Gurobi, I get the message "Model is infeasible or unbounded". Now I would like to find out which constraints ...
0
votes
0answers
63 views

Use if-statements when defining a constraint in Pyomo

I would like to define the value of a variable model.variable_costsPerTimeSlot [t] in pyomo and I would like to use if-statements. Depending on the value of the if-...
1
vote
1answer
24 views

How to assure a range for a specific variable in Pyomo

I would like to specify a certain range for a variable for a certain timeslot in Pyomo. I have a temperature variable $T(t)$ that is defined by using the difference equation $$T(t) = T(t-1) + \cdots,\...
2
votes
1answer
20 views

Piecewise Constraint in Abstract Model

I would like to write a piecewise constraint for an Abstract Model in Pyomo. $$\operatorname{pu}_i(t_i^{'v})=\begin{align}\begin{cases}\rho_1(e_i'-t_i^{'v})+\rho_2(e_i-e_i'),\quad& t_i^{'v}\le e_i'...
0
votes
0answers
21 views

Correct way to define constraints in Pyomo

Can I know if the constraint below can be defined as follows in Pyomo for convex optimization. W and G are arrays of dimension M x N. ...
1
vote
1answer
35 views

Can I define constraints in Pyomo as a list?

I would like to define the following constraint in Pyomo $$W^\top{\bf 1}\le\hat w=\begin{bmatrix}\hat{w}_1&\hat{w}_2&\ldots&\hat{w}_N\end{bmatrix}^\top$$ where $W$ is a $2\times4$ matrix. ...
1
vote
0answers
20 views

Model definition in pyomo to solve online optimization problem

I am trying to model the attached online optmization problem in pyomo. Eventually, I am going to use the octeract solver to find the matrix soluions of W and G. I would like to ask advice about ...
2
votes
0answers
47 views

How to assign a single value to Pyomo parameter without a dictionary

I would like to assign a single value to a paramter that depends on a created set in Pyomo. I have the following code: ...
2
votes
1answer
86 views

Pyomo can't find Gurobi solver

I have a pyomo model that I can solve using the GLPK solver by just using the code: ...
1
vote
0answers
75 views

PYOMO - Optimization for the daily production of a products demand minimizing the production cost

I am trying to build an optimization model using PYOMO for the daily production of a product demand, minimizing the production cost. I have demand, production capacity (by machine by day), production ...
3
votes
1answer
101 views

Referencing of sets in Pyomo objectives

I have a question about referecing set in Pyomo objectives. Basically I have 2 options and I do not understand why one of it works whereas the other yields an error. Here you see them: ...
1
vote
1answer
55 views

How to display results from a solver during solving in Pyomo

I would like to see the current results (e.g. MIP gaps) of a solver in pyomo (as in GAMS) while solving the problem. I read that I should use the option "stream-solver" (see for instance ...
2
votes
1answer
48 views

How to implement a difference equation in Pyomo

I would like to define a difference equation in pyomo for a temperature variable. The equation (simplified) looks like: $Temperature(t) = Temperature (t-1) + x(t)$ , for t>0 $Temperature (0) = 20 $ ...
1
vote
1answer
52 views

How to dynamically set variable names in Pyomo?

I am looking to set variables in my Pyomo model by using a loop, so that they can be created automatically. However, each variable also contains bounds. I was hoping that it can loop through a ...
1
vote
1answer
144 views

Pyomo can't find solver

I am new to Pyomo and I have the following optimization problem (original transport problem by Dantzig): ...
2
votes
1answer
67 views

How to define constraints in Pyomo using sets and variables

I am trying to model the transportation problem of Dantzig in Pyomo (see the GAMS code here https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_trnsport.html or the description here https://www....
3
votes
1answer
97 views

Why functions with arguments can be called without arguments in Pyomo

I have a question regarding pyomo. I have seen quite often, that for the definition of parameters, objectives and constraints, explicit functions are defined. These functions expect some arguments and ...
2
votes
1answer
148 views

Error when defining variables in Pyomo

I just started to learn about Pyomo. In several tutorials it is stated that the command for creating a variable is just model.Variable = VAR(...). However, I get ...
1
vote
0answers
48 views

Find multiple solutions in Pyomo with Gurobi

I am fairly new to Pyomo and Gurobi. I'd like to find 20 sets of different solutions that meet the following constraints. ...
3
votes
1answer
86 views

Ipopt (probably) fails to solve a nonlinear problem, what is next?

I am trying to solve a nonlinear problem with only a set of continuous variables (where the nonlinearity stems from negative inconsistent - across differently indexed variables - large powers), e.g., ...
0
votes
2answers
198 views

How to generate multiple solutions to linear program in Python?

I recently posted a question here where I had written some Pyomo code to solve a simple linear program, however I feel the Operations Research platform is perhaps a better fit for this question. My ...
3
votes
1answer
62 views

How to collect solutions within CPLEX and retrieve them from PYOMO?

I would like to seek some advice on modeling the following: I am currently to invoke solvers, CPLEX, in particular. As I am solving my problem sequentially, i.e., the top-level subproblem results are ...
2
votes
2answers
158 views

Pyomo + Ipopt. Speed Issue

I am using Pyomo + Ipopt as solver to solve a NLP problem. The problem is not extremely complex in terms of dimensionality and ...
0
votes
1answer
74 views

Pyomo variable creation dilemma

I am working on a pyomo model, and need to create a few different sets of variables that are dependent on a solution from a master model. I need the variables to be indexed variables however the ...
7
votes
2answers
480 views

Can I use 'SCIP' solver for PYOMO?

I have an MINLP problem to solve where I was initially using 'ipopt' solver but the solution was not sticking to 'binary/boolean/integer' domain type for a variable. I am not sure which free solver ...
5
votes
2answers
316 views

Failing to meet a constraint in a NLP problem

I have a NLP problem at hand, which I am trying to solve via Pyomo + ipopt. I try to run several different instances of the optimizer with different conditions, out ...
6
votes
1answer
262 views

Can GLPK be used to solve an optimal team selection problem?

My Problem I am quite new to optimisation, so any advice is appreciated. I am currently trying to solve a problem as follows: Given a pool of people, we want to create n teams such to find the optimal ...
7
votes
0answers
80 views

Provide basic solution to CLP

I'm using Pyomo to formulate an LP with approx 500,000 constraints and 200,000 decision variables. The LP is solved using CLP. Some instances fail to return even a feasible solution after many ...
5
votes
1answer
181 views

Does pyomo support column generation?

I want to use column generation technique to solve cutting stock problem. Is there any other python modeling library that supports column generation?
1
vote
0answers
49 views

CPLEX keeps restarting in Pyomo

I tried running my model by adding the following settings to CPLEX. ...
8
votes
2answers
372 views

knapsack problem with non-linear constraint

I have a basic knapsack problem where I need to fit the most weight possible in a bin: ...
3
votes
3answers
198 views

Possibility of indexing decision variables with 2 indices using a set of tuples in Pyomo

I am currently attempting to solve a network problem that is not fully connected.Thus, I have attempted to do some preprocessing of data so as to form a set of tuples, e.g. $\{(a,b), (c,e),\ldots\}$, ...
3
votes
1answer
149 views

View of Constraints and Decision Variables in Pyomo

I have just attempted to construct my first Pyomo model. However, I was unable to locate any documentation that shows how to view constraints, decision variables. As my model is big, I need to see ...
3
votes
1answer
98 views

Pyomo: Help setting up my model

I have been working with a model for the past couple of weeks, but I am not sure what am I doing wrong as every time Pyomo returns that is infeasible or ...
1
vote
1answer
82 views

Pyomo: Struggling to get a constraint to work

I am trying to model an Electric Vehicle scheduling to minimise the electricity bill. Of course, the EV will only be able to charge every time that is plugged into a charging station (i.e. it cannot ...
1
vote
2answers
2k views

Downloading and setting up CPLEX for Pyomo

I have just installed Anaconda and am intending to use Spyder as it is able to display variable, parameter values for debugging. After which, I am planning to use Pyomo to code my MIP model and invoke ...
2
votes
1answer
427 views

how to implement a constraint with max/min function in pyomo

I am implementing a NLP problem in pyomo, and I am getting some issues for this constraint: \begin{equation} \forall i \in \lbrace 1, N \rbrace , \forall j \in \left\{1, M \right\}: Y_{i,j} \cdot ...
3
votes
1answer
200 views

Pyomo add constraint error: Rule failed when generation expression for constraint

I am trying to solve a model with Pyomo and struggling with indexing. Below is a simple problem instance, where you can also see the error. The message is straightforward and self-explanatory but ...
1
vote
1answer
104 views

Model Simulation in PYOMO

I have an optimization model that I have developed within the PYOMO framework and I am unable to solve the model in a reasonable amount of time using the BARON solver. I have been instructed not to ...
3
votes
1answer
114 views

How to define hybrid variables without using additional binary variables?

I am working on a large NLP model with equilibrium equations in which the variables are defined in the following form: $$x_i \in [L_B, U_B] \cup\{0\} \quad \text{where} \quad L_B \ \& \ U_B \in\...
1
vote
0answers
60 views

Rolling Horizon in Pyomo

I am trying to figure out how one could write a rolling horizon algorithm in PYOMO to speed up the solution of a model that I am building. My understanding of the Rolling Horizon Algorithm is that you ...
4
votes
1answer
98 views

BARON Error: variables/rows fixed as scaled bounds too close

I am trying to build my model up and keep running into this output from BARON: Clp0019I {x} variables/rows fixed as scaled bounds too close. I checked the BARON ...
10
votes
2answers
653 views

Modeling and solvers

I have just started to dive into OR world on my work. Currently we are using GAMS with Gurobi but some of us have strong programming background and would like to have more programmatic approach to OR. ...
3
votes
1answer
132 views

Pyomo CBC 1.#j error

I am using to solve my model Pyomo/CBC combination. But rarely, CBC Gap shows 1.#j and pyomo generate an error. Hence, it doesn't get solution. How can I solve this problem? Screen output: ...
9
votes
2answers
1k views

Reading an LP/MPS file using Pyomo software

I would like to know is it possible to read an LP/MPS file into the Pyomo software and solve the problem? If so, how can I do that?
7
votes
1answer
310 views

Understanding why this MINLP formulation is infeasible

Algebraic Formulation - Note: All parameter values are subject to change, I have just used the numbers you see here as place holders for the time being. Additionally, there are a few other equations ...
9
votes
1answer
648 views

Pyomo: Looping Over A Variable Method

I am trying to extract my variable values into unique lists so that I can pass them to a panadas dataframe and eventually export the dataframe to Excel after I solve my model. The idea is to have the ...
7
votes
2answers
305 views

Pyomo: Building Up A Constraint Over An Index

I am trying to create a constraint for model.z that builds up as a summation during a new time index. I tried to use the += but this does not work with Constraints ...