イフコンピュータ > IF/Prolog > 制約処理パッケージ > 例題プログラム > 投資計画

投資計画

IF/Prolog by Siemens
MINERVA superseeded IF/Prolog. Please see http://www.ifcomputer.co.jp/MINERVA for details.

We discontinued to sell IF/Prolog Dec 31. 2003. For current customers, we continue to provide professional support for IF/Prolog until Dec 31, 2008.

The treasurer has forecast the cash needs for the next 5 years. He has cash requirements of 10000 at the beginning of each of the first 2 years and 20000 at the beginning of the remaining 3 years.

The treasurer is considering the following investments: - intermediate bonds have a return, after 2 years, of 1.47 for each 1.00 invested. - long-term bonds have a return, after 3 years, of 1.78 for each 1.00 invested. - short-term bonds have a return, after 1 year, of 1.20 for each 1.00 invested.

1. Supposing the corporation currently has 100000 available cash, the treasurer wishes to maximize the amount of cash at the end of the planning period, at which time no investment will be outstanding.

   ?- cash(100000, Out), linear_maximize(Out, Max).

Max = 0r18297283/147 = 124471

2. Using the same model, determine the minimal start capital necessary to meet the cash requirements.

   ?- cash(In, _), linear_minimize(In, Min).

Min = 0r100833685000/1923201 = 52430

3. Using the same model, determine the minimal start capital the company must have in order to have at the end of the planning period the same amount of cash (while meeting the cash requirements during the 5 years).

   ?- cash(In, In), linear_minimize(In, Min).

Min = 0r100833685000/1188201 = 84862

:- module(cash). :- export([cash/3]). :- begin_module(cash). :- import(const_linear).

cash(In, Out1) :- V = [ In, C1, C2, C3, C4, Out, Profit1, Profit2, Profit3, Profit4, Profit5, I1, I2, I3, I4, I5, I11, I12, I13, I21, I22, I23, I31, I32, I33, I41, I42, I51 ], all_positive(V), C1 + 10000 + I1 $= In + Profit1, C2 + 10000 + I2 $= C1 + Profit2, C3 + 20000 + I3 $= C2 + Profit3, C4 + 20000 + I4 $= C3 + Profit4, Out + 20000 + I5 $= C4 + Profit5,

I1 $= I11 + I12 + I13, I1 + 10000 $=< In, Profit1 $= I11 * 0r120/100,

I2 $= I21 + I22 + I23, I2 + 10000 $=< C1, Profit2 $= I21 * 0r120/100 + I12 * 0r147/100,

I3 $= I31 + I32 + I33, I3 + 20000 $=< C2, Profit3 $= I31 * 0r120/100 + I22 * 0r147/100 + I13 * 0r178/100,

I4 $= I41 + I42, I4 + 20000 $=< C3, Profit4 $= I41 * 0r120/100 + I32 * 0r147/100 + I23 * 0r178/100,

I5 $= I51, I5 + 20000 $=< C4, Profit5 $= I51 * 0r120/100 + I42 * 0r147/100 + I33 * 0r178/100, linear_maximize(Out,Out1), write(V).

document: http://www.ifcomputer.co.jp/IFProlog/Constraints/ExamplePrograms/PortfolioManagement/print_jp.html
published 2008/9/1 update 1996/12/12 (c) 1996-2006 IF Computer Japan
IF Computer 〒113-0022 Tel 03-5814-3352 start (AT) ifcomputer.com
Customer Support 東京都文京区千駄木5-28-2   http://www.ifcomputer.co.jp
戻る> managed with ubiCMS