Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bugs on trading and tariff actions #46

Open
ponseko opened this issue Aug 16, 2024 · 0 comments
Open

Possible bugs on trading and tariff actions #46

ponseko opened this issue Aug 16, 2024 · 0 comments

Comments

@ponseko
Copy link
Collaborator

ponseko commented Aug 16, 2024

Looks like in the current calc_normalized_import_bids, the import bids remain zero if the desired_exports < max_exports. This value is then used to get the gross import, so this seems pretty damaging to trading:

def calc_normalized_import_bids(
self, potential_import_bids_all_regions, gross_outputs, investments
):
normalized_import_bids_all_regions = np.zeros(
(self.num_regions, self.num_regions), dtype=self.float_dtype
)
for region_id in range(self.num_regions):
max_export_rate = self.get_state(
"export_limit_all_regions", region_id=region_id
)
max_exports_from_region_id = self.calc_max_exports(
max_export_rate, gross_outputs[region_id], investments[region_id]
)
desired_exports_from_region_id = np.sum(
potential_import_bids_all_regions[:, region_id]
)
if desired_exports_from_region_id > max_exports_from_region_id:
for exporting_region in range(self.num_regions):
normalized_import_bids_all_regions[exporting_region][region_id] = (
potential_import_bids_all_regions[exporting_region][region_id]
/ desired_exports_from_region_id
* max_exports_from_region_id
)
return normalized_import_bids_all_regions

Furthermore, the import_tariff actions seem to be delayed by a timestep. Both calc_trade_sanctions and calc_welfloss_multiplier, get the action from the prev_state. Is this intentional?

def calc_trade_sanctions(self, gross_imports, save_state=True):
import_tariffs = self.get_prev_state("import_tariffs_all_regions")

def calc_welfloss_multiplier(
self,
gross_outputs,
gross_imports,
net_imports,
welfare_loss_per_unit_tariff=None,
welfare_gain_per_unit_exported=None,
save_state=True,
):
"""Calculate the welfare loss multiplier of exporting region due to being tariffed."""
if not self.apply_welfloss:
return np.ones((self.num_regions), dtype=self.float_dtype)
if welfare_loss_per_unit_tariff is None:
welfare_loss_per_unit_tariff = 0.4 # From Nordhaus 2015
if welfare_gain_per_unit_exported is None:
welfare_gain_per_unit_exported = 0.4
import_tariffs = self.get_prev_state("import_tariffs_all_regions")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant