<?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: linearizing a constraint optmodel in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370280#M1898</link>
    <description>&lt;P&gt;But the equation for your constraint does not contain j anywhere. &amp;nbsp;So for the same i but different j, the constraint declaration will generate the same equation. &amp;nbsp;If you did not see duplicates when you used EXPAND, then I suspect the code you ran is somehow different than what you posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, I think I understand what you want to accomplish. &amp;nbsp;So let me describe the model generically and you can modify it as needed to use in your optimization problem. &amp;nbsp;Suppose x and y are variables, with 0 &amp;lt;= x &amp;lt;= u, where u is some constant, and y &amp;gt;= 0. &amp;nbsp;You want to model the logical implication "if x &amp;gt; 0 then y &amp;gt;= c," where c is some constant. &amp;nbsp;Then you can introduce a binary variable z and the following constraints:&lt;/P&gt;
&lt;P&gt;x &amp;lt;= u * z&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;y &amp;gt;= c * z.&lt;/P&gt;
&lt;P&gt;If x &amp;gt; 0, the first constraint forces z = 1. &amp;nbsp;If z = 1, the second constraint forces y &amp;gt;= c. &amp;nbsp;So together they enforce the desired implication: if x &amp;gt; 0 then y &amp;gt;= c.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Jun 2017 16:40:12 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2017-06-24T16:40:12Z</dc:date>
    <item>
      <title>linearizing a constraint optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370257#M1895</link>
      <description>&lt;P&gt;how to linearize the following constraint to be able to solve it with optmodel&lt;BR /&gt;con Con1 {i in Item ,j in Cust}: (limit[i,'A1'] -x[i,'A1']) * x[i,'A2']=0;&lt;BR /&gt;where x is the decision variable.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jun 2017 12:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370257#M1895</guid>
      <dc:creator>AAZ</dc:creator>
      <dc:date>2017-06-24T12:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: linearizing a constraint optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370263#M1896</link>
      <description>&lt;P&gt;What kind of variable is x?&lt;BR /&gt;&lt;BR /&gt;Also, the constraint is declared over i and j but does not depend on j. The effect is that you get multiple copies of the same equation. You can use the EXPAND statement to see this.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jun 2017 13:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370263#M1896</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-06-24T13:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: linearizing a constraint optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370264#M1897</link>
      <description>&lt;P&gt;X is an integer variable "quantity". the constraint depends on Both i and j. &amp;nbsp;where j is the customer A,B,C. for customer A I have two offers for customer A; A1&amp;amp; A2, where&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;customer&amp;nbsp;can only leverage the discounted price A2 if he takes a minimum of quantity x with price A1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used expand and the function is working fine.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The thing is that I need an integer variable, and I receive this error"&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;The NLP solver does not allow integer variables" when x is defined as integer. &amp;nbsp;while, when x is not an integer it works fine but with lots of decimals&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jun 2017 13:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370264#M1897</guid>
      <dc:creator>AAZ</dc:creator>
      <dc:date>2017-06-24T13:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: linearizing a constraint optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370280#M1898</link>
      <description>&lt;P&gt;But the equation for your constraint does not contain j anywhere. &amp;nbsp;So for the same i but different j, the constraint declaration will generate the same equation. &amp;nbsp;If you did not see duplicates when you used EXPAND, then I suspect the code you ran is somehow different than what you posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, I think I understand what you want to accomplish. &amp;nbsp;So let me describe the model generically and you can modify it as needed to use in your optimization problem. &amp;nbsp;Suppose x and y are variables, with 0 &amp;lt;= x &amp;lt;= u, where u is some constant, and y &amp;gt;= 0. &amp;nbsp;You want to model the logical implication "if x &amp;gt; 0 then y &amp;gt;= c," where c is some constant. &amp;nbsp;Then you can introduce a binary variable z and the following constraints:&lt;/P&gt;
&lt;P&gt;x &amp;lt;= u * z&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;y &amp;gt;= c * z.&lt;/P&gt;
&lt;P&gt;If x &amp;gt; 0, the first constraint forces z = 1. &amp;nbsp;If z = 1, the second constraint forces y &amp;gt;= c. &amp;nbsp;So together they enforce the desired implication: if x &amp;gt; 0 then y &amp;gt;= c.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jun 2017 16:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370280#M1898</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-06-24T16:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: linearizing a constraint optmodel</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370480#M1899</link>
      <description>&lt;P&gt;Thank you Rob,&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2017 10:57:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/linearizing-a-constraint-optmodel/m-p/370480#M1899</guid>
      <dc:creator>AAZ</dc:creator>
      <dc:date>2017-06-26T10:57:19Z</dc:date>
    </item>
  </channel>
</rss>

