BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rohailk
Obsidian | Level 7

hi,

I am trying to solve the following problem

 

Capture.JPG

The initial point is =(0 0 0)

My code is the following

proc optmodel;
var x{1..3};
min f = x[1]^2  + 2*x[2]^2 + 5*x[3]^2 - 4*x[1] - 20*x[2] - 20*x[3] ;

/* starting point */
   x[1]= 0;
   x[2]= 0;
   x[3]=0;
solve; 
print x[1] x[2] x[3] x[1].dual x[2].dual x[3].dual;
quit;

is this code right or am I making any mistake?

Please help

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

That is correct.  You can also do:

print x x.dual;

View solution in original post

2 REPLIES 2
Ksharp
Super User

I think you can do this.

 

proc optmodel;
var x{1..3} init 0;
min f = x[1]^2  + 2*x[2]^2 + 5*x[3]^2 - 4*x[1] - 20*x[2] - 20*x[3] ;

solve; 
print x[1] x[2] x[3] x[1].dual x[2].dual x[3].dual;
quit;
RobPratt
SAS Super FREQ

That is correct.  You can also do:

print x x.dual;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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