Commit afdedb99 authored by David Bommes's avatar David Bommes
Browse files

added possibility to disable constraint reordering

git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@46 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent 309e5f4e
......@@ -78,6 +78,8 @@ get_parameters()
infoSB->setValue( misolver_.get_noise());
solverStatsCheckBox->setChecked( misolver_.get_stats( ));
use_reordering_cb->setChecked( misolver_.use_constraint_reordering() );
}
......@@ -105,6 +107,8 @@ set_parameters()
misolver_.set_noise( infoSB->value());
misolver_.set_stats( solverStatsCheckBox->isChecked());
misolver_.use_constraint_reordering() = use_reordering_cb->isChecked();
}
......
......@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>353</width>
<height>220</height>
<width>363</width>
<height>259</height>
</rect>
</property>
<property name="windowTitle">
......@@ -236,6 +236,23 @@
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Constraints</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="use_reordering_cb">
<property name="text">
<string>reordering</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
......@@ -241,6 +241,9 @@ 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;}
// Get/Set whether the constraint reordering is used (default true)
bool& use_constraint_reordering() { return miso_.use_constraint_reordering(); }
/** @name Verify the result.
* Functions to verify the result of the constrained solver. Are the constraints met, are the correct variables correctly rounded ...
*/
......
......@@ -209,11 +209,17 @@ solve(
bool _show_miso_settings,
bool _show_timings )
{
// show options dialog
if( _show_miso_settings)
miso_.show_options_dialog();
int nrows = gmm::mat_nrows(_A);
int ncols = gmm::mat_ncols(_A);
int ncons = gmm::mat_nrows(_constraints);
if( _show_timings) std::cerr << __FUNCTION__ << "\n Initital dimension: " << nrows << " x " << ncols << ", number of constraints: " << ncons << std::endl;
if( _show_timings) std::cerr << __FUNCTION__ << "\n Initital dimension: " << nrows << " x " << ncols
<< ", number of constraints: " << ncons << " use reordering: " << use_constraint_reordering() << std::endl;
// StopWatch for Timings
COMISO::StopWatch sw, sw2; sw.start(); sw2.start();
......@@ -223,8 +229,11 @@ solve(
std::vector<int> c_elim( ncons);
// apply sparse gauss elimination to make subsequent _conditions independent
//make_constraints_independent( _constraints, _idx_to_round, c_elim);
make_constraints_independent_reordering( _constraints, _idx_to_round, c_elim);
if(use_constraint_reordering())
make_constraints_independent_reordering( _constraints, _idx_to_round, c_elim);
else
make_constraints_independent( _constraints, _idx_to_round, c_elim);
double time_gauss = sw.stop()/1000.0; sw.start();
// re-indexing vector
......@@ -240,10 +249,6 @@ solve(
std::cerr << "#nonzeros: " << gmm::nnz(Acsc) << std::endl;
}
// show options dialog
if( _show_miso_settings)
miso_.show_options_dialog();
sw.start();
miso_.solve( Acsc, _x, _rhs, _idx_to_round);
double time_miso = sw.stop()/1000.0; sw.start();
......@@ -1000,6 +1005,10 @@ setup_and_solve_system( CMatrixT& _B,
double _reg_factor,
bool _show_miso_settings)
{
// show options dialog
if( _show_miso_settings)
miso_.show_options_dialog();
COMISO::StopWatch s1;
COMISO::StopWatch sw; sw.start();
unsigned int m = gmm::mat_nrows(_B);
......@@ -1054,9 +1063,6 @@ setup_and_solve_system( CMatrixT& _B,
std::cerr << __FUNCTION__ << " CSC init " << s1.stop()/1000.0 << std::endl;
double setup_time = sw.stop()/1000.0;
// show options dialog
if( _show_miso_settings)
miso_.show_options_dialog();
COMISO::StopWatch misw;
misw.start();
......
......@@ -65,6 +65,8 @@ MISolver::MISolver()
noisy_ = 0;
stats_ = true;
use_constraint_reordering_ = true;
}
......
......@@ -196,6 +196,9 @@ public:
bool get_stats( ) { return stats_; }
/*@}*/
/// Set/Get use_constraint_reordering for constraint solver (default = true)
bool& use_constraint_reordering() { return use_constraint_reordering_;}
private:
// find set of variables for simultaneous rounding
......@@ -328,6 +331,8 @@ private:
unsigned int n_cg_;
unsigned int n_full_;
bool use_constraint_reordering_;
friend class COMISO::MISolverDialog;
};
......
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