BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
DanHouston
Obsidian | Level 7

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:

	use problem A;
		solve with milp / distributed=true relobjgap=&relobjgap. maxtime=&maxruntime.;
		create data ("fac_output_a") from [i j k]={<i,j,k> in ARCS: Assign[i,j,k].sol > 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=&relobjgap. maxtime=&maxruntime.;
		create data ("fac_output_b") from [i j k]={<i,j,k> in ARCS: Assign[i,j,k].sol > 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];
 
Then just before I get to my solve statements I setup the final problems I want to solve like this:
    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;
 
and then solve them like this:
	use problem A;
		solve with milp / distributed=true relobjgap=&relobjgap. maxtime=&maxruntime.;
		create data ("fac_output_a") from [i j k]={<i,j,k> in ARCS: Assign[i,j,k].sol > 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=&relobjgap. maxtime=&maxruntime.;
		create data ("fac_output_b") from [i j k]={<i,j,k> in ARCS: Assign[i,j,k].sol > 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];

 

I have a new experiment to add that I need to break out some of the constraints, so I added:

 

	problem tx_zip3;
	use problem tx_zip3;
	
		con force_zip3_dallas_exe {i in PLANT, k in ZIP3:<i,k> 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:<i,k> 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:<i,k> 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:<i,k> 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);
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:

 

 

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

Hi Dan,

 

The part after INCLUDE should be a list of variables, objectives, and constraints rather than a problem name.  I recommend the following:

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;

Please let me know if that doesn't resolve your issue.

 

Thanks,

Rob

View solution in original post

5 REPLIES 5
RobPratt
SAS Super FREQ

Hi Dan,

 

The part after INCLUDE should be a list of variables, objectives, and constraints rather than a problem name.  I recommend the following:

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;

Please let me know if that doesn't resolve your issue.

 

Thanks,

Rob

DanHouston
Obsidian | Level 7

Thanks Rob.

 

I had just noticed that. I thought I had used a problem in the include as well, but I had not.

 

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

 

 

RobPratt
SAS Super FREQ

Here's a more compact declaration that should help you reduce the include lists:

      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:<i,k> in ARCS2}:
         Assign2[i,k] = (if k in KSET_i[i] then 1 else 0);

Now you can include force_zip3_exe instead of including four separate constraint families.

DanHouston
Obsidian | Level 7

HAHA. Now I have to go back and be smarter in lots of places!

 

As always, thanks Rob!

RobPratt
SAS Super FREQ

Always glad to help!