<?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: Optimization Problem in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308118#M1479</link>
    <description>&lt;P&gt;You can use the &lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_toc.htm" target="_self"&gt;OPTMODEL procedure in SAS/OR&lt;/A&gt; to formulate and solve optimization problems.&amp;nbsp; There is a whole &lt;A href="http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#titlepage.htm" target="_self"&gt;book of examples&lt;/A&gt; to help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 30 Oct 2016 14:34:27 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2016-10-30T14:34:27Z</dc:date>
    <item>
      <title>Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308117#M1478</link>
      <description>&lt;P&gt;Hello, i have to&amp;nbsp;solve an optimization problem.&lt;/P&gt;&lt;P&gt;I attached two slides where you can see optimization problem(maximum revenue) with constraints and example.&lt;/P&gt;&lt;P&gt;What procedure can i use to solve problem, and how i write this optimization? I never used OR before.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13090i40761EF4D47460C7/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Slide1.JPG" title="Slide1.JPG" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13091i1FC1DB0FCC27D7A7/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Slide2.JPG" title="Slide2.JPG" /&gt;</description>
      <pubDate>Sun, 30 Oct 2016 04:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308117#M1478</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2016-10-30T04:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308118#M1479</link>
      <description>&lt;P&gt;You can use the &lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_toc.htm" target="_self"&gt;OPTMODEL procedure in SAS/OR&lt;/A&gt; to formulate and solve optimization problems.&amp;nbsp; There is a whole &lt;A href="http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#titlepage.htm" target="_self"&gt;book of examples&lt;/A&gt; to help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2016 14:34:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308118#M1479</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-10-30T14:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308134#M1480</link>
      <description>&lt;PRE&gt;
Here are several questions.
What does Px stand for , how do you define Px ?
How do you define x1=1 ? when you choose both cola and  peanuts ? or just one of them ?

Here is iML code for your  example by Genetic Algorithm.



proc iml;
start func(x) global(x1,x2,x3,m,c,p,items,idx); 
if any(idx=sum(x)) then do;
 temp=p[loc(x)];
 xx=all(element(x1,temp))||
    all(element(x2,temp))||
    all(element(x3,temp)) ;   
 obj= sum(m#xx)-sum(c#x); 
end;
else obj=-99999;
 return (obj);
finish;


items=3;

p={cola peanuts cheese beer};
m={10 20 30};
c={5 3 1 4};
n=ncol(p);
idx=1:items;
encoding=repeat({0,1},1,n);

x1={cola peanuts};
x2={peanuts cheese};
x3={peanuts beer};

id=gasetup(2,n,12345678);
call gasetobj(id,1,"func");
call gasetcro(id,0.95,2);
call gasetmut(id,0.95,3);
call gasetsel(id,100,1,1);
call gainit(id,10000,encoding); 

niter = 1000;
do i = 1 to niter;
 call garegen(id);
 call gagetval(value, id);
end;
call gagetmem(mem, value, id, 1);

print (p[loc(mem)])[l="members"],value[l = "Max Value:"] ;
call gaend(id);
quit;




OUTPUT:

members
PEANUTS
CHEESE
BEER


Max Value:
42

&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Oct 2016 10:31:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308134#M1480</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-30T10:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308139#M1481</link>
      <description>&lt;P&gt;GA provides no measure of optimality for the solution it returns, and so you should probably use that only when a specialized solver is not available.&amp;nbsp; In particular, if you are going to use IML to solve a MILP, you might as well call the &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/68150/HTML/default/viewer.htm#imlug_langref_sect256.htm" target="_self"&gt;MILPSOLVE subroutine&lt;/A&gt;, which invokes the same&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_milpsolver_toc.htm" target="_self"&gt;MILP solver&lt;/A&gt; that is accessible&amp;nbsp;from PROC OPTMODEL.&amp;nbsp; The&amp;nbsp;PROC OPTMODEL syntax will more closely match your algebraic formulation.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Oct 2016 14:32:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308139#M1481</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-10-30T14:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308515#M1482</link>
      <description>&lt;P&gt;The problem thay i don't have sas&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/68156/HTML/default/viewer.htm#ormpug_optmodel_toc.htm" target="_self" rel="nofollow noopener noreferrer"&gt;SAS/OR&lt;/A&gt;, only SAS/IML. Can i use it to solve optimization?&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2016 14:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308515#M1482</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2016-11-01T14:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308521#M1483</link>
      <description>&lt;P&gt;Unfortunately i don't have SAS/OR, only SAS/IML. I attached more normal explanation. please see it. I have a lot of itemsets(X), they can be different bu size, for example, in one you can gave only milk, in other you have milk and sugar.&lt;/P&gt;&lt;P&gt;i have two decision variables to be optimized P and Q.(they binary variables, and got two values : 1 or zero, 1 means that product was choosen). Thank you for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13097i3349A74DCEE3CC8C/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Optimization.jpg" title="Optimization.jpg" /&gt;</description>
      <pubDate>Tue, 01 Nov 2016 14:43:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308521#M1483</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2016-11-01T14:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308522#M1484</link>
      <description>&lt;P&gt;Unfortunately i don't have SAS/OR, only SAS/IML. Can i solve this optimization with &lt;SPAN&gt;SAS/IML?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Please see attached file. &amp;nbsp;Thank you&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13098iB23BEBAA18BE7DAA/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Optimization.jpg" title="Optimization.jpg" /&gt;</description>
      <pubDate>Tue, 01 Nov 2016 14:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308522#M1484</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2016-11-01T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308649#M1485</link>
      <description>&lt;PRE&gt;
Yeah. GA can't guarantee the optimal solution. But if the number of items is not too big, I think GA is ok .
And change number of iteration in my code to be bigger and make sure to get better solution.

I still am not understand Q1&amp;gt;=P1 .
Q1,P1  in (0 ,1) ?
How do you define P1=1 , when x1=both cola and peanuts ?

&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2016 02:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308649#M1485</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-02T02:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308674#M1486</link>
      <description>That means when i choose itemset X1, and this itemset adds profit i.e P1=1, then every product inside itemset X1 have to be choosen, i.e i itemset X1 has three products then all Q1, Q2 and Q3 have to be equal to 1. P and Q decision binary variables. The problem that i have to data sets, one that include all itemsets and the second all products and their cost. I really dont know if sas can solve this problem. Maybe try other language?</description>
      <pubDate>Wed, 02 Nov 2016 05:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308674#M1486</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2016-11-02T05:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308719#M1487</link>
      <description>So My GA code is doing that. I also want see &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/61855"&gt;@rob&lt;/a&gt; post OR code, that might be your best choice.</description>
      <pubDate>Wed, 02 Nov 2016 11:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308719#M1487</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-02T11:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308807#M1488</link>
      <description>&lt;P&gt;Thank you for your help&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 17:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/308807#M1488</guid>
      <dc:creator>AlexeyS</dc:creator>
      <dc:date>2016-11-02T17:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Optimization Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/309758#M1500</link>
      <description>&lt;P&gt;Here it is in PROC OPTMODEL with the MILP solver:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   set ITEMS = /cola peanuts cheese beer/;
   num cost {ITEMS} = [5 3 1 4];
   set ITEM_SETS = 1..3;
   set &amp;lt;str&amp;gt; X {ITEM_SETS};
   X[1] = /cola peanuts/;
   X[2] = /peanuts cheese/;
   X[3] = /peanuts beer/;
   num m {ITEM_SETS} = [10 20 30];

   var P {ITEM_SETS} binary;
   var Q {ITEMS} binary;
   con SelectThreeItems:
      sum {i in ITEMS} Q[i] &amp;lt;= 3;
   con SetImpliesItem {s in ITEM_SETS, i in X[s]}:
      P[s] &amp;lt;= Q[i];
   max Z = sum {s in ITEM_SETS} m[s] * P[s] - sum {i in ITEMS} cost[i] * Q[i];

   solve;
   print P Q;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Optmodel: Solution Summary" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="2" scope="colgroup"&gt;Solution Summary&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Solver&lt;/TH&gt;
&lt;TD class="r data"&gt;MILP&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Algorithm&lt;/TH&gt;
&lt;TD class="r data"&gt;Branch and Cut&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Objective Function&lt;/TH&gt;
&lt;TD class="r data"&gt;Z&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Solution Status&lt;/TH&gt;
&lt;TD class="r data"&gt;Optimal&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Objective Value&lt;/TH&gt;
&lt;TD class="r data"&gt;42&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TD class="r data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Relative Gap&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Absolute Gap&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Primal Infeasibility&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Bound Infeasibility&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Integer Infeasibility&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TD class="r data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Best Bound&lt;/TH&gt;
&lt;TD class="r data"&gt;42&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Nodes&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Iterations&lt;/TH&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Presolve Time&lt;/TH&gt;
&lt;TD class="r data"&gt;0.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;Solution Time&lt;/TH&gt;
&lt;TD class="r data"&gt;0.00&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;&lt;A name="IDX16" target="_blank"&gt;&lt;/A&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Optmodel: PrintTable" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;[1]&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;P&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;&lt;A name="IDX17" target="_blank"&gt;&lt;/A&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Optmodel: PrintTable" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;[1]&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Q&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;beer&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;cheese&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;cola&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;peanuts&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Nov 2016 16:06:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Optimization-Problem/m-p/309758#M1500</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-11-07T16:06:26Z</dc:date>
    </item>
  </channel>
</rss>

