Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CoMISo
CoMISo
Commits
29bc7c31
Commit
29bc7c31
authored
Dec 06, 2017
by
Max Lyon
Browse files
store start solution for gurobi
parent
6f9a8cad
Pipeline
#5916
failed with stages
in 6 minutes and 33 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
NSolver/GUROBISolver.cc
View file @
29bc7c31
...
...
@@ -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
)
...
...
NSolver/GUROBISolver.hh
View file @
29bc7c31
...
...
@@ -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_
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment