Results 1 to 3 of 3

Thread: JMSL BoundedLeastSquares termination and output.

  1. #1
    Junior Member
    Join Date
    Aug 2007
    Posts
    5

    JMSL BoundedLeastSquares termination and output.

    Hi there.

    I have a couple of questions about the JMSL BoundedLeastSquares behaviour. The first question involves the solve() method. Is there a way to stop it while it's running? I'm looking for a way to signal BoundedLeastSquares to stop before it hits any of its termination conditions (basically to cancel the solve() because it is taking a long time).

    The second question involves output lines like:

    com.imsl.math.BoundedLeastSquares: Maximum number of iterations exceeded.

    Is there a way to turn this output off? The output actually looks similar to logging output, but I don't see any logging in the BoundedLeastSquares API.

    Thanks.

    Warren

  2. #2
    Senior Member ed's Avatar
    Join Date
    Aug 2005
    Posts
    312
    This message actually comes from the static com.imsl.Warning class. You can use Warning.setOut(PrintStream out) to redirect the output. You can also use Warning.setWarning(WarningObject obj) to customize how the warnings are handled.

    Note that the PrintStream cannot be null, but the WarningObject can be -- so use the latter method to completely ignore error and warning messages.


    EDIT: Sorry, forgot to address the first part of your question. I don't think there is a way to stop solve() once it's started. You could spin this off in another thread and then try to use interrupt(), but I'm not sure that would work. If you're doing ad-hoc work, you could tweak the max iterations or tolerances to make it stop sooner.


    EDIT 2: A colleague suggested another approach here which I think could work pretty well. If you have a set MaxTime you want the function to run, you can add a time check (System.currentTimeMillis()) to your BoundedLeastSquares.Jacobian function. When it has exceeded MaxTime, return a residual value of zero and this should cause the code to quit computing. If you want the answer so far, you can record x in a separate location.


    The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

  3. #3
    Junior Member
    Join Date
    Aug 2007
    Posts
    5
    Ah, the Warning class is what I was looking for. Setting the WarningObject to null worked like I wanted.

    The interrupt() solution to stopping solve() was a possible unfriendly solution I was looking at, but the Jacobian residual approach sounds like the better way to do it.

    Thanks for the help.

    Warren

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •