Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Customised Error for infeasible problem #2631

Open
Waschenbacher opened this issue Nov 16, 2024 · 1 comment
Open

[Feature Request] Customised Error for infeasible problem #2631

Waschenbacher opened this issue Nov 16, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Waschenbacher
Copy link
Contributor

🚀 Feature Request

Replace the general ValueError with a custom error, when infeasible point is found.

Motivation

We are calling the get_polytope_samples() function and would like to catch the error caused by infeasibility. Currently, infeasible case would raise a ValueError, see the code snippet below from find_interior_point()

    if result.status == 2:
        raise ValueError(
            "No feasible point found. Constraint polytope appears empty. "
            + "Check your constraints."
        )
    elif result.status > 0:
        raise ValueError(
            "Problem checking constraint specification. "
            + f"linprog status: {result.message}"
        )

To differentiate ValueErrors arising from various causes, it would be beneficial to assign a specific custom error, such as InfeasibleProblemError, for scenarios where no feasible point is found.

@Waschenbacher Waschenbacher added the enhancement New feature or request label Nov 16, 2024
@Balandat
Copy link
Contributor

Balandat commented Nov 17, 2024

That makes a lot of sense; I'd be happy to include such a change. Would you be willing to put up a PR for this?

There are probably a few other places where we could use such an error, e.g. here and here.

facebook-github-bot pushed a commit that referenced this issue Dec 16, 2024
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to make BoTorch better.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to BoTorch here: https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md
-->

## Motivation

Add customised error for infeasible problem. Details see #2631

### Have you read the [Contributing Guidelines on pull requests](https://github.com/pytorch/botorch/blob/main/CONTRIBUTING.md#pull-requests)?

Yes.

Pull Request resolved: #2652

Test Plan:
The customised error is tested in a similar way as the other customised errors.

## Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/pytorch/botorch, and link to your PR here.)

Reviewed By: saitcakmak

Differential Revision: D67280696

Pulled By: Balandat

fbshipit-source-id: 581dbe23d304966632c83feb1286071d7fbddade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants