We have a stock that can be negative as well as positive. If it is positive then there are inventory costs and if it is negative then there are backordering costs. We wanted to model this in aimms with different methods. On the one hand we got the error that it was not linear, If we wanted to only have the stock if it is positive and otherwise return the value 0. If we tried to use other methods, such as a binary value that would return the value 0 if the stock was smaller than 0 and 1 if the stock was bigger than 0 we got the following error

"The mathematical program "CostMinimization" is not linear, look for bracketed numbers in the constraint listing, for example in the constraint Inventory_definition(4,12)."

How can we best model this situation, so that it is still a linear model?

# Inventory costs

Page 1 / 1

=st= means smaller than

=gt= means greater than

pars

max_pos_stock (=gt= 0)

max_neg_stock (=gt= 0)

costs_pos_stock

costs_neg_stock

vars

stock

is_pos (binary)

is_neg (binary)

constraint

stock - max_pos_stock * is_pos =st= 0

stock + max_neg_stock * is_neg =gt= 0

is_pos + is_neg =st= 1

cost function

costs_pos_stock * is_pos + costs_neg_stock + is_neg

=gt= means greater than

pars

max_pos_stock (=gt= 0)

max_neg_stock (=gt= 0)

costs_pos_stock

costs_neg_stock

vars

stock

is_pos (binary)

is_neg (binary)

constraint

stock - max_pos_stock * is_pos =st= 0

stock + max_neg_stock * is_neg =gt= 0

is_pos + is_neg =st= 1

cost function

costs_pos_stock * is_pos + costs_neg_stock + is_neg

### Reply

## Sign up

Already have an account? Login

**Please use your business or academic e-mail address to register**

## Login to the community

No account yet? Create an account

Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.