## Urgent - Using elementwise min(DecisionVar[,], Constant[,]) in PROC optmodel objective function

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];``````

``````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.

``````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.

## Re: Urgent - Using elementwise min(DecisionVar[,], Constant[,]) in PROC optmodel objective function

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.

Discussion stats