BookmarkSubscribeRSS Feed
DocMartin
Quartz | Level 8

This is actually two questions in one. I'm maximizing a function in PROC OPTLSO that came from PROC FMCP. I've run this code before on a different dataset with good results.

Question #1: Here is my code with the warnings issued by SAS.

 options cmplib = rd.myfuncs;
197
198
199  proc fcmp outlib = rd.myfuncs.ga10;
WARNING: Function 'objfunRA' was defined in a previous package. 'objfunRA' in current package
         GA5 will be used as default when the package name is not specified.
WARNING: Function 'objfunRA' was defined in a previous package. 'objfunRA' in current package
         GA10 will be used as default when the package name is not specified.
200     function objfunRA10(%listvars(&numVars.), icudead, %listIndex(hindex),
200! %listIndex(rindex), %listIndex(mindex),
WARNING: Function 'objfunRA10' was defined in a previous package. Function 'objfunRA10' as
         defined in the current program will be used as default when the package is not
         specified.
201                         %listIndex(sindex), %listIndex(vindex), %listIndex(mv), maxPeriod10)
201! ;
202        array x[175] x1-x175;
203        array hindex[336] hindex1-hindex336;
204        array rindex[336] rindex1-rindex336;
205        array mindex[336] mindex1-mindex336;
206        array sindex[336] sindex1-sindex336;
207        array vindex[336] vindex1-vindex336;
208        array mvwt[336] mv1-mv336;
209        array num_wts[336] num_wts1-num_wts336;
210
211   etc,......
212     endsub;
run;

I hope the function being used is objfunRA10. Why the warning messages?

 

Question #2: When I run PROC OPTLSO, nothing occurs. See the code below:

263  proc optlso
WARNING: Function 'objfunRA' was defined in a previous package. 'objfunRA' in current package
         GA30 will be used as default when the package name is not specified.
WARNING: Function 'objfunRA' was defined in a previous package. 'objfunRA' in current package
         GA5 will be used as default when the package name is not specified.
264     seed = 1208
265     primalout = finalsol
266     variables = vardata
267     objective = objdata
268     nglobal = 2
269     popsize = 200
270     maxtime = 900
271     logfreq = 1
272     absfconv = 0.001;
273  run;

NOTE: The OPTLSO procedure is executing in single-machine mode.
NOTE: There were 175 observations read from the data set WORK.VARDATA.
NOTE: There were 1 observations read from the data set WORK.OBJDATA.
NOTE: There were 1425 observations read from the data set WORK.MAIN3.
NOTE: The data set WORK.FINALSOL has 0 observations and 0 variables.
NOTE: PROCEDURE OPTLSO used (Total process time):
      real time           3.99 seconds
      cpu time            2.68 seconds

There's no error messages, just that the solution is NULL. Any ideas why this could occur?

 

Thanks!

 

Andrew

3 REPLIES 3
StevenGardner
SAS Employee

Hello Andrew,

 

As for your first question, the FCMP warning messages definitely seem suspicious. I'm not a FCMP expert but it seems as if there are many different instances of the 'objfunRA' function in multiple packages (GA5, GA10, GA30). Also, the fact that they code is warning you about the 'objfunRA' function makes me worried that it's actually looking for that function and not the 'objfunRA10' function that you state is your desired choice. In the 'objdata' data set, are you specifying 'objfunRA' or 'objfunRA10' as your objective function? Obviously, if you could share all the code it would be much easier to see the full picture of what's happening.

 

And as far as your second question goes, it is definitely strange that you are seeing no output from OPTLSO. I wonder if the confusion about which FCMP objective function to use is preventing OPTLSO from doing any optimization. If we can resolve the FCMP function warnings, I suspect that the OPTLSO behavior might change.

 

And while I have your attention, I'd like to point out that you can also access the same derivative-free (blackbox) solver from PROC OPTMODEL by using the 'solve with blackbox' solver option. PROC OPTMODEL provides an easier-to-use and more intuitive interface for defining your optimization problem. You can learn more about OPTMODEL here: 

 

https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=casmopt&docsetTarget=c...

 

Thanks!

 

--Steve 

DocMartin
Quartz | Level 8

In the objdata data set I'm referring to objRA10.

data objdata;
   input _id_ $  _function_ $  _sense_ $ _dataset_ :$5.;
   datalines;
   f objfunRA10 max main3
   ;
run;

The reason there are so many objfunRA variants is because initially I was looking at 5 minute data (physiology). I copied the program and changed "5" to "10" to look at 10 minute data. The functions all reside within the rd.myfuncs library.

options cmplib = rd.myfuncs;  

I could supply more code, but it's been tested and seems to be working.

One other thought: I'm trying to optimize 165 features over 336 10-minute periods using data from 1,400 patients. That might be problematic, but I would think that at least one iteration would have been attempted by OPTLSO.

 

Boy, do I miss PROC GA!

 

Thanks!

 

Andrew

P.S. I will check out OPTMODEL at some point.
 

StevenGardner
SAS Employee

Unfortunately, there's only so much help we can provide without being able to see (and execute) your code. If you're worried about sharing the code in this public forum, there are ways through SAS Technical Support where the code can be shared in a more private way that would allow us to provide more support.

 

In any case, I'm wondering if you've tried executing your objfunRA10 FCMP function outside of PROC OPTLSO. If you're not aware, you can execute any FCMP function with a simple data step. You just need to provide values for the function's arguments and then call the function. This would allow us to know if the function you have specified as the objective for PROC OPTLSO is actually working as intended. You can see an example of how to execute a FCMP function from data step here: 

 

https://go.documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.5&docsetId=proc&docsetTarget=n05u...

 

--Steve

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 3 replies
  • 515 views
  • 0 likes
  • 2 in conversation