Skip to content

Commit

Permalink
Ready to run
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-tfn committed Dec 6, 2023
1 parent 9a0d422 commit e98f260
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/caf/distribute/gravity_model/multi_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,7 @@ def _jacobian_function(
)
# Allows iteration of cost_distributions within a loop of cost_distributions
inner_dists = cost_distributions.copy()
# Calculate an achieved matrix in a way which matches the jacobian calc
achieved_dist = base_mat * furness_factor
achieved_final, *_ = furness.doubly_constrained_furness(
seed_vals=achieved_dist,
row_targets=self.row_targets,
col_targets=self.col_targets,
tol=1e-7,
max_iters=20,
warning=False,
)

for j, dist in enumerate(cost_distributions):
distributions = cost_args[j * params_len : j * params_len + params_len]
init_params_kwargs = self._cost_params_to_kwargs(distributions)
Expand All @@ -376,8 +367,8 @@ def _jacobian_function(
adj_dist = adj_mat * furness_factor
adj_final, *_ = furness.doubly_constrained_furness(
seed_vals=adj_dist,
row_targets=self.row_targets,
col_targets=self.col_targets,
row_targets=self.achieved_distribution.sum(axis=1),
col_targets=self.achieved_distribution.sum(axis=0),
tol=1e-7,
max_iters=20,
warning=False,
Expand All @@ -390,7 +381,7 @@ def _jacobian_function(
bin_edges=inner_dist.cost_distribution.bin_edges,
)
act_cost_dist = cost_utils.CostDistribution.from_data(
matrix=achieved_final[inner_dist.zones],
matrix=self.achieved_distribution[inner_dist.zones],
cost_matrix=self.cost_matrix[inner_dist.zones],
bin_edges=inner_dist.cost_distribution.bin_edges,
)
Expand Down

0 comments on commit e98f260

Please sign in to comment.