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

prevent underflow when not enough material is available to make a packagable bid #621

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

nuclearkatie
Copy link
Contributor

@nuclearkatie nuclearkatie commented Aug 16, 2024

n_full_bids could result in negative int max when bid_qty = 0, when it should be zero

Requires cyclus#1790 to be merged first! (merged)

Copy link

github-actions bot commented Aug 16, 2024

Build Status Report - f3637af - 2024-08-28 13:56:51 -0600

Build FROM cyclus_20.04_apt/cyclus:latest
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_20.04_apt/cyclus:stable
  • Cycamore: Failure
  • Cymetric: Skipped due to upstream failure ⚠️
Build FROM cyclus_20.04_conda/cyclus:latest
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_20.04_conda/cyclus:stable
  • Cycamore: Failure
  • Cymetric: Skipped due to upstream failure ⚠️
Build FROM cyclus_22.04_apt/cyclus:latest
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_22.04_apt/cyclus:stable
  • Cycamore: Failure
  • Cymetric: Skipped due to upstream failure ⚠️
Build FROM cyclus_22.04_conda/cyclus:latest
  • Cycamore: Success
  • Cymetric: Success
Build FROM cyclus_22.04_conda/cyclus:stable
  • Cycamore: Failure
  • Cymetric: Skipped due to upstream failure ⚠️

src/source.cc Outdated
@@ -103,7 +103,10 @@ std::set<cyclus::BidPortfolio<cyclus::Material>::Ptr> Source::GetMatlBids(

// calculate packaging
double bid_qty = context()->GetPackage(package)->GetFillMass(qty);
int n_full_bids = static_cast<int>(std::floor(qty / bid_qty));
int n_full_bids = 0;
if (bid_qty >= context()->GetPackage(package)->fill_min()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In mat_sell_policy we only make sure that it's not 0 rather than compare to fill_min. I wonder which one is more robust and more useful?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should also somehow return n_full_bids from GetFillMass() and handle this in a single robust way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing in cyclus#1790

@nuclearkatie nuclearkatie marked this pull request as ready for review August 28, 2024 20:13
@gonuke
Copy link
Member

gonuke commented Sep 10, 2024

I relaunched tests with the updates in cyclus

@nuclearkatie
Copy link
Contributor Author

This also requires cyclus#1795 for the python tests to pass on latest

@gonuke
Copy link
Member

gonuke commented Sep 13, 2024

Now passes on latest - will merge.

@gonuke gonuke merged commit 58650fe into cyclus:main Sep 13, 2024
10 checks passed
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

Successfully merging this pull request may close these issues.

2 participants