```Date: Wed, 14 Apr 2010 22:56:11 -0400 Reply-To: Sigurd Hermansen Sender: "SAS(r) Discussion" From: Sigurd Hermansen Subject: Re: PROC OPTMODEL in SAS 9.1.3 Comments: To: Ban Cheah In-Reply-To: <201004121545.o3CFetoo022076@malibu.cc.uga.edu> Content-Type: text/plain; charset="us-ascii" The omission of "number rate = 0.08;" in the second specification of the problem likely has more of an impact than the small change in add_amt. The first specification of the problem likely leads to an empty solution set. The second specification may solve for the minimum interest rate given the other parameter values. S -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Ban Cheah Sent: Monday, April 12, 2010 11:46 AM To: SAS-L@LISTSERV.UGA.EDU Subject: PROC OPTMODEL in SAS 9.1.3 The problem is the following: I plan to retire in year 5 and expect to live 8 years. For each of those 8 years, I plan to spend 30,000 per year. How much must I put into my savings account from years 0 to 4 if my return from saving is 8 percent? The code is as follows: proc optmodel; number rate = 0.08; number life = 13; number year; number cf{1..life} init -30000; var add_amt init 30000; do year = 0 to 4; cf[year+1]=add_amt; end; min z = sum {i in 0..12} (cf[i+1]/((1+rate)**(i))); con add_amt>=0, z=0; solve ; print add_amt; quit; OPTMODEL is unable to solve this problem - the note in the log is: The constraint '_ACON_[2]' is empty and infeasible. Constraint _ACON_[2] causes the problem to be infeasible. The solution (using Excel's Solver) is add_amt = 29386.55 If I rephrase the problem as the following: If I save 29,386.55 per year, what must my return be? The code is as follows: proc optmodel; number life = 13; number year; number cf{1..life} init -30000; number add_amt init 29386.55; var rate; do year = 0 to 4; cf[year+1]=add_amt; end; min z = sum {i in 0..12} (cf[i+1]/((1+rate)**(i))); con add_amt>=0, z=0; solve ; print rate; quit; OPTMODEL returns the correct answer as 0.08. I'm running OPTMODEL in 9.1.3 SP4 which is experimental. Perhaps this is the problem? Or is the first code incorrectly specified? Thanks. ```

Back to: Top of message | Previous page | Main SAS-L page