Skip to content

UMB fixes#276

Closed
davexparker wants to merge 8 commits intoprismmodelchecker:masterfrom
davexparker:umb
Closed

UMB fixes#276
davexparker wants to merge 8 commits intoprismmodelchecker:masterfrom
davexparker:umb

Conversation

@davexparker
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the UMB import/read path to be more tolerant of missing optional binary entries and to better handle integer valuations that may require up to 64 bits during decoding/range computation.

Changes:

  • Add “default value” extraction paths when certain UMB binary entries are absent (e.g., offsets, players, branch probabilities).
  • Introduce 64-bit integer support in bitstring/bitpacking utilities and add long-based valuation range computation.
  • Update the PRISM UMBImporter to decode integer variables via the new long-capable APIs and safely cast back to int where required.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
prism/src/io/github/pmctools/umbj/UMBReader.java Adds missing-file defaults, long range computation, and default array fillers.
prism/src/io/github/pmctools/umbj/UMBFormat.java Introduces BinFileDefaultValue enum for default-fill behavior.
prism/src/io/github/pmctools/umbj/UMBBitString.java Adds set/get for signed/unsigned longs in bitstrings.
prism/src/io/github/pmctools/umbj/UMBBitPacking.java Adds long get/set helpers for bit-packed integer variables.
prism/src/io/UMBImporter.java Switches integer decoding/range computation to long-first and casts to int with overflow checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread prism/src/io/github/pmctools/umbj/UMBBitString.java Outdated
Comment on lines +917 to +939
if (type.type.isDouble()) {
DoubleConsumer doubleConsumer = (DoubleConsumer) consumer;
double doubleValue;
switch (value) {
case ZERO:
doubleValue = 0.0;
break;
case ONE:
doubleValue = 1.0;
break;
default:
throw new UMBException("Unsupported default value " + value);
}
for (long i = 0; i < sizeNew; i++) {
doubleConsumer.accept(doubleValue);
}
} else if (type.type.isRational()) {
if (!type.isDefaultSize()) {
throw new UMBException("Non-default sized rationals are not yet supported");
}
LongConsumer longConsumer = (it.unimi.dsi.fastutil.longs.LongConsumer) consumer;
long longValue1;
long longValue2;
Comment on lines +104 to +109
if (!fileExists(UMBFormat.STATE_CHOICE_OFFSETS_FILE)) {
// Indices default to identities if requested when absent
extractDefaultLongArray(umbIndex.getNumStates() + 1, UMBFormat.BinFileDefaultValue.IDENTITY, longConsumer);
} else {
extractLongArray(UMBFormat.STATE_CHOICE_OFFSETS_FILE, umbIndex.getNumStates() + 1, longConsumer);
}
Comment thread prism/src/io/UMBImporter.java Outdated
Comment thread prism/src/io/github/pmctools/umbj/UMBReader.java Outdated
davexparker and others added 3 commits March 25, 2026 15:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@davexparker
Copy link
Copy Markdown
Member Author

Rebased/merged.

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