Skip to content

MDP solution via linear programming for explicit engine.#149

Open
davexparker wants to merge 1 commit intoprismmodelchecker:masterfrom
davexparker:lp
Open

MDP solution via linear programming for explicit engine.#149
davexparker wants to merge 1 commit intoprismmodelchecker:masterfrom
davexparker:lp

Conversation

@davexparker
Copy link
Copy Markdown
Member

No description provided.

…t engine.

Uses the built-in lpsolve library.

Not particularly efficient, but a useful reference.
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

Adds explicit-engine support for solving MDP reachability probabilities and expected reachability rewards via linear programming (lp_solve), wiring it into the existing MDPSolnMethod.LINEAR_PROGRAMMING selection and extending tests to exercise -lp.

Changes:

  • Implement LP-based solvers for reachability probabilities and reachability rewards in explicit.MDPModelChecker.
  • Allow MDPSolnMethod.LINEAR_PROGRAMMING in the explicit engine for reachability rewards (previously switched away).
  • Extend existing test matrices/fixtures to run explicit MDP checks with -lp, and add reward queries to a lecture example.

Reviewed changes

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

Show a summary per file
File Description
prism/src/explicit/MDPModelChecker.java Implements LP formulations for Pmin/Pmax and Rmin/Rmax (with some restrictions) and plugs them into the numeric solve dispatch.
prism-tests/pmc/lec13and14mdp.nm.props Adds reachability reward queries with expected results for the lecture MDP.
prism-tests/pmc/lec13and14mdp.nm Adds a rewards structure to support the new reward queries.
prism-tests/functionality/verify/mdps/rewards/rewpoliter.nm.props.args Adds an invocation that runs the rewards suite with -lp.
prism-tests/functionality/verify/mdps/reach/mdp_simple.nm.props.args Adds an invocation that runs the reachability suite with explicit engine + -lp.

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

}
res = computeReachProbsModPolIter(mdp, no, yes, min, strat);
break;
case LINEAR_PROGRAMMING:
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The linear-programming branch ignores the init/known parameters passed into computeReachProbsNumeric(). If callers provide known exact values for some states, they are currently silently not enforced/used when method==LINEAR_PROGRAMMING. Consider either (a) adding equality constraints for known states (and seeding from init if useful), or (b) rejecting init/known for LP with a clear PrismNotSupportedException to avoid surprising behavior.

Suggested change
case LINEAR_PROGRAMMING:
case LINEAR_PROGRAMMING:
if (init != null || known != null) {
throw new PrismNotSupportedException("Linear programming does not currently support init/known parameters for reachability probability computation");
}

Copilot uses AI. Check for mistakes.
}
res = computeReachRewardsPolIter(mdp, mdpRewards, target, inf, min, strat);
break;
case LINEAR_PROGRAMMING:
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The linear-programming branch ignores the init/known parameters passed into computeReachRewardsNumeric(). If callers provide known exact values for some states, they are currently silently not enforced/used when method==LINEAR_PROGRAMMING. Consider either (a) adding equality constraints for known states (and seeding from init if useful), or (b) rejecting init/known for LP with a clear PrismNotSupportedException to avoid surprising behavior.

Suggested change
case LINEAR_PROGRAMMING:
case LINEAR_PROGRAMMING:
if (init != null || (known != null && !known.isEmpty())) {
throw new PrismNotSupportedException("Linear programming does not support init/known parameters for reachability rewards");
}

Copilot uses AI. Check for mistakes.
}
toInf = toInf || inf.get(t);
}
// We ignore choices that may lead to an inf states
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

Grammar: “may lead to an inf states” should be singular (“an inf state”).

Suggested change
// We ignore choices that may lead to an inf states
// We ignore choices that may lead to an inf state

Copilot uses AI. Check for mistakes.
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