<?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: find a vector solution from two constraints in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/find-a-vector-solution-from-two-constraints/m-p/371369#M1905</link>
    <description>&lt;P&gt;I think you want to declare a binary variable for each record and then declare your two constraints, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set RECORDS;
num a {RECORDS};
read data indata into RECORDS=[record] a;
var X {RECORDS} binary;
con NumberRecords:
   sum {r in RECORDS} X[r] = 100;
con SumRecords:
   sum {r in RECORDS} a[r]*X[r] = k;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Jun 2017 16:37:25 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2017-06-28T16:37:25Z</dc:date>
    <item>
      <title>find a vector solution from two constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/find-a-vector-solution-from-two-constraints/m-p/371308#M1902</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used SAS/OR proc optmodel before in order to find a solution. But that's for a single number.&lt;/P&gt;
&lt;P&gt;Now I need to randomly pick 100 records from 1000 records. There is another constaint, the sum of these 100 records must be a ceterain number (K).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the constaints are: sum of the total number of records is 100 and the sum of records is K.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where can I start? I look up some of examples but I cannot find anything similar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jun 2017 14:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/find-a-vector-solution-from-two-constraints/m-p/371308#M1902</guid>
      <dc:creator>neilxu</dc:creator>
      <dc:date>2017-06-28T14:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: find a vector solution from two constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/find-a-vector-solution-from-two-constraints/m-p/371369#M1905</link>
      <description>&lt;P&gt;I think you want to declare a binary variable for each record and then declare your two constraints, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set RECORDS;
num a {RECORDS};
read data indata into RECORDS=[record] a;
var X {RECORDS} binary;
con NumberRecords:
   sum {r in RECORDS} X[r] = 100;
con SumRecords:
   sum {r in RECORDS} a[r]*X[r] = k;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jun 2017 16:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/find-a-vector-solution-from-two-constraints/m-p/371369#M1905</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-06-28T16:37:25Z</dc:date>
    </item>
  </channel>
</rss>

