<?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 Re: Single dimension Constraint on two dimensional Optimization Problem in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538649#M2595</link>
    <description>&lt;P&gt;Here are four ways, in increasing order of efficiency.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Impose explicit constraint:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* if X[i,j] = 1 then score[i] &amp;gt;= 500 */
con MinScore {i in ITEMS, j in CASES}: score[i] &amp;gt;= 500 * X[i,j];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. Fix variables to 0:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* if score[i] &amp;lt; 500 then X[i,j] = 0 */
for {i in ITEMS: score[i] &amp;lt; 500} for {j in CASES} fix X[i,j] = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3. Modify index set after reading data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read data have into ITEMS=[id] cost score {j in CASES} &amp;lt;profit[id,j]=col('profit_'||j)&amp;gt;;
ITEMS = {i in ITEMS: score[i] &amp;gt;= 500};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;4. Use WHERE= in READ DATA:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read data have(where=(score &amp;gt;= 500)) into ITEMS=[id] cost score {j in CASES} &amp;lt;profit[id,j]=col('profit_'||j)&amp;gt;;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See also &lt;A href="https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_examples07.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;this doc example&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Feb 2019 15:38:48 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2019-02-26T15:38:48Z</dc:date>
    <item>
      <title>Single dimension Constraint on two dimensional Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538602#M2594</link>
      <description>&lt;P&gt;I have below data:&lt;/P&gt;&lt;P&gt;id $ cost profit_1 profit_2 score;&lt;BR /&gt;A -1 10 11 500&lt;BR /&gt;B -0.6 10 5 700&lt;BR /&gt;C -0.75 10 10.5 700&lt;BR /&gt;D -0.75 10.5 10 600&lt;BR /&gt;E -0.65 12 11 300&lt;BR /&gt;F -0.65 12 13 350;&lt;BR /&gt;Following code does the work when considering profits only:&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;BR /&gt;set &amp;lt;str&amp;gt; ITEMS;&lt;BR /&gt;num cost {ITEMS};&lt;BR /&gt;set CASES = 1..2;&lt;BR /&gt;num profit {ITEMS, CASES};&lt;BR /&gt;read data have into ITEMS=[id] cost {j in CASES} &amp;lt;profit[id,j]=col('profit_'||j)&amp;gt;;&lt;BR /&gt;var X {ITEMS, CASES} binary;&lt;BR /&gt;max TotalProfit = sum {i in ITEMS, j in CASES} profit[i,j] * X[i,j];&lt;BR /&gt;con ChooseOne {i in ITEMS}: sum {j in CASES} X[i,j] &amp;lt;= 1;&lt;BR /&gt;con Budget: sum {i in ITEMS, j in CASES} cost[i] * X[i,j] &amp;lt;= 1.5;&lt;BR /&gt;solve;&lt;BR /&gt;print X;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;but I want to add another constraint on score.&lt;BR /&gt;Something like SCORE must be greater than 500, i tried inserting following -&lt;BR /&gt;num score {ITEMS}&lt;/P&gt;&lt;P&gt;then in read data statement- SCORE[id] = col('SCORE')&lt;/P&gt;&lt;P&gt;And finally the constraint- con MinScore SCORE{i in ITEMS}: SCORE[id]&amp;gt;=500&lt;/P&gt;&lt;P&gt;but this is leading to infeasible solution because of cases where SCORE &amp;gt;=500.&lt;/P&gt;&lt;P&gt;Can anyone help in how to do this and what am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 09:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538602#M2594</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-02-26T09:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Single dimension Constraint on two dimensional Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538649#M2595</link>
      <description>&lt;P&gt;Here are four ways, in increasing order of efficiency.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Impose explicit constraint:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* if X[i,j] = 1 then score[i] &amp;gt;= 500 */
con MinScore {i in ITEMS, j in CASES}: score[i] &amp;gt;= 500 * X[i,j];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2. Fix variables to 0:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* if score[i] &amp;lt; 500 then X[i,j] = 0 */
for {i in ITEMS: score[i] &amp;lt; 500} for {j in CASES} fix X[i,j] = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3. Modify index set after reading data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read data have into ITEMS=[id] cost score {j in CASES} &amp;lt;profit[id,j]=col('profit_'||j)&amp;gt;;
ITEMS = {i in ITEMS: score[i] &amp;gt;= 500};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;4. Use WHERE= in READ DATA:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;read data have(where=(score &amp;gt;= 500)) into ITEMS=[id] cost score {j in CASES} &amp;lt;profit[id,j]=col('profit_'||j)&amp;gt;;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;See also &lt;A href="https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_examples07.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;this doc example&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 15:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538649#M2595</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-02-26T15:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Single dimension Constraint on two dimensional Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538738#M2596</link>
      <description>Thanks a lot for your response. I was able to do 3 and 4, but it was subsetting my observations in output, so wasn't inclined. Finally I found 2 but was quite sure that this can be done in CON statement. Thanks again for 1. Very grateful for what I am learning from you.</description>
      <pubDate>Tue, 26 Feb 2019 18:03:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538738#M2596</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-02-26T18:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Single dimension Constraint on two dimensional Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538839#M2597</link>
      <description>&lt;P&gt;Glad to help.&amp;nbsp; By the way, because of the ChooseOne constraint, you can tighten the MinScore constraint as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con MinScore {i in ITEMS}: score[i] &amp;gt;= 500 * sum {j in CASES} X[i,j];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In either case, the MILP presolver will force X[i,j] to 0 if score[i] &amp;lt; 500.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Feb 2019 22:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/538839#M2597</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-02-26T22:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Single dimension Constraint on two dimensional Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/539991#M2600</link>
      <description>Thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 04 Mar 2019 10:43:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Single-dimension-Constraint-on-two-dimensional-Optimization/m-p/539991#M2600</guid>
      <dc:creator>thepushkarsingh</dc:creator>
      <dc:date>2019-03-04T10:43:06Z</dc:date>
    </item>
  </channel>
</rss>

