Skip to content

Should we return or give a warning when providing bounds/constraints to a problem that cannot handle them? #150

@nbelakovski

Description

@nbelakovski

We discussed this in #134 but I'd like to raise the discussion again. In the current code, if someone is merely curious as to how UOBYQA performs on their objective function, even if it ignores their constraints, they will be blocked from doing so until they modify their code to stop providing constraints. Once their curiosity is satisfied, they will need to both change the algorithm back to their original one and uncomment their constraints. This seems rather unfriendly to the user. It might even be difficult for them to comment out all of the constraints - maybe they call prima_minimize in many places with many different objective functions, and it could be very tedious and time consuming to comment out the constraints in all those places.

I see no harm in running one of these algorithms even if constraints are provided that it cannot handle. I do think we should issue a warning, because it's strange to call an unconstrained algorithm and provide constraints, but I don't think it makes sense to refuse to continue until the user does some extra actions. In real life if somebody came to me with a problem they wanted me to solve, and they provided some extraneous information, I certainly wouldn't refuse to solve the problem until they told me again but without the extraneous information, although I might inform them that some of the information they provided is unlikely to impact the solution.

In addition to the above, I was also thinking about what we should do in the event that someone calls an algorithm with accepts constraints, but doesn't provide any. I think this might also be a good case to issue a warning. If we refuse to run the algorithm, the user can always override this by providing a constraint function which does nothing, but again this is very unfriendly to the user.

We've talked about how objective and constraint functions can be expensive, so we do not want to run them unnecessarily, but if a user starts a program and sees a warning about constraints not being used or not being provided, they can always act on the warning and press Ctrl+C and investigate.

The main changes this would lead to in the code would be in prima_check_problem in prima.c, which currently returns an error code if an algorithm that doesn't take constraints is provided along with constraints. We would need to modify it to produce a warning and continue. We may also need to modify it depending on the answer to the question about running algorithms which take constraints but are not provided with any, I would propose we add a warning in these cases as well.

Edit: After writing this I went back to #134 and reviewed your comments there. I think that if the user does not specify an algorithm, we should refine the problem as we see fit and select the appropriate algorithm, and we'll never have the issue of calling an algorithm with extra information or with not enough constraints. However if the user explicitly asks us to use a particular method by overriding the method argument in Python, then it would be appropriate to issue a warning if we cannot refine the problem to the point that the bounds/constraints are appropraite for the method, but I do not see why we should refuse to run, especially when the user can modify their code and sidestep our restriction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions