Hi,
I am trying to solve the following question
I have written the following code for this
proc optmodel; var x, y,z; min f = 4*(x^2+y-z)^2 + 10; /* starting point */ x = 1; y = 1; z=1; solve; print x y z x.dual y.dual z.dual; quit;
Now if P is the descent direction of f at Xo then
I need to find the minimizer Aplha for this problem
I mean to say that I am trying to solve this question:
I dont see Alpha in the output.
Please can someone help me find the value of Alpha which is the minimizer
thanks
To find the descent direction from the initial point, you need to fix the values of the variables and then take the negative gradient. To find the best step size alpha in that direction, you can solve an auxiliary one-variable problem. The following code implements these ideas, where I have renamed the original variables x[1], x[2], and x[3].
proc optmodel;
num n = 3;
var x {1..n} init 1;
min f = 4*(x[1]^2+x[2]-x[3])^2 + 10;
fix x;
solve;
print x x.dual;
num p {1..n};
for {j in 1..n} p[j] = -x[j].dual;
var alpha >= 0;
min g = 4*((x[1]+alpha*p[1])^2+(x[2]+alpha*p[2])-(x[3]+alpha*p[3]))^2 + 10;
solve;
print alpha;
quit;
Post it at OR forum . @RobPratt is there .
To find the descent direction from the initial point, you need to fix the values of the variables and then take the negative gradient. To find the best step size alpha in that direction, you can solve an auxiliary one-variable problem. The following code implements these ideas, where I have renamed the original variables x[1], x[2], and x[3].
proc optmodel;
num n = 3;
var x {1..n} init 1;
min f = 4*(x[1]^2+x[2]-x[3])^2 + 10;
fix x;
solve;
print x x.dual;
num p {1..n};
for {j in 1..n} p[j] = -x[j].dual;
var alpha >= 0;
min g = 4*((x[1]+alpha*p[1])^2+(x[2]+alpha*p[2])-(x[3]+alpha*p[3]))^2 + 10;
solve;
print alpha;
quit;
thank you so much for your answer . @RobPratt
Just one more question.I am trying to re write your program for the following problem.
min f = (x[1]-2)**4 + (x[1]-2*x[2])**2;
Sorry I am new to sas .Please can you help me write the same code as that in your answer for this new problem to calculate alpha.I tried but each time I tried I got alpah=0 and a an error message also
Thanks
Here's how I would do it:
proc optmodel;
num n = 2;
var x {1..n};
min f = (x[1]-2)**4 + (x[1]-2*x[2])**2;
fix x[1] = 0;
fix x[2] = 3;
solve;
print x x.dual;
num p {1..n};
for {j in 1..n} p[j] = -x[j].dual;
var alpha >= 0;
min g = (x[1]+alpha*p[1]-2)**4 + (x[1]+alpha*p[1]-2*(x[2]+alpha*p[2]))**2;
solve;
print alpha;
quit;
thank you so much
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 use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.