@@ -393,6 +393,62 @@ void HighsLp::addRowNames(const std::string name, const HighsInt num_new_row) {
393393 }
394394}
395395
396+ void HighsLp::deleteColsFromVectors (
397+ HighsInt& new_num_col, const HighsIndexCollection& index_collection) {
398+ assert (ok (index_collection));
399+ HighsInt from_k;
400+ HighsInt to_k;
401+ limits (index_collection, from_k, to_k);
402+ // Initialise new_num_col in case none is removed due to from_k > to_k
403+ new_num_col = this ->num_col_ ;
404+ if (from_k > to_k) return ;
405+
406+ HighsInt delete_from_col;
407+ HighsInt delete_to_col;
408+ HighsInt keep_from_col;
409+ HighsInt keep_to_col = -1 ;
410+ HighsInt current_set_entry = 0 ;
411+
412+ HighsInt col_dim = this ->num_col_ ;
413+ new_num_col = 0 ;
414+ bool have_names = (this ->col_names_ .size () != 0 );
415+ bool have_integrality = (this ->integrality_ .size () != 0 );
416+ for (HighsInt k = from_k; k <= to_k; k++) {
417+ updateOutInIndex (index_collection, delete_from_col, delete_to_col,
418+ keep_from_col, keep_to_col, current_set_entry);
419+ // Account for the initial columns being kept
420+ if (k == from_k) new_num_col = delete_from_col;
421+ if (delete_to_col >= col_dim - 1 ) break ;
422+ assert (delete_to_col < col_dim);
423+ for (HighsInt col = keep_from_col; col <= keep_to_col; col++) {
424+ this ->col_cost_ [new_num_col] = this ->col_cost_ [col];
425+ this ->col_lower_ [new_num_col] = this ->col_lower_ [col];
426+ this ->col_upper_ [new_num_col] = this ->col_upper_ [col];
427+ if (have_names) this ->col_names_ [new_num_col] = this ->col_names_ [col];
428+ if (have_integrality)
429+ this ->integrality_ [new_num_col] = this ->integrality_ [col];
430+ new_num_col++;
431+ }
432+ if (keep_to_col >= col_dim - 1 ) break ;
433+ }
434+ this ->col_cost_ .resize (new_num_col);
435+ this ->col_lower_ .resize (new_num_col);
436+ this ->col_upper_ .resize (new_num_col);
437+ if (have_names) this ->col_names_ .resize (new_num_col);
438+ }
439+
440+ void HighsLp::deleteRowsFromVectors (
441+ HighsInt& new_num_row, const HighsIndexCollection& index_collection) {}
442+
443+ void HighsLp::deleteCols (const HighsIndexCollection& index_collection) {
444+ HighsInt new_num_col;
445+ this ->deleteColsFromVectors (new_num_col, index_collection);
446+ this ->a_matrix_ .deleteCols (index_collection);
447+ this ->num_col_ = new_num_col;
448+ }
449+
450+ void HighsLp::deleteRows (const HighsIndexCollection& index_collection) {}
451+
396452void HighsLp::unapplyMods () {
397453 // Restore any non-semi types
398454 const HighsInt num_non_semi = this ->mods_ .save_non_semi_variable_index .size ();
0 commit comments