Hello! I am using SAS Enterprise Guide. I wanted to use the Primalin option in the MILP solver to use the decision variable values from my previous run. How can I save the decision variable values so that I can use them in the next run for a warm start? And how do I use the Primalin option to specify this warm start? Thank you so much in advance. I am attaching an example decision variable here. How can I store the value of these two variables in a SAS datatset and use them in the next run?
proc optmodel;
var Assign{i,j} binary;
var Amount {i,j} >= 0;
max supply = sum{i,j} Amount[i,j];
con Test: sum{i,j] Assign[i,j]=4;
solve obj supply with MILP;
run;
No need to apologize for asking questions. That's what this community is for. To clarify, I mean the following, where ... indicates omitted statements:
proc optmodel;
...
solve;
...
solve with milp / primalin;
...
quit;
See this documentation example for illustration.
To use the PRIMALIN option, just include the keyword in the SOLVE statement:
solve obj supply with MILP / primalin;
The solver uses the current values of the decision variables as a warm start.
You can execute the SOLVE statement multiple times from the same PROC OPTMODEL session, so there is no need to save the values to a data set and read them back in just for the purpose of using PRIMALIN. However, if you want to do that, you can use the CREATE DATA and READ DATA statements.
You have a few syntax errors in your code, so it will not run as is. Please see this documentation example that shows how to solve a similar problem.
Note also that PROC OPTMODEL is interactive and uses a QUIT statement instead of RUN.
Thank you so much for your help! So sorry for the errors. My original code was so big, just wrote a demo one to explain myself. And yes, I have included this primalin statement in the options after MILP. So if I run my code, once it finishes running and show me all the results and then if I start running the code again with primalin, it will start using those previous values of my decision variables as a warm start? Sorry that I got confused from the documentation where it was mentioned that by default primalin uses zero values for the decision variables.
I suspect that you are referring to this sentence in the VAR statement documentation:
INIT expression
sets an initial value for the variable. The expression is used only the first time the value is required. If no initial value is specified, then 0 is used by default.
These initial values (or 0) are replaced by the output of the first SOLVE. So the next SOLVE uses the output from the first SOLVE, as long as you are in the same PROC OPTMODEL session. Once you execute QUIT, all values are forgotten.
Sorry for all my questions! Are you referring to something different when you said executing the solve statement multiple times within the same optmodel session?
No need to apologize for asking questions. That's what this community is for. To clarify, I mean the following, where ... indicates omitted statements:
proc optmodel;
...
solve;
...
solve with milp / primalin;
...
quit;
See this documentation example for illustration.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.