Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verifisc-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Catala
Verifisc-python
Commits
275a2d8a
Commit
275a2d8a
authored
6 years ago
by
Denis Merigoux
Browse files
Options
Downloads
Patches
Plain Diff
Added relative/absolute diff for new child
parent
9d38a61f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+11
-3
11 additions, 3 deletions
main.py
questions.py
+14
-4
14 additions, 4 deletions
questions.py
with
25 additions
and
7 deletions
main.py
+
11
−
3
View file @
275a2d8a
...
...
@@ -59,10 +59,18 @@ search_marginal_tax = MaxMarginalTaxRateSearch(
avoid_seuil_non_distribution_bourses_college
=
False
,
)
search_new_child
=
MaxGainFromNewChild
(
search_new_child
_relative
=
MaxGainFromNewChild
(
menage_constraints
,
nb_personnes_a_charge_init
=
1
,
age_nouvel_enfant
=
0
relative
=
True
,
nb_personnes_a_charge_init
=
0
,
age_nouvel_enfant
=
None
)
search_new_child_absolute
=
MaxGainFromNewChild
(
menage_constraints
,
relative
=
False
,
nb_personnes_a_charge_init
=
0
,
age_nouvel_enfant
=
None
)
search_different_distribution_revenus
=
MaxGainFromDifferentRevenueDistribution
(
...
...
This diff is collapsed.
Click to expand it.
questions.py
+
14
−
4
View file @
275a2d8a
...
...
@@ -436,10 +436,12 @@ class MaxGainFromNewChild(DichotomicSearch):
def
__init__
(
self
,
menage_constraints
:
MenageConstraints
,
relative
:
bool
,
nb_personnes_a_charge_init
:
Optional
[
int
]
=
None
,
age_nouvel_enfant
:
Optional
[
int
]
=
None
age_nouvel_enfant
:
Optional
[
int
]
=
None
,
):
self
.
menage_constraints_
=
menage_constraints
self
.
relative
=
relative
self
.
nb_personnes_a_charge_init
=
nb_personnes_a_charge_init
self
.
age_nouvel_enfant
=
age_nouvel_enfant
...
...
@@ -520,7 +522,10 @@ class MaxGainFromNewChild(DichotomicSearch):
if
self
.
s1
is
None
:
raise
TypeError
(
"
Error !
"
)
if
current_search_param_value
>=
0
:
deltai_min
=
self
.
s1
%
Taux
.
pourcent
(
current_search_param_value
)
if
self
.
relative
:
deltai_min
=
self
.
s1
%
Taux
.
pourcent
(
current_search_param_value
)
else
:
deltai_min
=
Montant
.
euros
(
current_search_param_value
,
s
)
else
:
raise
TypeError
(
"
Le gain doit être positif !
"
)
return
self
.
deltai
>=
deltai_min
...
...
@@ -541,7 +546,11 @@ class MaxGainFromNewChild(DichotomicSearch):
relative_gain_found
:
float
=
float
(
"
inf
"
)
else
:
relative_gain_found
=
ratio
*
100
return
relative_gain_found
absolute_gain_found
:
float
=
deltai_m_print
.
to_float
()
# type:ignore
if
self
.
relative
:
return
relative_gain_found
else
:
return
absolute_gain_found
def
result_found_lines
(
self
,
s
:
Solver
,
new_search_param_value
:
float
)
->
List
[
Tuple
[
str
,
Any
]]:
if
self
.
deltai
is
None
:
...
...
@@ -549,7 +558,8 @@ class MaxGainFromNewChild(DichotomicSearch):
deltai_m
=
self
.
deltai
//
12
return
[
(
"
Changement mensuel après redistribution
"
,
deltai_m
),
(
"
Gain relatif avec nouvel enfant
"
,
"
{0:.1f}%
"
.
format
(
new_search_param_value
))
((
"
Gain relatif avec nouvel enfant
"
,
"
{0:.1f}%
"
.
format
(
new_search_param_value
))
if
self
.
relative
else
(
"
Gain absolu avec nouvel enfant
"
,
Montant
.
centimes
(
int
(
new_search_param_value
*
100
),
s
)))
]
def
before_request_message
(
self
,
current_search_param_value
:
int
)
->
str
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment