Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
CoMISo
CoMISo
Commits
a30591d5
Commit
a30591d5
authored
Jan 15, 2021
by
Martin Heistermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'constrained-solver-save-memory' into cgg3
parents
3f9d8869
77984b11
Pipeline
#16441
passed with stages
in 4 minutes and 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
15 deletions
+45
-15
Solver/ConstrainedSolver.hh
Solver/ConstrainedSolver.hh
+14
-0
Solver/ConstrainedSolverT.cc
Solver/ConstrainedSolverT.cc
+29
-15
cmake/FindGMM.cmake
cmake/FindGMM.cmake
+2
-0
No files found.
Solver/ConstrainedSolver.hh
View file @
a30591d5
...
...
@@ -257,6 +257,17 @@ public:
/// Set noise-level (how much std output is given) 0 basically none, 1 important stuff (warning/timing, is default), 2+ not so important
void
set_noisy
(
int
_noisy
)
{
noisy_
=
_noisy
;}
/// Support changing the RHS of the constraint system in resolve(). Enabled by default.
/// If this is needed, it must be enabled for the initial solve, not just before the resolve!
/// Warning: This can impose substantial memory overhead for large sparse constraint systems.
void
set_support_constraint_rhs_resolve
(
bool
_val
)
{
support_constraint_rhs_resolve_
=
_val
;
if
(
!
_val
)
{
// Disabling support means we don't need the content of D_ anymore.
this
->
rhs_update_table_
.
D_
=
{};
}
}
// Get/Set whether the constraint reordering is used (default true)
bool
use_constraint_reordering
=
true
;
...
...
@@ -327,6 +338,9 @@ private:
int
noisy_
;
bool
do_gcd_
;
// User-configurable, whether to store information for constraint-rhs resolve:
bool
support_constraint_rhs_resolve_
=
true
;
// --------------- Update by Marcel to enable efficient re-solve with changed rhs ----------------------
// Store for symbolic elimination information for rhs
class
rhsUpdateTable
{
...
...
Solver/ConstrainedSolverT.cc
View file @
a30591d5
...
...
@@ -285,6 +285,10 @@ ConstrainedSolver::resolve(
// apply stored updates and eliminations to exchanged rhs
if
(
_constraint_rhs
)
{
if
(
!
support_constraint_rhs_resolve_
)
{
std
::
cerr
<<
"ERROR: ConstrainedSolver::resolve: resolve() with modified constraint_rhs requested, but support is disabled."
<<
std
::
endl
;
return
;
}
// apply linear transformation of Gaussian elimination
rhs_update_table_
.
cur_constraint_rhs_
.
resize
(
gmm
::
mat_nrows
(
rhs_update_table_
.
D_
));
gmm
::
mult
(
rhs_update_table_
.
D_
,
*
_constraint_rhs
,
rhs_update_table_
.
cur_constraint_rhs_
);
...
...
@@ -338,9 +342,11 @@ ConstrainedSolver::make_constraints_independent(
DEB_enter_func
;
// setup linear transformation for rhs, start with identity
gmm
::
size_type
nr
=
gmm
::
mat_nrows
(
_constraints
);
gmm
::
resize
(
rhs_update_table_
.
D_
,
nr
,
nr
);
gmm
::
clear
(
rhs_update_table_
.
D_
);
for
(
gmm
::
size_type
i
=
0
;
i
<
nr
;
++
i
)
rhs_update_table_
.
D_
(
i
,
i
)
=
1.0
;
if
(
support_constraint_rhs_resolve_
)
{
gmm
::
resize
(
rhs_update_table_
.
D_
,
nr
,
nr
);
gmm
::
clear
(
rhs_update_table_
.
D_
);
for
(
gmm
::
size_type
i
=
0
;
i
<
nr
;
++
i
)
rhs_update_table_
.
D_
(
i
,
i
)
=
1.0
;
}
// Base::StopWatch sw;
// number of variables
...
...
@@ -499,9 +505,11 @@ ConstrainedSolver::make_constraints_independent(
_constraints
(
c_it
.
index
(),
elim_j
)
=
0
;
constraints_c
(
c_it
.
index
(),
elim_j
)
=
0
;
// update linear transition of rhs
gmm
::
add
(
gmm
::
scaled
(
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
i
),
val
),
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
c_it
.
index
()));
if
(
support_constraint_rhs_resolve_
)
{
// update linear transition of rhs
gmm
::
add
(
gmm
::
scaled
(
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
i
),
val
),
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
c_it
.
index
()));
}
}
}
}
...
...
@@ -522,11 +530,13 @@ ConstrainedSolver::make_constraints_independent_reordering(
DEB_enter_func
;
// setup linear transformation for rhs, start with identity
gmm
::
size_type
nr
=
gmm
::
mat_nrows
(
_constraints
);
gmm
::
resize
(
rhs_update_table_
.
D_
,
nr
,
nr
);
gmm
::
clear
(
rhs_update_table_
.
D_
);
if
(
support_constraint_rhs_resolve_
)
{
gmm
::
resize
(
rhs_update_table_
.
D_
,
nr
,
nr
);
gmm
::
clear
(
rhs_update_table_
.
D_
);
for
(
gmm
::
size_type
i
=
0
;
i
<
nr
;
++
i
)
rhs_update_table_
.
D_
(
i
,
i
)
=
1.0
;
for
(
gmm
::
size_type
i
=
0
;
i
<
nr
;
++
i
)
rhs_update_table_
.
D_
(
i
,
i
)
=
1.0
;
}
// Base::StopWatch sw;
// number of variables
...
...
@@ -716,9 +726,11 @@ ConstrainedSolver::make_constraints_independent_reordering(
queue
.
update
(
static_cast
<
int
>
(
cur_idx
),
static_cast
<
int
>
(
cur_nnz
));
// update linear transition of rhs
gmm
::
add
(
gmm
::
scaled
(
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
i
),
val
),
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
c_it
.
index
()));
if
(
support_constraint_rhs_resolve_
)
{
// update linear transition of rhs
gmm
::
add
(
gmm
::
scaled
(
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
i
),
val
),
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
c_it
.
index
()));
}
}
}
}
...
...
@@ -732,7 +744,7 @@ ConstrainedSolver::make_constraints_independent_reordering(
RMatrixT
c_tmp
(
gmm
::
mat_nrows
(
_constraints
),
gmm
::
mat_ncols
(
_constraints
));
gmm
::
copy
(
_constraints
,
c_tmp
);
RowMatrix
d_tmp
(
gmm
::
mat_nrows
(
rhs_update_table_
.
D_
),
gmm
::
mat_ncols
(
rhs_update_table_
.
D_
));
gmm
::
copy
(
rhs_update_table_
.
D_
,
d_tmp
);
rhs_update_table_
.
D_
.
swap
(
d_tmp
);
// std::vector<int> elim_temp2(_c_elim);
// std::sort(elim_temp2.begin(), elim_temp2.end());
...
...
@@ -744,7 +756,9 @@ ConstrainedSolver::make_constraints_independent_reordering(
for
(
unsigned
int
i
=
0
;
i
<
nr
;
++
i
)
{
gmm
::
copy
(
gmm
::
mat_row
(
c_tmp
,
row_ordering
[
i
]),
gmm
::
mat_row
(
_constraints
,
i
));
gmm
::
copy
(
gmm
::
mat_row
(
d_tmp
,
row_ordering
[
i
]),
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
i
));
if
(
support_constraint_rhs_resolve_
)
{
gmm
::
mat_row
(
d_tmp
,
row_ordering
[
i
]).
swap
(
gmm
::
mat_row
(
rhs_update_table_
.
D_
,
i
));
}
_c_elim
[
i
]
=
elim_temp
[
row_ordering
[
i
]];
}
...
...
cmake/FindGMM.cmake
View file @
a30591d5
...
...
@@ -24,12 +24,14 @@ find_path( GMM_INCLUDE_DIR
/usr/include
/usr/include
/usr/local/include
~/sw/gmm-5.4/include
~/sw/gmm-5.0/include
~/sw/gmm-4.2/include
~/sw/gmm-4.1/include
"c:
\\
libs
\\
gmm-4.2
\\
include"
"c:
\\
libs
\\
gmm-4.1
\\
include"
"c:
\\
libs
\\
gmm-3.0
\\
include"
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/general/gmm-5.4/include"
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/general/gmm-5.0/include"
"
${
CMAKE_WINDOWS_LIBS_DIR
}
/general/gmm-4.2/include"
${
PROJECT_SOURCE_DIR
}
/MacOS/Libs/gmm-3.1/include
...
...
Write
Preview
Markdown
is supported
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