-
Notifications
You must be signed in to change notification settings - Fork 42
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
Continuous inter-point constraints #345
base: main
Are you sure you want to change the base?
Conversation
Note: This PR is currently on hold for two reasons:
|
a5ed090
to
7cbb490
Compare
7cbb490
to
d5758c5
Compare
d5758c5
to
ecb050e
Compare
as mentioned in our call but posting here for documentation / reference: I think its worth exploring whether a design not via deriving from |
e82a4cc
to
1e2cd40
Compare
1e2cd40
to
004ec49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet completely done with the review, but because time is running, here a first batch of comments
@@ -140,3 +142,59 @@ | |||
"2.0*x_2 + 3.0*x_4 <= 1.0 satisfied in all recommendations? ", | |||
(2.0 * measurements["x_2"] + 3.0 * measurements["x_4"]).le(1.0 + TOLERANCE).all(), | |||
) | |||
|
|||
|
|||
### Using inter-point constraints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interpoint should be its own example file feels just 'drangepappt' for this example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a new example, please have a look and resolve if happy
return self._sample_from_bounds(batch_size, self.comp_rep_bounds.values) | ||
|
||
if self.has_interpoint_constraints: | ||
return self._sample_from_polytope_with_interpoint_constraints( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it feasible to keep splittitng the sample function up like that? eg what happens if we have interpoint+cardinality constraints
return self._sample_from_bounds(batch_size, self.comp_rep_bounds.values) | ||
|
||
if self.has_interpoint_constraints: | ||
return self._sample_from_polytope_with_interpoint_constraints( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt 'sample_from_polytope' a special case of the new function? If so I think it could be better design if one was contained int he other or one calls the other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I have combined the two functions into a single one and will resolve this comment here once the changes have been pushed- I will keep the other one open for further discussion of the topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new intperpoint flag should be mentioned in the userguide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included a section on that in the userguide, please resolve if you are happy with it.
9cc6274
to
2166a35
Compare
2166a35
to
0cdc3dd
Compare
This PR introduces a first variant of inter-point constraints by using the
botorch
-provided interface.Here, an inter-point constraint is a constraint that acts on a full batch instead of a single recommendation. If we think of a batch recommendation of a matrix with shape
batches x features
, then our previous constraints would be row-wise, while these constraints allow mixed constraints across both dimensions.This PR introduces new classes, and these classes were modeled similar to the already existing classes for continuous constraints. Some things had to be changed though resp. we need to aware:
get_polytope_samples
is not made for including inter-point constraints, and hence a workaround was implemented. The workaround basically transforms the space in a one-dimensional space withbatches * features
many features, and then defines both normal and inter-point constraints over this space (see [Bug]get_polytope_samples
fails for inequalities overq
-batches and the actual dimension pytorch/botorch#2468). Note that this might interfere with Botorch with cardinality constraint via sampling #301 and that some alignment might be necessary.