Questions tagged [pyomo]

For questions related to the Python optimization modeling package Pyomo.

Filter by
Sorted by
Tagged with
1
vote
0answers
13 views

How to display results of 2-dimensional Pyomo variables in a pandas dataframe

I would like to create a pandas dataframe from the results (and the parameters) of an optimization problem and create a csv file out of it. In my previous example (1-dimensional case) I have just one ...
0
votes
0answers
32 views

Find multiple solutions using pyomo and gurobi

I am solving a MILP using Gurobi and Pyomo. I would like to obtain as many optimal solutions as possible. Here is what I have so far: ...
0
votes
1answer
45 views

How to create constraint-equations in Pyomo with empty set inputs

I would like to crate an constraint-equation that depends on 4 sets. For that I use the following code: ...
1
vote
0answers
38 views

How to deal with hourly and annually constraints in Pyomo?

I am wondering whether it is possible to create constraints over years and hours at the same time in Pyomo. For example, my current time variable is: ...
1
vote
1answer
47 views

How to assign values from a list of dictionaries to a 2-dimensional parameter in Pyomo

I know how to assign values from a single dictionary to a 1-dimensional parameter in Pyomo. For that I use the following code ...
2
votes
1answer
54 views

Returning the best possible value found when the search direction is becoming too small (IPOPT via Pyomo)

I'm using Pyomo to solve an optimization problem and I'm using as a solver IPOPT. Now I'm getting an error from IPOPT. EXIT: Search Direction is becoming Too Small. according to the docs, this means:...
3
votes
2answers
116 views

Setting up Branching Priority for GUROBI in Pyomo

I am currently experimenting with GUROBI and would appreciate some kind advice on the following: In Pyomo: Setting variable branching priorities, there was a response to doing so for CPLEX, hence I ...
2
votes
0answers
48 views

Pyomo Trouble - Number of Constraints in Output is 0 When It Should Be > 5000

I have an MILP program written in Pyomo and I am using CBC as a solver. Below is a description of my problem: The model works fine when it is run on my local computer The output is the following in ...
1
vote
0answers
43 views

Value Error in Pyomo: Constraint rule returned None

I get an error in Pyomo that I do not understand. I habe 288 timeslots t and a binary variable y (which I call here ...
3
votes
1answer
64 views

Obtaining linear relaxation objective value from MILP model coded in Pyomo

I would like to seek some advice on modeling the following: I am currently using Pyomo to generate my MILP model in Pyomo. It seems that it is not possible to cast the integer and binary variables to ...
1
vote
1answer
99 views

How to display results of Pyomo variables in a pandas dataframe

I would like to display all the results of Pyomo variables in a pandas dataframe. I had a look at this question Pyomo: Looping Over A Variable Method and tried to adjust it to my case without success. ...
0
votes
1answer
67 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 ...
3
votes
1answer
186 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
118 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
29 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
29 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
23 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
45 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. ...
2
votes
1answer
48 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
53 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
159 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
77 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
114 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
105 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 ...
3
votes
1answer
60 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
82 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
309 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
86 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
100 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
168 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
57 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
92 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
230 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
66 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
189 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
98 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
612 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
319 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
272 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
90 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
217 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
50 views

CPLEX keeps restarting in Pyomo

I tried running my model by adding the following settings to CPLEX. ...
8
votes
2answers
386 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
237 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
183 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
99 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
91 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
540 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
257 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 ...