10-31-2012 08:48 AM
I have an optimization problem where I want to minimize a numerical integration subject to certain constraints. Suppose that the objective function (the integration of "FUN") and the constraint are both computed using loops. I have one decesion variable "T" and one integration variable "M". I already wrote a part of the code(the part i wrote just performs the numerical integration )I really need to complete the code . What I need to complete is to minimize the integration of "FUN". The decesion variable is "T" . The constraint I have is computed in the same way of "FUN" , but with M=0 & "FUN"is restricted to the value "10". In otherwords, I want to minimize the integration of "FUN" where the integration variable is M, subject to the constraint that "FUN"=10 at M=0 and the decesion variable in this optimization is "T".
The code I was able to write(integrating "FUN") is:
do until (x<T);
10-31-2012 04:50 PM
There's a quite similar posting about this on comp.soft-sys.sas which I believe is from you as well.
I've responded in the newsgroup but will respond here also in the interest of getting the information
to as many interested parties as possible.
Thanks for posting this question. The best way to do this currently
is to use PROC NLP along with PROC FCMP (a Base SAS procedure) to
define the objective function. I consulted with one of our developers
on this question and he sent some sample code which uses this approach
for a problem that's pretty similar to yours. It's included at the
end of this email.
PROC OPTMODEL in SAS/OR is the successor to PROC NLP (it handles
not only nonlinear but also linear, mixed integer, and quadratic optimization).
However OPTMODEL is not yet FCMP-enabled and so it's best, given your
requirements, for you to stick with PROC NLP for now.
If you have any questions please feel free to contact me.
SAS/OR Product Manager
Sample code follows:
input y @@;
0.14 0.18 0.22 0.25 0.29 0.32 0.35 0.39
0.37 0.58 0.73 0.96 1.34 2.10 4.39
proc fcmp outlib=work.myfuncs.test;
function bard(x1, x2, x3);
array y /nosymbols ;
rc = read_array('barddata', y);
fx = 0;
do k = 1 to 15;
vk = 16 - k;
wk = min(k,vk);
fxk = y
fx = fx + fxk**2;
options cmplib = work.myfuncs;
parms x1 x2 x3 = 1.0;
bounds 0 <= x1 <= 10,
0 <= x2 <= 10,
0 <= x3 <= 10;
bardfn = bard(x1,x2,x3);