use exponentials in CPSAT constraints to calculate loan installment

47 Views Asked by At

Dears I have the following problem. My decision variables are loan amount and duration:

adjusted_amount = model.NewIntVar(1, 100, "adjusted_amount")
adjusted_duration = model.NewIntVar(1, 100, "adjusted_duration")

I need to add this constraint where on the left side I'm calculating the loan installment as function of the loan duration and the loan amount :

model.Add(int((0.00049 / 12) * (1 / (1 - (1 + 0.00049 / 12) ** (-adjusted_duration))) * adjusted_amount*scaling_factor) <= int(Salary* 0.5 *scaling_factor)) 

but I get this error:

TypeError: unsupported operand type(s) for ** or pow(): 'float' and '_ProductCst'

Is there any workaroung? Thanks

1

There are 1 best solutions below

2
On

most likely no. We can implement sqrt because we have product. But I do not see how to implement exponantial.