I am working on an optimization problem, and facing difficulty setting up two constraints together in Python. Hereunder, I am simplifying my problem by calculation of area and volume. Only length can be changed, other parameters should remain the same. Constraint 1: Maximum area should be 40000m2 Constraint 2…
Tag: constraints
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…
Scipy Optimise (minimize) not giving correct results
I am trying to do a simple minimisation as below using SciPy optimise, but the expected results are NOT matching the optimiser output: I would expect the final results to be close to “x_expected”… but that is not the case.. any ideas ? Answer SLSQP solver failed to find the optimal value for…
How to implement a constrained linear fit in Python?
I’m trying to fit a linear model to a set of data, with the constraint that all the residuals (model – data) are positive – in other words, the model should be the “best overestimate”. Without this constraint, linear models can be easily found with numpy’s polyfit as shown …
Inequality Constraint for a PYMC3 Model
I want to define an inequality constraint for a PYMC3 model. I found this post about defining an equality constraint (i.e., a+b1+b2=1) using pm.Potential. Does anyone know how to change that equality constraint into an inequality constraint like 0.9<a+b1+b2<1? Thanks! Answer The post you mention uses pm…