MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / deleteColsInterface

Method deleteColsInterface

highs/lp_data/HighsInterface.cpp:711–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711void Highs::deleteColsInterface(HighsIndexCollection& index_collection) {
712 HighsLp& lp = model_.lp_;
713 HighsBasis& basis = basis_;
714 lp.ensureColwise();
715
716 // Keep a copy of the original number of columns to check whether
717 // any columns have been removed, and if there is mask to be updated
718 HighsInt original_num_col = lp.num_col_;
719
720 lp.deleteCols(index_collection);
721 model_.hessian_.deleteCols(index_collection);
722 // Bail out if no columns were actually deleted
723 if (lp.num_col_ == original_num_col) return;
724
725 assert(lp.num_col_ < original_num_col);
726
727 // Nontrivial deletion so reset the model_status and update any
728 // Highs basis
729 model_status_ = HighsModelStatus::kNotset;
730 if (basis_.useful) {
731 assert(basis_.col_status.size() == static_cast<size_t>(original_num_col));
732 // Have a full set of column basis status values, so maintain
733 // them, and only invalidate the basis if a basic column has been
734 // deleted
735 deleteBasisCols(basis_, index_collection, original_num_col);
736 } else {
737 assert(!basis.valid);
738 }
739
740 if (lp.scale_.has_scaling) {
741 deleteScale(lp.scale_.col, index_collection);
742 lp.scale_.col.resize(lp.num_col_);
743 lp.scale_.num_col = lp.num_col_;
744 }
745 // Deduce the consequences of deleting columns
746 invalidateModelStatusSolutionAndInfo();
747
748 // Determine any implications for simplex data
749 ekk_instance_.deleteCols(index_collection);
750
751 if (index_collection.is_mask_) {
752 // Set the mask values to indicate the new index value of the
753 // remaining columns
754 HighsInt new_col = 0;
755 for (HighsInt col = 0; col < original_num_col; col++) {
756 if (!index_collection.mask_[col]) {
757 index_collection.mask_[col] = new_col;
758 new_col++;
759 } else {
760 index_collection.mask_[col] = -1;
761 }
762 }
763 assert(new_col == lp.num_col_);
764 }
765 assert(lpDimensionsOk("deleteCols", lp, options_.log_options));
766 lp.col_hash_.name2index.clear();
767}
768

Callers

nothing calls this directly

Calls 8

deleteBasisColsFunction · 0.85
deleteScaleFunction · 0.85
lpDimensionsOkFunction · 0.85
ensureColwiseMethod · 0.45
deleteColsMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected