Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

Branching Information of SCIP Run

I'm working on a problem using Pyomo with SCIP as the solver. I've noticed that sometimes the same instances are solved almost instantly, while other times they take significantly longer (with a ...
FG85's user avatar
  • 63
0 votes
0 answers
9 views

Branching control in SCIP via Pyomo

I'm working on a "hard" scheduling problem that is currently written in Pyomo, and I'm using SCIP as the solver. Since I know the structure of the problem, I understand that branching on ...
FG85's user avatar
  • 63
0 votes
0 answers
21 views

Multiplying pyomo variable matrix with a constant matrix

Matrix multiplication of pyomo variable with constant matrix. I have the pyomo variable defined in the form of matrix, let's say 21x201. I want to add a constraint that matrix multiplication of pyomo ...
Ali Salman's user avatar
1 vote
0 answers
27 views

Python kernel crashes when solving Pyomo model created with OMLT using Cyipopt

I am trying to solve an optimization problem that has a neural network as a constraint. I am creating that constraint within Pyomo using the package OMLT. I am using Cyipopt as the optimizer. I am ...
GokuUzumaki's user avatar
0 votes
0 answers
24 views

Pyomo integration with OpenDSS

Has anyone tried to integrate Pyomo with OpenDSS through python to solve grid optimization problems? I tried adding the constraints and the objective function and called Solve function in OpenDSS ...
user25915529's user avatar
0 votes
0 answers
29 views

Using a ConcreteModel as a Block in Pyomo Model

I'm looking for comments on this design pattern in pyomo. In the case where we have models which can either be solved in isolation/separately or treated as a Block within a larger model, is there a ...
AirSquid's user avatar
  • 11.6k
0 votes
0 answers
23 views

Simulating in Pyomo DAE with user-defined input signals

I am using Pyomo DAE to simulate a system of ODEs of a chemical process with exogeneous inputs. How can I design a random input signal to perturb my system? My current input design is a step change at ...
Karl Pilario's user avatar
1 vote
1 answer
50 views

Pyomo 6.8.0 deprecation warning for filter= and validate=

Starting with Pyomo 6.8.0, constructing a model component like this gives a deprecation warning: mod.NEW_SET = Set( dimen=2, initialize=mod.OLD_SET, filter=lambda m, x, y: m.my_param[x] &...
Matthias Fripp's user avatar
0 votes
1 answer
44 views

Pyomo ImportError: module ‘pyomo.common’ has no attribute ‘errors’

I’m working with Pyomo in a Python environment, and I’ve encountered an AttributeError when trying to import Pyomo modules. The error message states that the module ‘pyomo.common’ has no attribute ‘...
nuwan desilva's user avatar
0 votes
0 answers
44 views

How to set constraint for optimisation problem to keep to continuity of allocation problem?

I want to allocate 20 districts on a map to 4 institutions. Below are the data I have. district = {'d1', 'd2', ..., 'd20'} institution = {'i1', 'i2', 'i3', 'i4'} distance_in_km = { 'd1': [['i1', ...
lukephm's user avatar
0 votes
1 answer
42 views

Pyomo using CPLEX Automatic Benders Decomposition with Annotation

I'm trying to use Cplex with the automatic benders decomposition. There are multiple ways to do that. I want to force the decomposition to be according to my annotations - Cplex calls this Benders ...
Ursxx's user avatar
  • 35
0 votes
2 answers
28 views

Use of a DLL in a Pyomo model

I am new to pyomo, so this is a basic question about the capabilities/restrictions of pyomo as a whole. I have read most of the "Optimization Modeling in Python" textbook about using pyomo, ...
Eric Hintz's user avatar
0 votes
0 answers
17 views

Managing Multiple solver Versions with Pyomo

I'm using Python 3.12.3 and Pyomo 6.7.0, and I use VSCode as my code editor. I have already connected GAMS 25.1 to Python. Now, I want to add GAMS 24.1 to Python. Here are my questions: Would adding ...
Xxlonely's user avatar
0 votes
0 answers
37 views

How to get the immediate value after each iteration?

Does pyomo support to pass a function to access model value each iteration? I want to check the solution every 50 iter, how can I achieve this?
zz z's user avatar
  • 27
0 votes
0 answers
29 views

model.name="unknown" termination condition: infeasible message from solver: Ipopt 3.11.1\x3a Converged to a locally infeasible point

The infeasible error arose when I changed the definition of m.Tm() from pyo.Var(m.k0) to: pyo.Param(m.k0, mutable=True, default=0). I don't want Pyomo to alter m.Tm(), I want Pyomo to calculate it's ...
Simon's user avatar
  • 1
0 votes
0 answers
26 views

Wrong dual coefficient fixing the value of a decision variable in the primal problem

I implemented the following model in with Pyomo, where I fix the value of y equal to -5: import pyomo.environ as pyo from pyomo.opt import SolverFactory opt = pyo.SolverFactory('glpk') S = pyo....
Carl's user avatar
  • 73
0 votes
0 answers
20 views

Pyomo, file path issue

I have the current code provided to me by my thesis supervisor. he advised me that the code should run without any changes. i have the file and code saved in the same folders and have edited the excel ...
KADEN MOONSAMY's user avatar
0 votes
0 answers
19 views

In a MINLP optimization, how can I ensure that a variable is set to 0 by constraint instead of a really low value in pyomo?

I have been trying my hand at a MINLP process synthesis problem that has been running into numerical difficulties due to small non-zero values. In essence, the model contains continuous flow variables ...
Martin S.'s user avatar
0 votes
1 answer
38 views

Pyomo- adding in export limitation constraints into pyomo optimization for battery energy storage optimization model

I've been bashing my head up against a wall trying to add additional constraints into the battery energy flow model: https://github.com/cwkcodes/lockbox/tree/7943fb664e808c0ba1bcb11a81f6180b34e1a623/...
Cameron Kerr's user avatar
0 votes
2 answers
68 views

Limit the sum of param and var at any timestep

I'm currently writing a Python/Pyomo script that optimizes the combined usage of a battery storage system and a solar power plant. I want to constrain the combined energy output of the solar power ...
Voric's user avatar
  • 3
0 votes
0 answers
22 views

Pyomo did not find license for solvers

I worked with pyomo to solve MINLP. After i updated pyomo to the latest version pyomo-6.7.3, i get the error: ValueError: gams is not licensed. I checked, if gams is an environment variable. If i type ...
Marvin Lang's user avatar
0 votes
1 answer
60 views

How to create a binary on-off switch for 2 variables using glpk linear programming?

I have created a contrived example of my problem in an example here. It involves 2 water pipes which lead from a dam to a town. I want only 1 pipe to carry water over each timestamp, t. I have created ...
Jwem93's user avatar
  • 267
0 votes
0 answers
27 views

How to read the .smps file in pyomo or pysp

I want to utilize pyomo to solve 2stage stochastic programs (achieved from SIPLIB, which is in smps format), but how to make the smps file compatible with pyomo? Is there any implementation? I found ...
liuwb17's user avatar
0 votes
0 answers
25 views

Duplicates Found in CBC

Pyomo generated this CBC file, which CBC says is not valid because contains duplicates. How to found these duplicates? Solver command line: ['/usr/bin/cbc', '-printingOptions', 'all', '-import', '/tmp/...
gdm's user avatar
  • 7,834
0 votes
2 answers
43 views

Pyomo + IPOPT Max Iterations reached without optimality

I have been working on an optimal control problem using Pyomo + IPOPT, but I just cannot find an optimal solution. It is a 3 phase trajectory problem with an objective of minimizing mass flow rate(...
Mewael Afeworki's user avatar
1 vote
0 answers
42 views

Issue with calling Knitro

I use pyomo to formulate my problem and then use ampl to call knitro to solve my problem, as show in code below: self.solver_pyo = pyo.SolverFactory(modules.find(“Knitro”), solve_io = “nl”) My ...
John zhang's user avatar
0 votes
1 answer
43 views

How to implement a logical condition based on two variables with pyomo

I'm modeling a PV + BESS system to find the optimum size that will meet a certain demand profile. I'm trying to model a condition for the charging of the BESS whereby charging occur when the output of ...
Mufika's user avatar
  • 1
0 votes
0 answers
83 views

network optimisation supply planning is not generating weekly plan

I am working on Production planning optimization where I have three stages of planning Production plan Packaging plan Dispatch plan for each stage I have its capacity and lead time it takes for each ...
Prashant Pandya's user avatar
1 vote
1 answer
36 views

Why pyomo unpack namedtuples in constraints?

I am new to pyomo and I want to understand why it works with namedtuple the way it works. There is a code sample: from collections import namedtuple import pyomo.environ as pyo Product = namedtuple(&...
Alexey's user avatar
  • 99
0 votes
1 answer
46 views

Not initializing variables in Pyomo

By default, variables seem to be initialized in Pyomo. Then the solver uses this initial point. Is there a way to not initialize variables in Pyomo and let the solver compute the initial point? I ...
fontanf's user avatar
  • 249
0 votes
1 answer
92 views

Pyomo does not optimize

I am really new in the pyomo. But it is not looking so comlicated and still I am not sure where is the error. The following optimizer is just an example and it does not reach a solution. The iteration ...
Don Ton's user avatar
0 votes
1 answer
114 views

How to use a multi index dataframe in python

I have this dataframe, and a constraint as follows: L_model.constraint_b1 = pyo.ConstraintList() for i in range(len(initial_demand)): for k in range(Nb): for t in demand.index: ...
Nasim Eslaminia's user avatar
1 vote
1 answer
71 views

Pyomo IPOPT Collision Avoidance Violation

I am trying to use pyomo for nonlinear programming trajectory optimization. I used simple UAV model to optimize for the minimum travel time trajectory from initial position to final position. I want ...
David Timothy's user avatar
0 votes
1 answer
48 views

Solve pyomo.common.errors.InfeasibleConstraintException

After running the below code: from pyomo.environ import * model = ConcreteModel() model.q11, model.q12, model.q13, model.q21, model.q22, model.q23, model.q31, model.q32, model.q33 = [Var(bounds=(0.0,...
Franco Piccolo's user avatar
1 vote
1 answer
28 views

With Pyomo, How to Access Parameter by Index in Constraint Definition ? TypeError: '_generic_component_decorator' object is not subscriptable

I'm doing exercises to learn how to use pyomo. I've tried setting parameters on an index, as the doc does, but I get an error when I try to access the parameters in the constraints. I understand from ...
Korpi's user avatar
  • 11
0 votes
1 answer
46 views

Get index set dimension names from constructed constraint

Given this set and constraint definition index_set_a = pyo.Set( initialize=[(p, j) for p in model.Units for j in model.YEARS if model.check_year[p] <= j] ) model.a = pyo.Constraint(index_set_a,...
phaebz's user avatar
  • 423
0 votes
1 answer
56 views

Enforce a Substitution Constraint on a Roster Generation Model in Pyomo

I am trying to develop a Pyomo model that builds an optimal roster for a recreational soccer team. There are 7 positions, R, that need to be filled, and on any given game day, there can be as many as ...
LazyCoder1982's user avatar
0 votes
1 answer
144 views

How do I solve non-linear optimization problems using Gurobi in the pyomo framework?

I am trying to solve a non linear (specifically exponential) constrained problem using Gurobi in the pyomo framework. The solver gives an error saying "model constraint cannot be written in LP ...
Ashutosh's user avatar
0 votes
1 answer
91 views

How can I use abs in gurobipy & pyomo?

I have objective function like this: def obj_expression(m): return sum(sum((m.xr[i,j] - m.x[i, j]) + m.gamma * abs(m.v[i, j] - m.v0[i, j]) for j in m.J if m.xr[i,j] != ...
unknownperson's user avatar
0 votes
0 answers
57 views

Pyomo Mixed Integer Programming : how to turn a binary variable equal to 1 if values of a variable exceed a certain threshold for the first time?

I want a binary variable, $inv_year$, to indicate the investment year, i.e., the year where the investment variable, $I$, turns greater than zero for the first time. Both variables ($inv_year$ and $I$)...
Julia Schepp's user avatar
0 votes
0 answers
32 views

Pyomo Constraint

I am trying to run this constraint using pyomo and solver is IPOPT. Can somebody please help. I have same kind of code for upper limit as well. V_statutory_lim=[0.95, 1.05] def ...
Kirn Zafar's user avatar
0 votes
0 answers
32 views

How do I implement a conditional equality constraint?

I'm implementing a transshipment model in the python module Pyomo where I'm trying to optimise the movement of products that are shipped between suppliers to buyers. I need to implement a constraint ...
finn871's user avatar
  • 45
0 votes
1 answer
41 views

Pyomo can't find any solution to my problem

A solar plant is supplying power to three water pumps, and other appliances and I want to find when should I run my water pumps to make the most of the solar plant (since its production through days ...
Owen Sgbd's user avatar
0 votes
1 answer
33 views

Pyomo parameter config - too many arguments given?

I'm trying to set up a parameter for a Pyomo model, but I keep getting an error that the too many arguments were given and I cannot figure out why. from pyomo.environ import * model = ConcreteModel() ...
teachmeplease345's user avatar
0 votes
0 answers
79 views

GLPK with Pyomo

I am using pycharm and I want to use glpk solver with pyomo. Can anyone please help me resolve this error. I tried pip install glpk But I am getting error Problem with pip. ERROR: Failed building ...
Kirn Zafar's user avatar
0 votes
1 answer
90 views

Pyomo: Why is the solver finding a value outside the specified domain?

Editing to better address my question. Have a variable x that represents day of the year, so 1-365. There are some days that are not allowed. So I create a list with the valid day options and then a ...
Bahumat's user avatar
0 votes
0 answers
35 views

Converting from AMPL to Pyomo SETOF UNION

I’m attempting to convert an AMPL model to Pyomo, which is something I have no prior experience with. I’m finding it challenging to adapt to the syntax, especially this part: " set YBUS := setof{...
Darlene 's user avatar
1 vote
0 answers
51 views

Pyomo disjunction of time-series arrays; error: "... LP writer does not know how to process<class 'pyomo.gdp.disjunct.Disjunct'>

I wish to implement an electrical device powered by a PV curve in the pyomo.gdp (General Disjunctive programming) extension. In per unit system, the device needs at least 50% of the PV's peak power.So,...
CodingEngineer787's user avatar
0 votes
0 answers
54 views

In Pyomo, Why Does the Instance of a Variable Differ from the Variable Value in the Objective Function?

The goal is to minimise total investment costs over a period of time subject to a minimum investment constraint. The dependent variable, X, is the amount of investment in project i at time period t. ...
Julia Schepp's user avatar
0 votes
0 answers
30 views

How can I place unique bounds on a piecewise constraint at different indices?

I have the following code in Pyomo: from pyomo.environ import * model = ConcreteModel() model.A = Set(initialize=[1,2,3]) model.B = Set(initialize=['J', 'K']) model.x = Var(model.A, model.B, ...
Alexis Dasiukevich's user avatar

1
2 3 4 5
32