How to write cost slabs in objective function of Linear Programming?


How to write cost slabs in objective function of Linear Programming?



Let say I have a variable Income per month, over a period of 1 to 12 months my total Income is 1700 $, I want to minimize tax on this income.
How should I write this objective function in abstract algebra form
Z = 1000 * 0.05 + 500 * 0.10 + 200 * 0.15



basically I want to put slab wise tax on total income, any suggestion ?



I have three slabs 0-1000, 1000-1500, >1500
tax per slab 0.05, 0.10, 0.15





This question may belong in math.stackechange.com, not stackoverflow. Do you have a programming language you are trying to implement this in, or do you just want to create a mathematical formula? math.stackexchange.com/questions/tagged/linear-algebra
– user15741
Jun 29 at 18:42





Tax brackets can be modeled using piecewise linear functions. This is a fairly standard modeling technique.
– Erwin Kalvelagen
Jun 30 at 8:27





Thanks Erwin, I am trying piece wise linear functions
– Kumar J
Jul 2 at 5:50





@user15741, actually I am modeling it in python
– Kumar J
Jul 2 at 5:51




1 Answer
1



Here is an example implementation in python:


def tax(x):
if (x <= 1000):
return x * 0.05
elif (x <= 1500):
return 50 + (x - 1000) * 0.1
else:
return 100 + (x - 1500) * 0.15

income = 100
while (income < 5000):
print ("Taxes on income of " + str(income) + ": " + str(tax(income)))
income += 250



You could parameterize the steps and rates if you wanted.



If you need to regress a piecewise function from results, you can use numpy.piecewise.


numpy.piecewise





This is not very usable in a linear programming model.
– Erwin Kalvelagen
Jul 2 at 19:53






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?