0

I am still quite new to Pyomo and optimization in general, but have recently come across a problem, and so I am hoping that someone can push me in the right direction. I have developed a supply chain optimisation model that had production sites with various capacities and these sites deliver various products to various customers. I have recently upgraded the model to account for penalty costs for sites that produce fewer items than their minimum "contractual" amounts. Example if a site has a minimum production threshold of 50, it can produce 40 but then it needs to pay a penalty ((50-40)*$1). I did this by adding a binary variable, multiplied by cost per unit shortfall, multiplied by the shortfall variable in the objective function. The problem is I get an error saying this is now a quadratic function

This is the error>>RuntimeError: Selected solver is unable to handle objective functions with quadratic terms. Objective at issue: objective.

I have done quite a bit or research but have not found a way to get around preventing converting this into a quadratic function by adding the penalty into the mix (by multiplying a variable with another variable). So my question is, are there some tricks or methodologies someone can point me to. I can use a different solver, its just I assume by converting this into a quadratic this will require a lot more computational power (slowing the run time down). Thanks very much!

Brandon
  • 37
  • 6

1 Answers1

1

This is is very doable and not uncommon. You should be able to formulate this and keep everything linear.

The clearest general approach is to add an additional variable for the overtime/under production/etc. and then include that in the objective function, multiplied by a penalty that would make it less favorable than "regular" production.

Here is a similar example: https://stackoverflow.com/a/67483886/10789207

AirSquid
  • 10,214
  • 2
  • 7
  • 31
  • Thanks AirSquid. It seems I have got it to half work now. The problem now is that one of two things happen. A) If the penalty cost is low (<= the production cost) the model will make only what is required and pay the penalty, or B) if the penalty cost is high, the model will make the minimum threshold amount so that it pays no penalty (this extra production gets 'wasted' which is fine. This I guess makes sense as the model optimises the decision between making less and paying a penalty or making extra and throwing the excess away. – Brandon Jun 13 '21 at 22:00