<?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 / Results not sastifying constraints in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576306#M2831</link>
    <description>&lt;P&gt;The default feasibility tolerance is 1e-6, so 1e-7 is within that tolerance.&amp;nbsp; You can change the value by using the FEASTOL= option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the sum of W to be 1, it might be best to explicitly declare such a constraint.&amp;nbsp; If that doesn't suffice, please share your data.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 18:02:40 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2019-07-24T18:02:40Z</dc:date>
    <item>
      <title>proc optmodel / Results not sastifying constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576287#M2830</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote the following code that determines the weights maximizing a ratio. These weights should be positive given the constraint on variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	var W{Assets_BY} &amp;gt;= 0 &amp;lt;= 0.1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but many of them are actually negative (admittedly small, with order E-7). However, when I rescale them so that their sum is equal to 1, they are no longer negligible with the smaller value being equal to -0.135.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let byvar = grp;
proc optmodel printlevel=0;
	set OBS;
	num grp {OBS};
	set &amp;lt;string&amp;gt; Assets;
	set &amp;lt;num,str&amp;gt; GROUPS_ASSETS;
	number MVC{GROUPS_ASSETS, Assets};

	read data Work.MVC into Assets=[Name];
	read data Work.MVC into OBS=[_N_] grp;
	read data Work.MVC nomiss into GROUPS_ASSETS=[k=grp i=Name] {j in Assets} &amp;lt;MVC[k,i,j]=col(j)&amp;gt;;

	set BYSET = setof {i in OBS} &amp;amp;byvar.[i];
	num by;

	set OBS_BY = {i in OBS: &amp;amp;byvar.[i] = by};
	set Assets_BY = setof {o in OBS_BY, &amp;lt;(grp[o]),a&amp;gt; in GROUPS_ASSETS} a;
	var W{Assets_BY} &amp;gt;= 0 &amp;lt;= 0.1;
	impvar Denom = sqrt(sum{i in Assets_BY, j in Assets_BY}W[i]*MVC[by,i,j]*W[j]);

	maximize DR =  log(sum{i in Assets_BY}W[i]*sqrt(MVC[by,i,i]) / Denom);

	num W_sol {GROUPS_ASSETS};
	do by = BYSET;
		put by=;
		solve;
		for {i in Assets_BY} W_sol[by,i] = W[i].sol;
	end;

	create data Work.Weights_MD from [&amp;amp;byvar i] W=W_sol;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for any advice to obtain weights that respect the lower and upper bounds,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS: if necessary, I will provide a small working example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 17:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576287#M2830</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-24T17:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc optmodel / Results not sastifying constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576306#M2831</link>
      <description>&lt;P&gt;The default feasibility tolerance is 1e-6, so 1e-7 is within that tolerance.&amp;nbsp; You can change the value by using the FEASTOL= option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the sum of W to be 1, it might be best to explicitly declare such a constraint.&amp;nbsp; If that doesn't suffice, please share your data.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 18:02:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576306#M2831</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-07-24T18:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc optmodel / Results not sastifying constraints</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576316#M2832</link>
      <description>&lt;P&gt;Thank you very much for your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to define a lower feasibility tolerance. As for the "sum of weight" constraint, I removed it because it was much longer with it, but perhaps it will be more efficient than a lower feasibility tolerance. I will perform some tests. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 18:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-Results-not-sastifying-constraints/m-p/576316#M2832</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-07-24T18:27:45Z</dc:date>
    </item>
  </channel>
</rss>

