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

Implement an outcome_constraint in Ax #271

Closed
aleczhanshi opened this issue Mar 11, 2020 · 3 comments
Closed

Implement an outcome_constraint in Ax #271

aleczhanshi opened this issue Mar 11, 2020 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@aleczhanshi
Copy link

Hi there, I was trying to implement an outcome constraint in Ax and BO with SimpleExperiment. I came across the code example below:

exp = SimpleExperiment(
    name="test_branin",
    search_space=hartmann_search_space,
    evaluation_function=hartmann_evaluation_function,
    objective_name="hartmann6",
    minimize=True,
    outcome_constraints=[
        OutcomeConstraint(
            metric=L2NormMetric(
                name="l2norm", param_names=[f"x{i}" for i in range(6)], noise_sd=0.2
            ),
            op=ComparisonOp.LEQ,
            bound=1.25,
            relative=False,
        )
    ],
)

In particular, my outcome constraint is x1*x2+16*x1+16*x2<=64 where x1 and x2 are integer parameters, and it's not clear to me how to implement this specific constraint here and what my "metric" should me.

Any help is appreciated, thanks!

@Balandat
Copy link
Contributor

I assume your x are your parameters? The outcome constraint is typically used to model black-box constraint, i.e. on outcomes whose functional form is unknown and needs to be modeled as the objective does.

If you know the constraints then it’s typically preferred to include them as parameter constraints directly on the parameters. Now this is a nonlinear constraint, so that is unfortunately not straightforward to do in Ax.

Do you have other parameters as well? If not, then the size of feasible set In your case is quite small and could easily be enumerated: {(4, 0), (3,,1), (3,0), ...

A general problem with this kind of non-convex constraint set is that getting a reasonable model might be challenging, but it would be worth a try.

@aleczhanshi
Copy link
Author

@Balandat Thanks for the quick response! Yeah I'm implementing it as an outcome constraint due to the nonlinearity. It is understood that outcome constraints are typically used for black-box metrics, but I assume it could also be closed-form right? I want to try this out to see if it helps to have those non-linear constraints as outcome constraints.

@ldworkin ldworkin added the question Further information is requested label Mar 11, 2020
@lena-kashtelyan
Copy link
Contributor

The constraint-in-question (x1x2+16x1+16*x2<=64) would still need to be a parameter constraint, simply because of the way the parameter vs. outcome constraints are applied in Ax (outcome constraints apply specifically to constraints on metric outcomes, and changing this would require a series of structural changes to Ax). Non-linear constraints are not available as outcome constraints either, I just wanted to emphasize that a parameter constraint cannot be forced to be a synthetic outcome constraint in either case.

Here is the duplicate issue for non-linear parameter constraints: #153 we already have open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants