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
Fix 1679 and 1681 #1753
Fix 1679 and 1681 #1753
Conversation
…rs to getVariables
…lf.update() is called in addVariable
…riable in test_highspy.py
OK it does seem that names are not cleared, this seems to be by design because the idea I think was to call update() once all the modelling is done, just before run. I tried to clear them naively at the end of update() in branch fixx, but that breaks one test:
Here is the failing test code:
` Natually, once I have cleared the list, the modelling language can not find the variable to delete. I'll investigate further |
'update()' is called when each constraint is added - otherwise addRow() returns kHighsError. It seems as if just the names fail - possibly something Luke didn't test. |
I added a list of names to the batch and now call that with names: see the latest commit. I thought it would be easier than trying to keep track of batch indices in vars_. Now the batch names are cleared at the end of update() and the column names should look allright ** edit something is not right again because there is a test_var_name failing, will look further |
@@ -106,7 +106,9 @@ def update(self): | |||
current_batch_size = len(self._batch.obj) | |||
print("\nDEBUG update(self): On entry - current_batch_size = ", current_batch_size) | |||
if current_batch_size > 0: | |||
names = [self._vars[i].name for i in range(current_batch_size)] | |||
# names = [self._vars[i].name for i in range(current_batch_size)] | |||
names = [self._batch.name[i] for i in range(current_batch_size)] |
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.
Yes, this fixes it. It's actually nothing to do with adding update() to addVariables, since this would be wrong once update() has been called for the first non-empty batch.
We now can't change name thus
TBH, I can't see a value in allowing this to be possible, so we can delete the test |
Renamed
addVar
toaddVariable
to prevent shadowing ofhighspy
binding toHighs::addVar
removeVar
todeleteVariable
for consistency withHighs::deleteCol
getVars
togetVariables
Added a call of
self.update()
toaddVariable
, rather than deferring it toaddConstr
, to allow column data to be changed, and rows to be added, usinghighspy
bindings to methods in theHighs
class. These will assume that all variables that have been defined are in the incumbent model.Unfortunately - see experiments with
examples/distillation.py
- this gets the column names wrong. It would appear as if thenames
stack isn't flushed whenself.update()
is called. Any thoughts @galabovaa ?