我主要是用了IML 里面的CALL NLPCG这个子程序,
结果也出来了,但是似乎不能存到数据集中,
请各位帮助谢谢!
data IR;
input a;
cards;
0.5
0.4
0.6
0.5
0.2
;run;
data SR;
input a;
cards;
0.1
0.6
0.9
0.2
0.2
;run;
data cons;
input x1 x2 x3 x4 x5 a b;
cards;
0. 0. 0. 0. 0. . .
10. 30. 10. 30. 10. . .
0. 1. -1. 0. -1. 0. 0.
1. 0. 1. -1. 0. 0. 0.
1. 1. 0. -1. -1. 0. 0.
;
run;
proc iml;
title ’Maximum Flow Through a Network’;
start MAXFLOW(w);
use IR;
read var{a} all into IR;
use SR;
read var{a} all into SR;
wt = t(w);
TE = wt#SR-IR;
Obj = ssq(TE);
return(Obj);
finish MAXFLOW;
use cons;
read var _ALL_ all into con;
w = j(1,5, 1.);
optn = {0 3 . 1};
call nlpcg(xres,rc,"MAXFLOW",w,optn,con);
quit;