I have my decision variable x which is indexed on the list N. I want the constraint that x[i+1] <= x[i] or x[i] <= x[i-1]. But how do I do this in Pyomo without going out of range with my index? This thus doesn’t work. Anyone an idea how to do this? Answer You could use Constraint.Skip to avoid accessing
Tag: pyomo
Pyomo Constraint error: Trivial Boolean (True) instead of a Pyomo object
I implemented a concrete model in pyomo. It is about a Course planning problem. Courses have to be scheduled within a planning horizon. Teachers, periods and stations have to be linked to the course within a time horizon. The data for the concrete model is being read from Excel. I ran the model with different data. Everything worked well and
Pyomo find minimal sum of list values
I want to have an indexed binary variable so pyomo optimises it to minimise the total sum of the list while picking at least 2 elements. When I remove the (imo redundant) model.q I receive: ValueError: No variables appear in the Pyomo model constraints or objective. This is not supported by the NL file interface and the solution pyomo gives
`SolverResults Error` When Parallelising Pyomo Optimisations
I’m trying to optimise multiple linear programming problems in parallel using Pyomo and the standard Python multiprocessing library. When switching to using multi-processing I keep running into the error: ValueError: Cannot load a SolverResults object with bad status: error. A similar issue was reported in this question, where their problem seemed to be that the solver (n.b. they used cbc
Using NEOS as a Pyomo solver
I have recently started in doing some OR, and have been trying to use Pyomo and NEOS to do some optimation problems. I have been following along with one of the UT Austin Pyomo lectures, and when my GLPT was being difficult to be installed, I moved on to NEOS. I am having some difficulty in now receiving a solved
Switching to Pyomo – Syntax issue with sets
I have used the algebraic modelling language AMPL but I’m now making the switch to python and Pyomo. I’m struggling a bit with its syntax though. In AMPL I would have something like this: How can I implement the last line in Pyomo? Any help is much appreciated, thank you! Best regards, Johannes Answer Welcome to the site. Below is
it’s possible to obtain the lagrange multipliers from an optimal solution in Pyomo?
I’d like to know how it’s possible to obtain the lagrange multipliers from an optimal solution in a Concrete model solved with glpk? Thanks! Answer This works for me in gurobi, try it out and tell me if it works with glpk. You need to prompt getting the Lagrange multipliers / dual variable in pyomo by putting the following line
Creating Pyomo’s ConstraintList with a list of constraints rather than adding them individually?
I’m currently storing my Pyomo variables in a Pandas dataframe, and have been using that to generate arrays of constraints. Is there a way I can add them to my model (e.g. by initialising a ConstraintList with it) rather than having to loop through them all and add them individually? I don’t think I’m able to use a rule to
How to include a variable in the summation bound of a objective function with pyomo?
I’m using pyomo to find an approach for solving an energy optimization problem. I’m trying to find the optimal time slot during a day to shift the start of a smart dishwasher to, so that the electricity cost is minimized. I’m using an example from a paper but unfortunately I can’t embed pictures yet, so here are the links to
Pyomo: Minimize for Max Value in Vector
I am optimizing the behavior of battery storage combined with solar PV to generate the highest possible revenue stream. I now want to add one more revenue stream: Peak Shaving (or Demand Charge Reduction) My approach is as follows: Next to the price per kWh, an industrial customer pays for the maximal amount of power (kW) he was drawing from