Linear model for minimizing payback period

52 views
Skip to first unread message

Georges Meouchy

unread,
Nov 3, 2014, 3:41:35 PM11/3/14
to am...@googlegroups.com
Hi,

I am trying to write a linear model for the minimization of the payback period of an investment. The payback period is usually defined as A + (B/C), where A is the last period with a negative cumulative cash flow; B is the absolute value of cumulative cash flow at the end of the period A and C is the total cash flow during the period after A. For a more general case (e.g. where the cumulative cash flow crosses the x-axis more than once) the model for minimizing the payback period can be written as

min sum {y in 1..max_number_of_years} CCFI [y]

where

CCFI [y] = if CCF[y] <= 0 then 1
                  else
                             if CCF[y-1] <= 0 then -CCF[y-1]/CF[y]
                             else 0

CCF [y]  = - Investment_cost + sum{i in 1..y} CF[i];

CF[y] and Investment_cost are linear functions of several decision variables of the optimization model.

Is there a way to write such a model, or any other equivalent payback model, linearly?

Thanks!
Georges

Robert Fourer

unread,
Nov 4, 2014, 10:43:45 PM11/4/14
to am...@googlegroups.com
This does not look like anything that is well known to have a linear model equivalent. Perhaps there are some papers on this sort of thing that you can track down with an internet search, but you may have to settle for some approach that uses a simpler model or series of models.

Bob Fourer
am...@googlegroups.com

=======

Georges Meouchy

unread,
Nov 5, 2014, 7:36:14 PM11/5/14
to am...@googlegroups.com
Thank you for your answer.

I am therefore trying to maximize a different variable for the objective function, and to compute the payback in the command script, as following, 
param payback_period := 0;
for {y in PROJECT_LIFETIME} {
          let payback_period := payback_period 
                                                 + (if ((-Nb*cost_per_project + sum{i in 1..y} cash_flow[i]) <= 0) then 1) 
                                                 + (if (((-Nb*cost_per_project + sum{i in 1..y} cash_flow[i]) > 0) and ((-Nb*cost_per_project + sum{i in 1..y-1} cash_flow[i]) <= 0)) then -(-Nb*cost_per_project + sum{i in 1..y-1} cash_flow[i])/cash_flow[y]);
                                             };

which gives the following error
Error at _cmdno 20 executing "let" command
(file primus1_year.run, line 57, offset 2492):

payback_period has an = assignment in the model.


Could you please help me and tell me where it is seeing an  = assignment? I changed the name of the parameter, and it doesnt change the error (to be sure that the error doesnt come from a parameter with the same name in the model).

Thanks
Georges

victor.z...@gmail.com

unread,
Nov 6, 2014, 10:31:55 AM11/6/14
to am...@googlegroups.com
The payback_period is assigned the value in the declaration:

  param payback_period := 0;

To fix it either remove ":= 0" from the declaration or change it to "default 0":

  param payback_period default 0;

See Section 7.5 Computed parameters of the AMPL book for more details.

HTH,
Victor




--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at http://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

Georges Meouchy

unread,
Nov 10, 2014, 1:08:11 PM11/10/14
to am...@googlegroups.com
Thanks!
Georges

On Monday, November 3, 2014 12:41:35 PM UTC-8, Georges Meouchy wrote:
Reply all
Reply to author
Forward
0 new messages