<?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: Sub-Problems - Using Problem/Use Problem in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936096#M4200</link>
    <description>&lt;P&gt;Thanks Rob.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had just noticed that. I thought I had used a problem in the include as well, but I had not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case I really want to use those same 4 constraints, but in two different paths. Was really hoping to avoid getting to some really long include lists&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jul 2024 20:51:52 GMT</pubDate>
    <dc:creator>DanHouston</dc:creator>
    <dc:date>2024-07-17T20:51:52Z</dc:date>
    <item>
      <title>Sub-Problems - Using Problem/Use Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936043#M4198</link>
      <description>&lt;P&gt;I have an optmodel run that really considers a larger number of different experiements and solves them using PROBLEM. To do that I have combinations of constraints that are setup as a problem like this:&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	use problem A;
		solve with milp / distributed=true relobjgap=&amp;amp;relobjgap. maxtime=&amp;amp;maxruntime.;
		create data ("fac_output_a") from [i j k]={&amp;lt;i,j,k&amp;gt; in ARCS: Assign[i,j,k].sol &amp;gt; 0.5} distance[i,j] Assign pct_sdu[j] n_AFCS200[i] n_CIOSS[i] n_LCREM2[i] n_AFSM100[i] n_DBCS[i] n_DIOSS[i] n_TrayInductions[i] PackageSqFt[i,j,k] building_sq_feet[i];

	use problem B;
		solve with milp / distributed=true relobjgap=&amp;amp;relobjgap. maxtime=&amp;amp;maxruntime.;
		create data ("fac_output_b") from [i j k]={&amp;lt;i,j,k&amp;gt; in ARCS: Assign[i,j,k].sol &amp;gt; 0.5} distance[i,j] Assign pct_sdu[j] n_AFCS200[i] n_CIOSS[i] n_LCREM2[i] n_AFSM100[i] n_DBCS[i] n_DIOSS[i] n_TrayInductions[i] PackageSqFt[i,j,k] building_sq_feet[i];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Then just before I get to my solve statements I setup the final problems I want to solve like this:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp;   problem A from base include total_packages force_model_det;
    problem B from base include force_plant force_zip3_atl state_con total_packages force_model_det;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;and then solve them like this:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	use problem A;
		solve with milp / distributed=true relobjgap=&amp;amp;relobjgap. maxtime=&amp;amp;maxruntime.;
		create data ("fac_output_a") from [i j k]={&amp;lt;i,j,k&amp;gt; in ARCS: Assign[i,j,k].sol &amp;gt; 0.5} distance[i,j] Assign pct_sdu[j] n_AFCS200[i] n_CIOSS[i] n_LCREM2[i] n_AFSM100[i] n_DBCS[i] n_DIOSS[i] n_TrayInductions[i] PackageSqFt[i,j,k] building_sq_feet[i];

	use problem B;
		solve with milp / distributed=true relobjgap=&amp;amp;relobjgap. maxtime=&amp;amp;maxruntime.;
		create data ("fac_output_b") from [i j k]={&amp;lt;i,j,k&amp;gt; in ARCS: Assign[i,j,k].sol &amp;gt; 0.5} distance[i,j] Assign pct_sdu[j] n_AFCS200[i] n_CIOSS[i] n_LCREM2[i] n_AFSM100[i] n_DBCS[i] n_DIOSS[i] n_TrayInductions[i] PackageSqFt[i,j,k] building_sq_feet[i];
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a new experiment to add that I need to break out some of the constraints, so I added:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	problem tx_zip3;
	use problem tx_zip3;
	
		con force_zip3_dallas_exe {i in PLANT, k in ZIP3:&amp;lt;i,k&amp;gt; in ARCS2 and  i='1435750'}:
			Assign2[i,k] = (if k in {'710','711','717','718','750','751','752','753','754','755','756','757','758','759','760','761','762','763','764','766','767','768','769','795','796'} then 1 else 0);
		con force_zip3_amarillo_exe {i in PLANT, k in ZIP3:&amp;lt;i,k&amp;gt; in ARCS2 and i='1441177'}:
			Assign2[i,k] = (if k in {'678','679','739','790','791','792','793','794','797','881','882','884'} then 1 else 0);
		con force_zip3_nhouston_exe {i in PLANT, k in ZIP3:&amp;lt;i,k&amp;gt; in ARCS2 and i='1441192'}:
			Assign2[i,k] = (if k in {'770','772','773','774','775','776','777','778'} then 1 else 0);
		con force_zip3_sanantonio_exe {i in PLANT, k in ZIP3:&amp;lt;i,k&amp;gt; in ARCS2 and  i='1441198'}:
			Assign2[i,k] = (if k in {'765','779','780','781','782','783','784','785','786','787','788','789'} then 1 else 0);
&lt;/CODE&gt;&lt;/PRE&gt;
But then when I try to use that problem like I have in the examples above I get an error message that tx_zip3 does not contain a variable, objective or constraint:
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;376   problem sol_m_tx from final_zip3_assign include tx_zip3;
                                                              -
                                                              787
ERROR 787-782: The name 'tx_zip3' does not specify an objective, variable, or constraint.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 13:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936043#M4198</guid>
      <dc:creator>DanHouston</dc:creator>
      <dc:date>2024-07-17T13:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Problems - Using Problem/Use Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936080#M4199</link>
      <description>&lt;P&gt;Hi Dan,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The part after INCLUDE should be a list of variables, objectives, and constraints rather than a problem name.&amp;nbsp; I recommend the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;problem sol_m_tx from final_zip3_assign include force_zip3_dallas_exe force_zip3_amarillo_exe force_zip3_nhouston_exe force_zip3_sanantonio_exe;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please let me know if that doesn't resolve your issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 19:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936080#M4199</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2024-07-17T19:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Problems - Using Problem/Use Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936096#M4200</link>
      <description>&lt;P&gt;Thanks Rob.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had just noticed that. I thought I had used a problem in the include as well, but I had not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case I really want to use those same 4 constraints, but in two different paths. Was really hoping to avoid getting to some really long include lists&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 20:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936096#M4200</guid>
      <dc:creator>DanHouston</dc:creator>
      <dc:date>2024-07-17T20:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Problems - Using Problem/Use Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936099#M4201</link>
      <description>&lt;P&gt;Here's a more compact declaration that should help you reduce the include lists:&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      set FORCED_PLANTS = {'1435750', '1441177', '1441192', '1441198'};
      set KSET_i {FORCED_PLANTS};
      KSET_i {'1435750'} = {'710','711','717','718','750','751','752','753','754','755','756','757','758','759','760','761','762','763','764','766','767','768','769','795','796'};
      KSET_i {'1441177'} = {'678','679','739','790','791','792','793','794','797','881','882','884'};
      KSET_i {'1441192'} = {'770','772','773','774','775','776','777','778'};
      KSET_i {'1441198'} = {'765','779','780','781','782','783','784','785','786','787','788','789'};
      con force_zip3_exe {i in FORCED_PLANTS, k in ZIP3:&amp;lt;i,k&amp;gt; in ARCS2}:
         Assign2[i,k] = (if k in KSET_i[i] then 1 else 0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you can include force_zip3_exe instead of including four separate constraint families.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 21:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936099#M4201</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2024-07-17T21:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Problems - Using Problem/Use Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936100#M4202</link>
      <description>&lt;P&gt;HAHA. Now I have to go back and be smarter in lots of places!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As always, thanks Rob!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 21:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936100#M4202</guid>
      <dc:creator>DanHouston</dc:creator>
      <dc:date>2024-07-17T21:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Problems - Using Problem/Use Problem</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936101#M4203</link>
      <description>&lt;P&gt;Always glad to help!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 21:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Sub-Problems-Using-Problem-Use-Problem/m-p/936101#M4203</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2024-07-17T21:54:21Z</dc:date>
    </item>
  </channel>
</rss>

