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

Adding new variables dynamically #10

Open
rnbguy opened this issue Mar 21, 2019 · 3 comments
Open

Adding new variables dynamically #10

rnbguy opened this issue Mar 21, 2019 · 3 comments

Comments

@rnbguy
Copy link

rnbguy commented Mar 21, 2019

Currently, when initializing Reluplex, we need to pass the number of variables we are gonna use. The point is, it uses dynamic array to initialize the variables which can not be resized.

_upperBounds = new VariableBound[_numVariables];
_lowerBounds = new VariableBound[_numVariables];
_preprocessedUpperBounds = new VariableBound[_numVariables];
_preprocessedLowerBounds = new VariableBound[_numVariables];
_assignment = new double[_numVariables];
_preprocessedAssignment = new double[_numVariables];

Does std::vector really affect Reluplex's performance?

@guykatzz
Copy link
Owner

guykatzz commented Mar 21, 2019 via email

@rnbguy
Copy link
Author

rnbguy commented Mar 21, 2019

I am sorry if I was not clear. This is not particularly an issue - more like a feature request. I want to add new variables as I go. I am willing to extend it with std::vector. But before doing that, I want to know,

  1. If this is possible just replacing these arrays with vectors and resizing them when I need new variables.
  2. Whether using vectors will cripple Reluplex's performance.

@guykatzz
Copy link
Owner

It is generally possible, and resizing the arrays should not cripple performance any more than if those variables had been there to begin with (in general, additional variables lead to slower performance). However, correctly adding more variables on the fly would require a certain understanding of how Reluplex works, as you would need to adjust a bunch of data structures correctly. In particular, it will be important whether you were adding new equations or just new variables, whether the new variables participate in ReLU constraints, and whether there is already stored information about the execution that would need to be updated in addition to the current state.

You are welcome to email me directly and explain your needs, and maybe we can find a solution.

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

No branches or pull requests

2 participants