<?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: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!! in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421721#M2144</link>
    <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The attached&amp;nbsp;version incorporates the cardinality constraint of 35 apples per bag, which I had omitted. Unfortunately no solution is found&amp;nbsp;with the new formulation after several minutes.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Dec 2017 22:17:36 GMT</pubDate>
    <dc:creator>lipury</dc:creator>
    <dc:date>2017-12-15T22:17:36Z</dc:date>
    <item>
      <title>PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420639#M2124</link>
      <description>&lt;P&gt;Hi all:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a mathematical programming problem which can be briefly described like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a total of 2000 apples and need to select some of them for assignment to 10 bags. The following constraints/objective function need to be satisfied:&lt;/P&gt;&lt;P&gt;1. Constraint: An apple is assigned to no more than one bag.&lt;/P&gt;&lt;P&gt;2. Constraint: The total number of apples in each bag is 35.&lt;/P&gt;&lt;P&gt;3. Objective function: The total weight of the apples in each bag is as close to 25 lbs as possible.&lt;/P&gt;&lt;P&gt;Clearly, this is an assignment problem which needs to be solved using binary decision variables (We use i to index apples and use j to index bags). In PROC OPTMODEL, the first two constraints are very easy to formulate with binary decision variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main issue is with the objective function which asks the total weight of apples be as close to 25 lbs as possible (i.e., minimize the deviation from 25 on both sides: 1) minimization of surplus from 25 and 2) minimization of slack from 25). We plan to implement an&amp;nbsp;ABSOLUTE VALUE operation on this objective function: Within each bag j: | summation of (values of decision variables * weight of all apples) - 25| should be as small as possible (i.e., absolute value should be as close to zero as possible). Therefore, the objective function is nonlinear in the decision variables due to the absolute value operation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of SAS/OR 14.2, PROC OPTMODEL cannot directly handle INTEGER decision variables in a NONLINEAR objective function. We need to linearize this objective function. After consulting around, we got the following code. Wondering if it is correct for our purpose? Any insights will be highly appreciated: Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let&lt;SPAN&gt;&amp;nbsp;TotalBags=10; &lt;/SPAN&gt;/*Total number of bags*/&lt;/P&gt;&lt;P&gt;%let&lt;SPAN&gt;&amp;nbsp;TotalApples=2000; &lt;/SPAN&gt;/*Total number of apples*/&lt;/P&gt;&lt;P&gt;%let&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;number_Apple_Goal=35; /*Goal on the number of apples assigned to each bag*/&lt;/P&gt;&lt;P&gt;%let&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;weight_Apple_Goal=25; /*Goal on the weight of apples assigned to each bag*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;bags =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;1..&lt;/STRONG&gt;&amp;amp;TotalBags.;&lt;/P&gt;&lt;P&gt;set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;apples =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;1..&lt;/STRONG&gt;&amp;amp;TotalApples.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;number apple_weight {apples};&lt;/P&gt;&lt;P&gt;var&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;bagApples{apples, bags}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;binary; /*Decision variables on which apples are assigned to which bags*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;con&lt;SPAN&gt;&amp;nbsp;no_twobags&lt;/SPAN&gt; {i in apples}: sum {j in bags} bagApples[i,j] &amp;lt;=&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;/*No apple is selected for more than one bag*/&lt;/P&gt;&lt;P&gt;con&lt;SPAN&gt;&amp;nbsp;total_apples_bag&lt;/SPAN&gt; {j in bags}: sum {i in apples} bagApples[i,j] = &amp;amp;number_Apple_Goal.;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;/*Goal on the number of apples in a bag*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var&amp;nbsp;surplus {bags} &amp;gt;=&amp;nbsp;&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;var&amp;nbsp;slack {bags} &amp;gt;=&amp;nbsp;&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;min&amp;nbsp;obj_abs_weight_goal = sum {j in bags} (surplus[j] + slack[j]);&lt;/P&gt;&lt;P&gt;con&amp;nbsp;obj_to_con_goal {j in bags}: sum {i in apples} bagApples[i,j] * apple_weight[i] - surplus[j] + slack[j] = &amp;amp;weight_Apple_Goal.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 00:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420639#M2124</guid>
      <dc:creator>PatrickYang</dc:creator>
      <dc:date>2017-12-13T00:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420641#M2125</link>
      <description>&lt;P&gt;Yes, this looks correct to me.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 00:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420641#M2125</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-12-13T00:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420899#M2127</link>
      <description>&lt;P&gt;Hi Rob:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much! Your response is always helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, one of my team members is wondering about two things:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;SPAN&gt;min&amp;nbsp;obj_abs_weight_goal = sum {j in bags} (surplus[j] + slack[j]); Why is the objective function the way it is? My understanding is that, since both surplus and slack parameters are set up to be POSITIVE, the minimization of the summation of the two is equivalent to the minimization of both positive parameters to the extent that they are as close to zero as possible.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2.&amp;nbsp;con&amp;nbsp;obj_to_con_goal {j in bags}: sum {i in apples} bagApples[i,j] * apple_weight[i] - surplus[j] + slack[j] = &amp;amp;weight_Apple_Goal.; What does the summation of the last two terms (i.e., -surplus[j] + slack[j]) on the left-hand side of the equation do? My understanding is that, within each bag indexed by j, the total weight of all assigned apples minus the amount greater than 25, IF ANY (when this happens to bag j, slack for this bag = 0), plus the amount less than 25, IF ANY (when this happens to bag j, surplus for this bag = 0), should equal 25, the target weight for bag j.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you so much, Rob.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 17:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420899#M2127</guid>
      <dc:creator>PatrickYang</dc:creator>
      <dc:date>2017-12-13T17:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420914#M2129</link>
      <description>&lt;P&gt;Yes, that is the right idea.&amp;nbsp; Both surplus[j] and slack[j] are nonnegative penalty variables for missing the target for bag j.&amp;nbsp; At optimality, they will not both be positive because otherwise you could reduce both variables by the same amount and preserve satisfaction of the&amp;nbsp;&lt;SPAN&gt;obj_to_con_goal[j] constraint&lt;/SPAN&gt;&amp;nbsp;while improving the objective function value.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 17:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/420914#M2129</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-12-13T17:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421245#M2138</link>
      <description>&lt;P&gt;Thank you, Rob. Your response has helped our team solve a major issue and allowed us to proceed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, thank you for making PROC OPTMODEL so&amp;nbsp;user-friendly and powerful to use.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 16:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421245#M2138</guid>
      <dc:creator>PatrickYang</dc:creator>
      <dc:date>2017-12-14T16:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421319#M2139</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;You might be interested to know that the CLP procedure&amp;nbsp;implements a bin packing constraint,&amp;nbsp;specifically designed to tackle&amp;nbsp;problems&amp;nbsp;like this one. The constraint programming engine can even be invoked from the OPTMODEL procedure using "solve with clp", but the attached code would need to be translated. I have made the assumption that the optimal solution is attainable. Alternately, one can add an objective function, but&amp;nbsp;that formulation&amp;nbsp;took longer to find an inferior solution.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Thanks!&lt;BR /&gt;Lindsey&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 19:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421319#M2139</guid>
      <dc:creator>lipury</dc:creator>
      <dc:date>2017-12-14T19:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421645#M2141</link>
      <description>Hi Lindsey:&lt;BR /&gt;&lt;BR /&gt;Thank you for sharing with us this new option. It was unknown to us. We will work on understanding the code and see if we can fully implement it in our work. Hopefully, we can fully figure out the details of the code after going through the documentation. If not, we will respond to this message with the hope to check with you again. Thank you for the new insights!!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 15 Dec 2017 16:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421645#M2141</guid>
      <dc:creator>PatrickYang</dc:creator>
      <dc:date>2017-12-15T16:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC OPTMODEL for Nonlinear Integer Optimization - HELP!!!!</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421721#M2144</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The attached&amp;nbsp;version incorporates the cardinality constraint of 35 apples per bag, which I had omitted. Unfortunately no solution is found&amp;nbsp;with the new formulation after several minutes.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 22:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/PROC-OPTMODEL-for-Nonlinear-Integer-Optimization-HELP/m-p/421721#M2144</guid>
      <dc:creator>lipury</dc:creator>
      <dc:date>2017-12-15T22:17:36Z</dc:date>
    </item>
  </channel>
</rss>

