Commit 29bc7c31 authored by Max Lyon's avatar Max Lyon

store start solution for gurobi

parent 6f9a8cad
Pipeline #5916 failed with stages
in 6 minutes and 33 seconds
......@@ -132,9 +132,16 @@ solve(NProblemInterface* _problem,
for (int i = 0; i < _problem->n_unknowns(); ++i)
vars[i].set(GRB_DoubleAttr_Start, start[i]);
// Integrate new variables
model.update();
if (!start_solution_output_path_.empty())
{
std::cout << "Writing problem's start solution into file \"" << start_solution_output_path_ << "\"." << std::endl;
model.write(start_solution_output_path_);
}
//----------------------------------------------
// 2. setup constraints
//----------------------------------------------
......@@ -929,6 +936,19 @@ set_problem_output_path( const std::string &_problem_output_path)
//-----------------------------------------------------------------------------
void
GUROBISolver::
set_start_solution_output_path(const std::string& _start_solution_output_path)
{
std::stringstream ss;
ss << _start_solution_output_path << ".mst";
start_solution_output_path_ = ss.str();
}
//-----------------------------------------------------------------------------
void
GUROBISolver::
set_problem_env_output_path( const std::string &_problem_env_output_path)
......
......@@ -104,9 +104,10 @@ public:
}
void set_problem_output_path ( const std::string &_problem_output_path);
void set_problem_env_output_path( const std::string &_problem_env_output_path);
void set_solution_input_path ( const std::string &_solution_input_path);
void set_problem_output_path ( const std::string &_problem_output_path);
void set_start_solution_output_path( const std::string &_start_solution_output_path);
void set_problem_env_output_path ( const std::string &_problem_env_output_path);
void set_solution_input_path ( const std::string &_solution_input_path);
protected:
double* P(std::vector<double>& _v)
......@@ -122,6 +123,7 @@ private:
// filenames for exporting/importing gurobi solutions
// if string is empty nothing is imported or exported
std::string problem_output_path_;
std::string start_solution_output_path_;
std::string problem_env_output_path_;
std::string solution_input_path_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment