Questions tagged [linear-optimization]

38 questions
0
votes
1 answer

Adding piecewise discount function to model in Gurobi

I am trying to add a piecewise function to my objective function in Gurobi and am not sure if I need to manually assign it or if Gurobi will figure it out. I have added this piecewise function in Gurobi uusing this code that I got from this source…
Zhi Z
  • 1
0
votes
1 answer

Writing a linear program to calculate the maximum inscribed circle into a convex polytope defined by equations

I need to find the Chebyshev center of a convex polytope defined by equations (lines) of type y = aix + bi using a linear program. I know how I would do it with inequalities of type aix + y <= bi, but I can't figure this out. I tried using the…
0
votes
1 answer

Is there a way to prevent "crossover" iterations when using scipy.optimize.libprog's solver "highs-ipm"?

Is there an option to prevent "crossover" when calling highs-ipm solver via scipy.optimize.linprog? It appears that the "standalone" solver (see https://github.com/ERGO-Code/HiGHS) has an option "--run_crossover arg". I just wonder if this is…
rafexiap
  • 103
  • 2
0
votes
1 answer

writing down a constraint in IBM CPLEX

My question is about writing down a constraint in IBM CPLEX or in any solver. Imagine you have a graph with N nodes and E edges. Imagine for connecting one node (source node) to another specific node (destination node), you have a set of paths. Each…
0
votes
1 answer

Why does my model ignore a linear constraint?

I have an Xpress IVE linear programming model whose objective is to maximise the profit from producing and selling energy for a fictitious company. One of the sources of energy is hydro. There is a reservoir with max capacity, so within the model we…
0
votes
0 answers

Pyomo Blocks: Performance of indexed blocks

I am setting up a big time-dependent energy optimization problem over many timesteps with pyomo.The problem is formulated using indexed blocks, as proposed in the Pyomo Book in chapter 8.6.2., where the model object contains a block for each…
fabmid
  • 11
  • 2
0
votes
1 answer

how to write a pyomo optimization to select optimal volume of renewables?

Background I am trying to write a pyomo optimization which takes in a customer's electricity load and the generation data of several renewable projects, then optimally solves for the lowest cost selection of renewable projects to minimize…
0
votes
1 answer

HiGHS solver returns error when using Pyomo Kernel

I've been trying to get the HiGHS solver to work with the Pyomo kernel interface, but when I try to solve it it gives me this error: "AttributeError: unreadable attribute 'domain'". I created a simple example to reproduce is - does HiGHS not not…
Jack Simpson
  • 1,681
  • 3
  • 30
  • 54
0
votes
0 answers

Simplex solver - issues with getting it working

I'm trying to write a simple simplex solver for linear optimization problems, but I'm having trouble getting it working. Every time I run it I get a vector subscript out of range (which is quite easy to find), but I think that its probably a core…
0
votes
0 answers

How to add new constraints to the Stigler Diet problem

Let's say I would like to have all the commodities in the annual food list instead of few. How to add greater than 0 (>0) constraint for all the commodities? Any help or suggestion would be really helpful.google-or-tools I have made some changes in…
0
votes
0 answers

How do I solve a linear optimization problem with a constrained output?

I am trying to solve the following optimization problem in Matlab: MPC problem k is the time with N being the amount of timesteps. linprog(c_k,F_uk,f_k) solves elements 7.1a and 7.1e of the above problem description. However, the output of the…
0
votes
0 answers

How to find a goal_seek value using root_scalar

I've written the following code to find a value using the root_scalar function: def goal_seek(demand_2029_peak, peak_demand_matrix, target_val): def func(goal_seek_value): demand_2029_reshaped = ((demand_2029_peak -…
0
votes
1 answer

No objectives defined for input model. Cannot write legal LP file

I just write my pyomo model and i want to solve them but i got this Error: ERROR: No objectives defined for input model. Cannot write legal LP file. here is my code import pyomo.environ as pyo import sys model = pyo.ConcreteModel() model.i =…
0
votes
1 answer

PuLP print decision variable results that are Non-Zero only?

Currently I am using PuLP for a retail distribution problem. CZe represents a customer, where the indexed DC or S1,S2 etc. is a location that services the demand of that customer. I want to find a way to print only decision variables that have a…
0
votes
1 answer

Sum of subset of binary variables == 1 in Gurobipy

I am writing a very simple optimization model in Gurobipy but am struggling with the binary variable constraints. I have 5 materials in 3 groups. The decision variables are whether or not to use one of the materials and are binary. Each decision…