BookmarkSubscribeRSS Feed
arnav19930
Calcite | Level 5

Hi,

 

Demand for various products of a company in different regions is given. This is the quantity in demand.

number actual_demand{Products, Regions} = [
12 58
34 23
41 6];

 

Prices of all products in each region are also given.

number demand_price{Products, Regions} = [
20 8
30 10
10 20];

 

This company has 3 plants where it'll be producing the required qty and shipping to these regions where demand is present. But because of production constraints, it may produce at times more or at times less - than the total quantity that was demanded.

Objective is maximizing revenue, which is given as

 

Revenue = demand_price * demand_fulfilled.
Demand_fulfilled = min(Amount Shipped, Actual_Demand)

 

Amount Shipped is the decision variable in the model. Signifies the amount of each product that was shipped to each region.

var Amount_pl1{Products, Regions} >= 0;
var Amount_pl2{Products, Regions} >= 0;
var Amount_pl3{Products, Regions} >= 0;

 

With this information, I understand that the objective function should be as follows :- 

 

maximize revenue = sum{i in Products, j in Regions}(demand_price[i, j]*min(Amount_pl1[i, j]+Amount_pl2[i, j]+Amount_pl3[i, j], actual_demand[i, j]))
 

 

But this returns the error - ERROR: The NLP solver does not allow integer variables.

I don't understand why this suddenly becomes an NLP problem by using the min function. Also, how to formulate this into a linear objective function and still captures the true essence of revenue.  

 

I've also tried the below modification to the objective function, which still gives the same error.

 

Please help.

 

maximize revenue = sum{i in Products, j in Regions}(demand_price[i, j]*(Amount_pl1[i, j]+Amount_pl2[i, j]+Amount_pl3[i, j]>< actual_demand[i, j]))
 

 

PS :- I'm a first time poster so please be patient if I've included any bad posting practices here, and let me know.
Also, regarding the problem, I've drastically reduced the complexity for sharing code, sample data and to keep it simple.

1 REPLY 1
RobPratt
SAS Super FREQ

Yes, the MIN function is nonlinear.  To linearize your problem, you can introduce an explicit variable and linear constraints:

 

var Demand_fulfilled {Products, Regions} >= 0;
con Linearize1 {i in Products, j in Regions}:
   Demand_fulfilled[i,j] <= Amount_pl1[i,j] + Amount_pl2[i, j] + Amount_pl3[i,j];
con Linearize2 {i in Products, j in Regions}:
   Demand_fulfilled[i,j] <= actual_demand[i,j];

 

And then use Demand_fulfilled in the objective function.  Although these constraints enforce only Demand_fulfilled <= min(Amount Shipped, Actual_Demand), the maximization objective will yield Demand_fulfilled = min(Amount Shipped, Actual_Demand) at optimality.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 946 views
  • 1 like
  • 2 in conversation