<commit_before>### NPV MODEL ###

from gpkit import Model, Variables, units
import gpkit
import numpy as np

class NPV(Model):
    def setup(self):

        NPV = Variable('NPV', 'USD', 'net present value')
        C = Variable('C', 'USD', 'cash flow')
        C_r = Variable('C_r', 4e6, 'USD/year', 'cash flow rate')
        r = Variable('r', 0.02 '1/year', 'interest rate')

<commit_msg>maximized npv, not working<commit_after>### NPV MODEL ###

from gpkit import Model, Variable, units, VectorVariable
import gpkit
import numpy as np

class NPV(Model):
    def setup(self):

        N = 3 # number of payments
        NPV = Variable('NPV', 'USD', 'net present value')
        PV = Variable('PV', 'USD', 'present value')
        C = VectorVariable(N, 'C', 'USD', 'cash flow')
        C_r = Variable('C_r', 4e6, 'USD', 'cash flow rate')
        r = Variable('r', 0.02, '-', 'interest rate')
        t = VectorVariable(N, 't', '-', 'time')
       
        constraints = [3*PV >= NPV, 
                       C >= PV*(1 + r*t + r*t**2/2 ),
                       t >= t.left + C/C_r]

        cost = 1/NPV

        return cost, constraints

    def test(self):
        seft.solve()

if __name__ == "__main__":
    M = NPV()
    sol = M.solve()
{'fraction_non_alphanumeric': 0.16505636070853463, 'fraction_numerical': 0.013687600644122383, 'mean_word_length': 2.3146666666666667, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3332643', 'n_tokens_mistral': 469, 'n_tokens_neox': 417, 'n_words': 129}