<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Urgent - Using elementwise min(DecisionVar[,], Constant[,]) in PROC optmodel objective function in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Urgent-Using-elementwise-min-DecisionVar-Constant-in-PROC/m-p/437363#M2192</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Demand for various products of a company in different regions is given. This is the quantity in demand.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;number actual_demand{Products, Regions} = [
12 58
34 23
41 6];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Prices of all products in each region are also given.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;number demand_price{Products, Regions} = [
20 8
30 10
10 20];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This company has 3 plants&amp;nbsp;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.&lt;/P&gt;
&lt;P&gt;Objective is maximizing revenue, which is given as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Revenue = demand_price * demand_fulfilled.
Demand_fulfilled = min(Amount Shipped, Actual_Demand)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Amount Shipped is the decision variable in the model. Signifies the amount of each&amp;nbsp;product that was shipped to each region.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var Amount_pl1{Products, Regions} &amp;gt;= 0;
var Amount_pl2{Products, Regions} &amp;gt;= 0;
var Amount_pl3{Products, Regions} &amp;gt;= 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this information, I understand that the objective function should be as follows :-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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]))
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this returns the error -&amp;nbsp;&lt;SPAN&gt;ERROR: The NLP solver does not allow integer variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I don't understand why this suddenly becomes an NLP problem by using the min function. Also, how to formulate&amp;nbsp;this into a linear&amp;nbsp;objective function&amp;nbsp;and&amp;nbsp;still captures the true essence of revenue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've also tried the below modification to the objective function, which still gives the same error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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]&amp;gt;&amp;lt; actual_demand[i, j]))
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS :- I'm a first time poster so please be patient if I've included any bad posting practices here, and let me know.&lt;BR /&gt;Also, regarding the problem, I've drastically reduced the complexity for sharing code, sample data and to keep it simple.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Feb 2018 22:01:06 GMT</pubDate>
    <dc:creator>arnav19930</dc:creator>
    <dc:date>2018-02-14T22:01:06Z</dc:date>
    <item>
      <title>Urgent - Using elementwise min(DecisionVar[,], Constant[,]) in PROC optmodel objective function</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Urgent-Using-elementwise-min-DecisionVar-Constant-in-PROC/m-p/437363#M2192</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Demand for various products of a company in different regions is given. This is the quantity in demand.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;number actual_demand{Products, Regions} = [
12 58
34 23
41 6];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Prices of all products in each region are also given.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;number demand_price{Products, Regions} = [
20 8
30 10
10 20];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This company has 3 plants&amp;nbsp;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.&lt;/P&gt;
&lt;P&gt;Objective is maximizing revenue, which is given as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Revenue = demand_price * demand_fulfilled.
Demand_fulfilled = min(Amount Shipped, Actual_Demand)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Amount Shipped is the decision variable in the model. Signifies the amount of each&amp;nbsp;product that was shipped to each region.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var Amount_pl1{Products, Regions} &amp;gt;= 0;
var Amount_pl2{Products, Regions} &amp;gt;= 0;
var Amount_pl3{Products, Regions} &amp;gt;= 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this information, I understand that the objective function should be as follows :-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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]))
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this returns the error -&amp;nbsp;&lt;SPAN&gt;ERROR: The NLP solver does not allow integer variables.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I don't understand why this suddenly becomes an NLP problem by using the min function. Also, how to formulate&amp;nbsp;this into a linear&amp;nbsp;objective function&amp;nbsp;and&amp;nbsp;still captures the true essence of revenue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've also tried the below modification to the objective function, which still gives the same error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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]&amp;gt;&amp;lt; actual_demand[i, j]))
&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS :- I'm a first time poster so please be patient if I've included any bad posting practices here, and let me know.&lt;BR /&gt;Also, regarding the problem, I've drastically reduced the complexity for sharing code, sample data and to keep it simple.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:01:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Urgent-Using-elementwise-min-DecisionVar-Constant-in-PROC/m-p/437363#M2192</guid>
      <dc:creator>arnav19930</dc:creator>
      <dc:date>2018-02-14T22:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent - Using elementwise min(DecisionVar[,], Constant[,]) in PROC optmodel objective function</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Urgent-Using-elementwise-min-DecisionVar-Constant-in-PROC/m-p/437653#M2193</link>
      <description>&lt;P&gt;Yes, the MIN function is nonlinear.&amp;nbsp; To linearize your problem, you&amp;nbsp;can introduce an explicit variable and linear constraints:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;var Demand_fulfilled {Products, Regions} &amp;gt;= 0;
con Linearize1 {i in Products, j in Regions}:
   Demand_fulfilled[i,j] &amp;lt;= Amount_pl1[i,j] + Amount_pl2[i, j] + Amount_pl3[i,j];
con Linearize2 {i in Products, j in Regions}:
   Demand_fulfilled[i,j] &amp;lt;= actual_demand[i,j];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then use Demand_fulfilled in the objective function.&amp;nbsp; Although these constraints enforce only&amp;nbsp;Demand_fulfilled &amp;lt;= min(Amount Shipped, Actual_Demand),&amp;nbsp;the maximization objective will yield&amp;nbsp;&lt;SPAN&gt;Demand_fulfilled = min(Amount Shipped, Actual_Demand) at optimality.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Urgent-Using-elementwise-min-DecisionVar-Constant-in-PROC/m-p/437653#M2193</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2018-02-15T15:51:34Z</dc:date>
    </item>
  </channel>
</rss>

