<?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: saving solution status in a dataset in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582459#M2846</link>
    <description>&lt;P&gt;Yes, you can use the &lt;A href="https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_details68.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en#ormpug.optmodel.statparams" target="_self"&gt;_solution_status_&lt;/A&gt; parameter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num W_sol {GROUPS_ASSETS};
str solstatus {BYSET};
do by = BYSET;
   put by=;
   solve with NLP / feastol = 1E-7 logfreq = 0 maxiter = 10000;
   for {i in Assets_BY} W_sol[by,i] = W[i].sol;
   solstatus[by] = _solution_status_;
end;

create data Weights_NoShort from [&amp;amp;byvar i] W=W_sol;
create data solstatusdata from [&amp;amp;byvar] solstatus;
&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2019 15:07:43 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2019-08-20T15:07:43Z</dc:date>
    <item>
      <title>proc optmodel: saving solution status in a dataset</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582436#M2845</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to save in a dataset the solution status of proc optmodel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm indeed running thousands of optimization problems such as:&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;
	set &amp;lt;str&amp;gt; ASSETS;
	set &amp;lt;num,str&amp;gt; GROUPS_ASSETS;
	set GROUPS;

	num grp{OBS};
	num MVC{GROUPS_ASSETS, ASSETS};
	num E{GROUPS_ASSETS};
	num target_var{GROUPS};

	read data MVC into ASSETS=[Name];
	read data MVC into OBS=[_N_] grp;
	read data MVC nomiss into GROUPS_ASSETS=[k=grp i=Name] {j in ASSETS} &amp;lt;MVC[k,i,j]=col(j)&amp;gt;;
	read data Predicted nomiss into [k=grp] {j in ASSETS} &amp;lt;E[k,j]=col(j)&amp;gt;;
	read data Target_Var into GROUPS=[grp] target_var;

	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} &amp;gt;= 0;

	maximize Expected = sum{i in Assets_BY}W[i]*E[by,i];
	con sum{i in Assets_BY, j in Assets_BY}W[i]*MVC[by,i,j]*W[j] = target_var[by];
	con BUDGET: sum{i in Assets_BY}W[i] = 1;

	num W_sol {GROUPS_ASSETS};
	do by = BYSET;
		put by=;
		solve with NLP / feastol = 1E-7 logfreq = 0 maxiter = 10000;
		for {i in Assets_BY} W_sol[by,i] = W[i].sol;
	end;

	create data Weights_NoShort from [&amp;amp;byvar i] W=W_sol;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I noticed that in a few cases, the NOTE in the log is not "Optimal" but:&lt;/P&gt;&lt;P&gt;&amp;nbsp; - NOTE: Maximum number of iterations reached&lt;/P&gt;&lt;P&gt;&amp;nbsp; - NOTE: Infeasible&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Saving them in a dataset would allow me to quickly check which &lt;EM&gt;by group&lt;/EM&gt; did not solve correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 14:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582436#M2845</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-08-20T14:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc optmodel: saving solution status in a dataset</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582459#M2846</link>
      <description>&lt;P&gt;Yes, you can use the &lt;A href="https://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_details68.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en#ormpug.optmodel.statparams" target="_self"&gt;_solution_status_&lt;/A&gt; parameter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num W_sol {GROUPS_ASSETS};
str solstatus {BYSET};
do by = BYSET;
   put by=;
   solve with NLP / feastol = 1E-7 logfreq = 0 maxiter = 10000;
   for {i in Assets_BY} W_sol[by,i] = W[i].sol;
   solstatus[by] = _solution_status_;
end;

create data Weights_NoShort from [&amp;amp;byvar i] W=W_sol;
create data solstatusdata from [&amp;amp;byvar] solstatus;
&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 15:07:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582459#M2846</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-08-20T15:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc optmodel: saving solution status in a dataset</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582462#M2847</link>
      <description>&lt;P&gt;It's working perfectly, thank you! &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 15:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/proc-optmodel-saving-solution-status-in-a-dataset/m-p/582462#M2847</guid>
      <dc:creator>Alain38</dc:creator>
      <dc:date>2019-08-20T15:18:23Z</dc:date>
    </item>
  </channel>
</rss>

