Skip to main content

Hello! I winder how to find the cost price when the net present value (NPV) is Zero, and how to use the function “InvestmentVariablePresentValue” when involving variable and objective function. Thank you!

The cost price in scenarios where the Net Present Value (NPV) equals zero can be determined by finding the value of the initial investment that results in the total discounted cash flows equating to zero. This means solving for the initial investment where the sum of the discounted future cash flows, calculated using the NPV formula, equates to the initial cash outflow.

The "InvestmentVariablePresentValue" function in the AIMMS platform can be used for dynamic financial modeling or optimization problems. This functionality allows users to compute the net present value of a series of periodic payments (p_i) with a consistent interest rate (r) and utilize the calculated NPV within objective functions or constraints. Both input parameters, such as Value and InterestRate, can be defined as variables and dynamically adjusted during optimization.

For example, to compute the net present value of cash flows, you could define time periods, periodic payments as a parameter, and the NPV as:

 

Set _s_years {
SubsetOf: Integers;
Index: _i_year;
}
Parameter _p_value {
IndexDomain: _i_year;
}
Parameter _p_npv;

_s_years := ElementRange(2005,2008);
_p_value(_i_year) := ord(_i_year) * 100 + 50;
_p_npv := InvestmentVariablePresentValue(_p_value, 0.07);
block where single_column_display := 1, listing_number_precision := 6;
display _p_npv;
endblock;

In this example, _p_npv will hold the NPV, which can then be used in constraints or as part of a maximization or minimization objective in your model. It is similar to the Excel NPV function but allows for greater flexibility, particularly when used in optimization scenarios with variable inputs.


Thank you for your reply, but I still have two more questions.

1.  When I set the objective function as NPV = InvestmentVariablePresentValue(Annual_Net_Profit(t), Internal_Rate_of_Return) for solving, an error "Derivative evaluation error in NPV_definition (see solve at line 1 in user-defined function section "Solve_pro"). Domain error for InvestmentVariablePresentValue: At least one of the Values should be nonzero." is prompted. Does this error indicate that Annual_Net_Profit(t) must be a pre-assigned parameter rather than a variable? If I want to set Annual_Net_Profit(t) as a variable for automatic optimization, how should I handle it?

2. How should the objective function be set? Since constraints cannot be imposed on the objective function, how can we realize that the initial investment equals the present value of future cash flows through maximization or minimization optimization?

For your convenience, I have attached my case in the appendix and look forward to your reply.


@Jingfan Liu

I donwloaded your project and the problem is how you defined Annual_Net_Profit, because, no matter the value of Unit_Power_Cost, all values in Annual_Net_Profit will be positive. Causing the error. 

You can set your model as:

Constraint 1:

_v_npv = _initial_investment - InvestmentVariablePresentValue(_v_value(t), _interest_rate)

Constraint 2:

_v_npv = 0

 

Use _v_npv as Objective in your Mathematical Program. Where _v_value(t) needs to be either a free variable or defined letting the model to decide at least one negative value.

See more here:


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator