<?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 Using 1 Constraint OR Another Constraint in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528095#M2546</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Proc Optmodel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A part of my code is:&lt;/P&gt;&lt;P&gt;set setgroup = 1..10;&lt;/P&gt;&lt;P&gt;number&amp;nbsp;IsItTrue {setgroup};&lt;/P&gt;&lt;P&gt;var&amp;nbsp;NewValue {setgroup};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since "IsItTrue" is group of boolean values (0, 1), I want to add a constraint that if IsItTrue = 0, the constraint is acheived, but if IsItTrue = 1, the constraint is acheived if NewValue is above or&amp;nbsp;equal&amp;nbsp;20.&lt;/P&gt;&lt;P&gt;So one constraint IsItTrue (or IsItTrue * NewValue)&amp;nbsp;(&amp;lt;) = 0 OR another constraint IsItTrue * NewValue &amp;gt;= 20.&lt;/P&gt;&lt;P&gt;How can I write this in Optmodel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At another place in the model, I use NewValue * IsItTrue to keep only the NewValue of IsItTrue and make sure the total is higher than 3000, but this new constraint&amp;nbsp;is on individual values, not the total, and it is for different sides (one is lower or equal than 0 while the other is above or equel 20).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jan 2019 17:31:12 GMT</pubDate>
    <dc:creator>etiennel</dc:creator>
    <dc:date>2019-01-17T17:31:12Z</dc:date>
    <item>
      <title>Using 1 Constraint OR Another Constraint</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528095#M2546</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Proc Optmodel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A part of my code is:&lt;/P&gt;&lt;P&gt;set setgroup = 1..10;&lt;/P&gt;&lt;P&gt;number&amp;nbsp;IsItTrue {setgroup};&lt;/P&gt;&lt;P&gt;var&amp;nbsp;NewValue {setgroup};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since "IsItTrue" is group of boolean values (0, 1), I want to add a constraint that if IsItTrue = 0, the constraint is acheived, but if IsItTrue = 1, the constraint is acheived if NewValue is above or&amp;nbsp;equal&amp;nbsp;20.&lt;/P&gt;&lt;P&gt;So one constraint IsItTrue (or IsItTrue * NewValue)&amp;nbsp;(&amp;lt;) = 0 OR another constraint IsItTrue * NewValue &amp;gt;= 20.&lt;/P&gt;&lt;P&gt;How can I write this in Optmodel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At another place in the model, I use NewValue * IsItTrue to keep only the NewValue of IsItTrue and make sure the total is higher than 3000, but this new constraint&amp;nbsp;is on individual values, not the total, and it is for different sides (one is lower or equal than 0 while the other is above or equel 20).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 17:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528095#M2546</guid>
      <dc:creator>etiennel</dc:creator>
      <dc:date>2019-01-17T17:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using 1 Constraint OR Another Constraint</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528103#M2547</link>
      <description>&lt;P&gt;It sounds like you want to introduce linear constraints to enforce a logical implication of the form:&lt;/P&gt;
&lt;P&gt;if IsItTrue[g] = 0 or (IsItTrue[g] = 1 and NewValue[g] &amp;gt;= 20) then (something).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the "something" here?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 18:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528103#M2547</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-01-17T18:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using 1 Constraint OR Another Constraint</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528109#M2548</link>
      <description>&lt;P&gt;I'm using a constraint like this&lt;/P&gt;&lt;P&gt;number TotalValues = 1000;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;con&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; sum{i in setgroup}(NewValue[i] * IsItTrue[i]) &amp;gt;= TotalValues;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use the result of the "if" as a constraint, that for each value in setgroup, IsItTrue[i] is either 0 or NewValue[i] is &amp;gt;= 20;&lt;/P&gt;&lt;P&gt;The "if" would give a value, but how do I specify the "g" in your example or that the "something" is&amp;nbsp;the pass/fail value of the constraint?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I write&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;con&lt;/FONT&gt;&lt;FONT face="Courier New"&gt; and{i in setgroup} (IsItTrue[i] = &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt; or NewValue[i] &amp;gt;= &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;it gives me a synthax error and I don't know why.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 18:33:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528109#M2548</guid>
      <dc:creator>etiennel</dc:creator>
      <dc:date>2019-01-17T18:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using 1 Constraint OR Another Constraint</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528178#M2549</link>
      <description>&lt;P&gt;OK, it sounds like&amp;nbsp;your desired logical implication for each i in setgroup is:&lt;/P&gt;
&lt;P&gt;"IsItTrue[i] =&amp;nbsp;0 or NewValue[i] &amp;gt;= 20"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Equivalently:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;"if IsItTrue[i] = 1 then NewValue[i] &amp;gt;= 20"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can enforce the logical implication with a linear constraint:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con {i in setgroup: IsItTrue[i] = 1}: NewValue[i] &amp;gt;= 20;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If IsItTrue[i] were a binary decision variable instead of a binary constant and NewValue[i] has a lower bound of 0, you would need a different linear constraint:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;con {i in setgroup}: NewValue[i] &amp;gt;= 20 * IsItTrue[i];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jan 2019 21:38:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Using-1-Constraint-OR-Another-Constraint/m-p/528178#M2549</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-01-17T21:38:38Z</dc:date>
    </item>
  </channel>
</rss>

