Export (0) Print
Expand All

Debugging with Solver Foundation

Solver Foundation 3.0

You can debug Solver Foundation solutions by using the Visual Studio debugger. You can also implement your own exceptions and set the debug mode to investigate problems in models.

Solvers that are registered with Solver Foundation can handle and throw exceptions. You should use caution because the solver is run on another thread and an unhandled exception can cause the application to crash. For all non-critical exceptions, we recommend that solver vendors implement and throw their own exceptions as a subclass of MsfException exception. Solver Foundation can handle all MsfException exceptions and present error messages to the user code appropriately. Other types of exceptions are unhandled and should to be debugged by solver vendors and application programmers.

When a user adds a constraint in Debug mode, the constraint is tested to see if it is consistent with the rest of the constraints, and, if so, whether the domains of the variables can be further reduced through propagation.

The following table lists the three debug modes.

Debug Mode

Propagation

Solve

Conflicts

DebugHeavy

Incremental and cumulative propagation is performed before the solve process. Intermediate results are stored to avoid recomputation.

Complete solve is performed after each constraint is added. If a solution is found, the solver stops and reports a consistent solution before backtracking to the point after propagation.

All potential conflicts are found, but this is a slower process.

DebugLight

Incremental and cumulative propagation is performed.

A complete solve is not performed.

Not all potential conflicts may be caught. However, this is a faster process than the Heavy mode.

FullSpeed

No propagation.

Full solve is not performed.

No conflicts are detected during model construction. The solver will report if a model is infeasible after the Solve method is computed.

Show:
© 2014 Microsoft