esa / esa/pagmo2

[FEATURE] ways to save logs of search path [PSO]

Open
#596 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
935
Forks
186
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
https://github.com/esa/pagmo2/discussions/595
to save parameters in the search path, for example, in PSO.
**Describe the solution you'd like**
Making attempt of putting
```cpp
mutable std::mutex file_mutex;

int tscall::write_to_file(std::string content) const {
std::lock_guard lock(file_mutex); // Locking to prevent race condition
std::ofstream file(filename, std::ios::app); // Open in append mode
if (file.is_open()) {
file << content << std::endl;
} else {
std::cerr << "Error opening file!" << std::endl;
}
}
```
in
https://github.com/esa/pagmo2/blob/ac7b6d2b1eef0f4734c07b081d908caf3177f5e9/src/problems/rosenbrock.cpp#L51-L59

A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.