<?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 WHY WE USE IMPVAR? in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/WHY-WE-USE-IMPVAR/m-p/590414#M2885</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I dont know why we use IMPVAR.&lt;/P&gt;&lt;P&gt;I have the following code&lt;/P&gt;&lt;PRE&gt;PROC OPTMODEL;
/* declare sets and parameters */
set RESOURCES = /labor metal wood/;
set PRODUCTS = /desks chairs bookcases bedframes/;
num selling_price {PRODUCTS} = [94 79 125 109];
num cost {RESOURCES} = [14 20 11];
num availability {RESOURCES} = [225 117 420];
num required {PRODUCTS, RESOURCES} =
[2 1 3
1 1 3
3 1 4
2 1 4];
/* declare variables */
var NumProd {PRODUCTS} &amp;gt;= 0;
impvar Revenue = sum {p in PRODUCTS}
selling_price[p] * NumProd[p];
impvar AmountUsed {r in RESOURCES} =
sum {p in PRODUCTS} NumProd[p] * required[p,r];
impvar TotalCost = sum {r in RESOURCES}
cost[r] * AmountUsed[r];
/* declare constraints */
con Usage {r in RESOURCES}:
AmountUsed[r] &amp;lt;= availability[r];
/* declare objective */
max NetProfit = Revenue - TotalCost;
/*print model formulation*/
expand;
/*solve the model*/
solve;
/*print parts of the model*/
print NumProd;
quit;&lt;/PRE&gt;&lt;P&gt;I have two question:&lt;/P&gt;&lt;P&gt;1-Please can someone tell me why are we using IMPVAR?&lt;/P&gt;&lt;P&gt;2- Can someone solve the above example using VAR only so that I can know the difference between VAR and IMPVAR.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
    <pubDate>Fri, 20 Sep 2019 14:11:18 GMT</pubDate>
    <dc:creator>rohailk</dc:creator>
    <dc:date>2019-09-20T14:11:18Z</dc:date>
    <item>
      <title>WHY WE USE IMPVAR?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/WHY-WE-USE-IMPVAR/m-p/590414#M2885</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I dont know why we use IMPVAR.&lt;/P&gt;&lt;P&gt;I have the following code&lt;/P&gt;&lt;PRE&gt;PROC OPTMODEL;
/* declare sets and parameters */
set RESOURCES = /labor metal wood/;
set PRODUCTS = /desks chairs bookcases bedframes/;
num selling_price {PRODUCTS} = [94 79 125 109];
num cost {RESOURCES} = [14 20 11];
num availability {RESOURCES} = [225 117 420];
num required {PRODUCTS, RESOURCES} =
[2 1 3
1 1 3
3 1 4
2 1 4];
/* declare variables */
var NumProd {PRODUCTS} &amp;gt;= 0;
impvar Revenue = sum {p in PRODUCTS}
selling_price[p] * NumProd[p];
impvar AmountUsed {r in RESOURCES} =
sum {p in PRODUCTS} NumProd[p] * required[p,r];
impvar TotalCost = sum {r in RESOURCES}
cost[r] * AmountUsed[r];
/* declare constraints */
con Usage {r in RESOURCES}:
AmountUsed[r] &amp;lt;= availability[r];
/* declare objective */
max NetProfit = Revenue - TotalCost;
/*print model formulation*/
expand;
/*solve the model*/
solve;
/*print parts of the model*/
print NumProd;
quit;&lt;/PRE&gt;&lt;P&gt;I have two question:&lt;/P&gt;&lt;P&gt;1-Please can someone tell me why are we using IMPVAR?&lt;/P&gt;&lt;P&gt;2- Can someone solve the above example using VAR only so that I can know the difference between VAR and IMPVAR.&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 14:11:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/WHY-WE-USE-IMPVAR/m-p/590414#M2885</guid>
      <dc:creator>rohailk</dc:creator>
      <dc:date>2019-09-20T14:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: WHY WE USE IMPVAR?</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/WHY-WE-USE-IMPVAR/m-p/590662#M2886</link>
      <description>&lt;P&gt;As described &lt;A href="https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_syntax03.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en#ormpug.optmodel.npximpvarstmt" target="_self"&gt;here&lt;/A&gt;, implicit variables are useful when the same expression is needed in several places and you don't want to increase the number of explicit variables and constraints.&lt;BR /&gt;&lt;BR /&gt;For your code, if you wanted to replace the first implicit variable, for example, it would look like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*impvar AmountUsed {r in RESOURCES} =
   sum {p in PRODUCTS} NumProd[p] * required[p,r];
var AmountUsed {RESOURCES};
con AmountUsedCon {r in RESOURCES}: AmountUsed[r] =
   sum {p in PRODUCTS} NumProd[p] * required[p,r];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2019 21:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/WHY-WE-USE-IMPVAR/m-p/590662#M2886</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-09-21T21:33:44Z</dc:date>
    </item>
  </channel>
</rss>

