Repository navigation
Conversation
…mensions and legalHessianDimensions
…Warning if any of the HighsLp vectors or HighsHessian::start_ have greater size than required by HighsLp::num_col_ and HighsLp::num_row_. They are resized, with logging when this occurs
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## latest #3372 +/- ##
==========================================
+ Coverage 75.02% 75.19% +0.17%
==========================================
Files 460 460
Lines 111862 112441 +579
Branches 17746 17772 +26
==========================================
+ Hits 83921 84548 +627
+ Misses 27659 27611 -48
Partials 282 282 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…; trimDimensions in HighsLp and HighsHessian
…atrixDimension and trimHessianDimension
…from calling parameters; created HighsSparseMatrix::trimDimensions
…ing it to be set when each HiGHS "entry" method is called. Hence Highs::logHeader() generalised to Highs::onFirstEntry(), and Highs::written_log_header_ generalised to Highs::made_first_call_
…ned matrix, and added some asserts to check the partitioned matrix in primal/dual simplex
|
Spotted quite a few methods in the
|
|
Just a thought, could The only question would be if any of the |
If it's just a question of writing the log header - as it is currently - then I think I'm correct in saying that the worst that could happen is that it gets written twice. This is not a problem, as anyone with multiple threads using the same HiGHS instance will either get unreadable logging, or will be sending logging to different files for each thread. In the latter case, having the header at the top of the file (or not) isn't a bad thing, even if they are parsing the log file. Am I right in thinking that the advantage of marking a method as |
fwesselm
left a comment
There was a problem hiding this comment.
@jajhall, just one more question. Would it be possible to have a
mutable std::once_flag log_header_flag_;
member in Highs.h:
void Highs::logHeader() const {
// Defer logging the header until output is switched on
if (!*options_.log_options.output_flag) return;
std::call_once(log_header_flag_, [this]() {
highsLogHeader(options_.log_options, options_.log_githash);
});
}
This would allow for making the methods const again and every Highs instance would have its own flag.
| void Highs::logHeader(const bool log_header) { | ||
| if (!options_.output_flag) return; | ||
| // if (!*options_.log_options.output_flag) return; | ||
| static std::once_flag flag; |
There was a problem hiding this comment.
Sorry, I am not an expert in this, but the static std::once_flag is shared by all Highs instances, so the header is now only logged once per process: if a process creates two Highs instances, only the first one logs the header.
There was a problem hiding this comment.
Thanks, I'm happy with this. It means that a lot of methods are const again, and we don't have to argue that the mutable value doesn't really compromise thread safety.
| @@ -3181,6 +3181,8 @@ HighsStatus Highs::computeIllConditioning( | |||
| Highs conditioning; | |||
| const bool dev_conditioning = false; | |||
| conditioning.setOptionValue("output_flag", false); // dev_conditioning); | |||
There was a problem hiding this comment.
If output_flag is false, logHeader(false) does immediately return, correct? Is the parameter log_header used only here?
if (!options_.output_flag) return;
| return status; | ||
| } | ||
|
|
||
| HighsStatus HighsLp::assess(const HighsOptions& options) { |
There was a problem hiding this comment.
Since matrix dimensions may not have been set, it may be good to call this->setMatrixDimensions() here?
| } | ||
|
|
||
| HighsStatus HighsSparseMatrix::assess(const HighsOptions& options) { | ||
| const bool sum_duplicates = false; |
There was a problem hiding this comment.
Maybe return a warning/error if there are no vectors but starting points are set? Maybe there is another case that could be handled with a warning...
if (this->numVec() == 0 && this->start_.size() > 1) ...
| lp.a_matrix_.value_.resize(lp_num_nz); | ||
|
|
||
| // Matrix should have been trimmed in lp.a_matrix_.assess | ||
| assert(lp.a_matrix_.trimDimensions(log_options) == HighsStatus::kOk); |
There was a problem hiding this comment.
This would only trim if assertions are enabled (debug mode)?
|
@jajhall, I merged with latest (there were conflicts) |
…for presolve-initial-sweep-all
…cols with illegal/small values returns the correct status and (if illegal) isn't added
|
Sorry @fwesselm, this is getting horrible to review. Don't look at this yet, as I'll write some commentary about the reasoning for the changes |
Description
Observing an assert when experimenting with #3364, I decided that trimming
HighsLpvectors that are too large (and logging) would be good for users and developers.lpDimensionsOkand its parameter list have been modified to be consistent withassessHessianDimensionsand "legal" used to distinguish them from "trim", as intrimHessianDimensionNB @fwesselm I spotted that if
num_col=iColthenlp_.col_names_[num_col] = std::move(lp_.col_names_[iCol]);leads tolp_.col_names_[num_col]being an empty string.Checklist
latestbranchRelated issue
Closes #3366