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

Several Changes -> Version 2

- corrected residual norm to coincide between GS and CG
- fill-in minimizing reordering of constraints
- faster matrix update while rounding
- multiple rounding (up to threshold)
- several minor improvements

git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@42 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent a1dba865
......@@ -61,10 +61,12 @@ get_parameters()
// QSpinBox *infoSB;
// QCheckBox *directRoundingCB;
initialFullCB ->setChecked( misolver_.get_inital_full());
finalFullCB ->setChecked( misolver_.get_final_full());
directRoundingCB->setChecked( misolver_.get_direct_rounding());
noRoundingCB ->setChecked( misolver_.get_no_rounding());
initialFullCB ->setChecked( misolver_.get_inital_full());
iterFullCB ->setChecked( misolver_.get_iter_full());
finalFullCB ->setChecked( misolver_.get_final_full());
directRoundingCB ->setChecked( misolver_.get_direct_rounding());
noRoundingCB ->setChecked( misolver_.get_no_rounding());
multipleRoundingCB->setChecked( misolver_.get_multiple_rounding());
localItersSB ->setValue( misolver_.get_local_iters());
localErrorDSB->setValue( log(misolver_.get_local_error())/log(10.0f));
......@@ -72,7 +74,7 @@ get_parameters()
cgItersSB ->setValue( misolver_.get_cg_iters());
cgErrorDSB->setValue( log(misolver_.get_cg_error())/log(10.0f));
fullErrorDSB->setValue( log(misolver_.get_full_error())/log(10.0f));
multipleRoundingDSB->setValue( misolver_.get_multiple_rounding_threshold());
infoSB->setValue( misolver_.get_noise());
solverStatsCheckBox->setChecked( misolver_.get_stats( ));
......@@ -87,9 +89,11 @@ MISolverDialog::
set_parameters()
{
misolver_.set_inital_full ( initialFullCB ->isChecked() );
misolver_.set_iter_full ( iterFullCB ->isChecked() );
misolver_.set_final_full ( finalFullCB ->isChecked() );
misolver_.set_direct_rounding( directRoundingCB->isChecked());
misolver_.set_no_rounding( noRoundingCB->isChecked());
misolver_.set_multiple_rounding( multipleRoundingCB->isChecked());
misolver_.set_local_iters( localItersSB ->value());
misolver_.set_local_error( pow(10, localErrorDSB->value()));
......@@ -97,7 +101,7 @@ set_parameters()
misolver_.set_cg_iters( cgItersSB ->value());
misolver_.set_cg_error( pow(10, cgErrorDSB->value()));
misolver_.set_full_error( pow(10, fullErrorDSB->value()));
misolver_.set_multiple_rounding_threshold( multipleRoundingDSB->value());
misolver_.set_noise( infoSB->value());
misolver_.set_stats( solverStatsCheckBox->isChecked());
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtMISolverDialogBaseUI</class>
<widget class="QDialog" name="QtMISolverDialogBaseUI" >
<property name="windowModality" >
<widget class="QDialog" name="QtMISolverDialogBaseUI">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry" >
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>406</width>
<height>225</height>
<width>353</width>
<height>220</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="1" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Max Error (1e-x)</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Iterations</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Local</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="localErrorDSB" >
<property name="decimals" >
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="localErrorDSB">
<property name="decimals">
<number>2</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>-1000000000.000000000000000</double>
</property>
<property name="maximum" >
<property name="maximum">
<double>1000000000.000000000000000</double>
</property>
<property name="value" >
<property name="value">
<double>6.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3" >
<widget class="QSpinBox" name="localItersSB" >
<property name="maximum" >
<item row="1" column="2">
<widget class="QSpinBox" name="localItersSB">
<property name="maximum">
<number>1000000000</number>
</property>
<property name="value" >
<property name="value">
<number>10000</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>CG</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QDoubleSpinBox" name="cgErrorDSB" >
<property name="decimals" >
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="cgErrorDSB">
<property name="decimals">
<number>2</number>
</property>
<property name="minimum" >
<property name="minimum">
<double>-1000000000.000000000000000</double>
</property>
<property name="maximum" >
<property name="maximum">
<double>1000000000.000000000000000</double>
</property>
<property name="value" >
<property name="value">
<double>6.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2" colspan="3" >
<widget class="QSpinBox" name="cgItersSB" >
<property name="maximum" >
<item row="2" column="2">
<widget class="QSpinBox" name="cgItersSB">
<property name="maximum">
<number>1000000000</number>
</property>
<property name="value" >
<property name="value">
<number>20</number>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_7" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Full</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QDoubleSpinBox" name="fullErrorDSB" >
<property name="decimals" >
<number>2</number>
</property>
<property name="minimum" >
<double>-1000000000.000000000000000</double>
</property>
<property name="maximum" >
<double>1000000000.000000000000000</double>
</property>
<property name="value" >
<double>2.000000000000000</double>
<item row="3" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="initialFullCB">
<property name="text">
<string>initial</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="iterFullCB">
<property name="text">
<string>iter not converged</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="finalFullCB">
<property name="text">
<string>final</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Rounding</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item row="4" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="finalFullCB" >
<property name="text" >
<string>final</string>
<widget class="QCheckBox" name="directRoundingCB">
<property name="text">
<string>direct</string>
</property>
<property name="checked" >
<bool>false</bool>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noRoundingCB">
<property name="text">
<string>no</string>
</property>
<property name="tristate" >
<bool>false</bool>
</widget>
</item>
<item>
<widget class="QCheckBox" name="multipleRoundingCB">
<property name="text">
<string>multiple</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="initialFullCB" >
<property name="text" >
<string>initial</string>
<widget class="QDoubleSpinBox" name="multipleRoundingDSB">
<property name="decimals">
<number>2</number>
</property>
<property name="checked" >
<bool>true</bool>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>0.500000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Info Level</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QSpinBox" name="infoSB" />
</item>
<item row="4" column="2" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Rounding</string>
</property>
</widget>
</item>
<item row="4" column="3" >
<widget class="QCheckBox" name="directRoundingCB" >
<property name="text" >
<string>direct</string>
</property>
</widget>
</item>
<item row="4" column="4" >
<widget class="QCheckBox" name="noRoundingCB" >
<property name="text" >
<string>XnoX</string>
</property>
</widget>
<item row="5" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSpinBox" name="infoSB"/>
</item>
<item>
<widget class="QCheckBox" name="solverStatsCheckBox">
<property name="text">
<string>Output solver statistics</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="okPB" >
<property name="text" >
<widget class="QPushButton" name="okPB">
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelPB" >
<property name="text" >
<widget class="QPushButton" name="cancelPB">
<property name="text">
<string>Cancel</string>
</property>
</widget>
......@@ -224,18 +257,11 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="solverStatsCheckBox" >
<property name="text" >
<string>Output solver statistics</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>14</height>
......
......@@ -37,6 +37,18 @@ CholmodSolver::CholmodSolver()
cholmod_start( mp_cholmodCommon );
mp_L = 0;
show_timings_ = false;
mp_cholmodCommon->nmethods = 1;
// use AMD ordering
mp_cholmodCommon->method[0].ordering = CHOLMOD_AMD ;
// use METIS ordering
// mp_cholmodCommon->method[0].ordering = CHOLMOD_METIS ;
// try all methods
// mp_cholmodCommon->nmethods = 9;
}
......@@ -63,6 +75,8 @@ bool CholmodSolver::calc_system( const std::vector<int>& _colptr,
const std::vector<int>& _rowind,
const std::vector<double>& _values)
{
if(show_timings_) sw_.start();
colptr_ = _colptr;
rowind_ = _rowind;
values_ = _values;
......@@ -81,7 +95,8 @@ bool CholmodSolver::calc_system( const std::vector<int>& _colptr,
matA.nz = 0;
matA.z = 0;
matA.stype = -1;
// matA.stype = -1;
matA.stype = 1;
matA.itype = CHOLMOD_INT;
matA.xtype = CHOLMOD_REAL;
matA.dtype = CHOLMOD_DOUBLE;
......@@ -95,6 +110,11 @@ bool CholmodSolver::calc_system( const std::vector<int>& _colptr,
mp_L = 0;
}
if(show_timings_)
{
std::cerr << " Cholmod Timing cleanup: " << sw_.stop()/1000.0 << "s\n";
sw_.start();
}
if( !(mp_L = cholmod_analyze( &matA, mp_cholmodCommon )) )
{
......@@ -102,12 +122,28 @@ bool CholmodSolver::calc_system( const std::vector<int>& _colptr,
return false;
}
// // show selected ordering method
// std::cerr << "best ordering was: " << mp_cholmodCommon->selected << std::endl;
// std::cerr << "current ordering was: " << mp_cholmodCommon->current << std::endl;
if(show_timings_)
{
std::cerr << " Cholmod Timing analyze: " << sw_.stop()/1000.0 << "s\n";
sw_.start();
}
if( !cholmod_factorize( &matA, mp_L, mp_cholmodCommon ) )
{
std::cout << "cholmod_factorize failed" << std::endl;
return false;
}
if(show_timings_)
{
std::cerr << " Cholmod Timing factorize: " << sw_.stop()/1000.0 << "s\n";
sw_.start();
}
return true;
}
......@@ -140,7 +176,8 @@ bool CholmodSolver::update_system( const std::vector<int>& _colptr,
matA.nz = 0;
matA.z = 0;
matA.stype = -1;
// matA.stype = -1;
matA.stype = 1;
matA.itype = CHOLMOD_INT;
matA.xtype = CHOLMOD_REAL;
matA.dtype = CHOLMOD_DOUBLE;
......
......@@ -37,7 +37,7 @@
#include <CoMISo/Config/CoMISoDefines.hh>
#include "GMM_Tools.hh"
#include <CoMISo/Utils/StopWatch.hh>
#include <iostream>
#include <vector>
......@@ -82,6 +82,8 @@ public:
bool solve ( std::vector<double>& _x0, std::vector<double>& _b)
{return solve( &(_x0[0]), &(_b[0]));}
bool& show_timings() { return show_timings_;}
private:
......@@ -93,6 +95,8 @@ private:
std::vector<int> colptr_;
std::vector<int> rowind_;
bool show_timings_;
StopWatch sw_;
};
//=============================================================================
......
......@@ -26,7 +26,8 @@
#define COMISO_CHOLMOD_SOLVER_TEMPLATES_C
#include "CholmodSolver.hh"
#include <CoMISo/Solver/GMM_Tools.hh>
#include <CoMISo/Solver/CholmodSolver.hh>
namespace COMISO {
......@@ -39,11 +40,20 @@ bool CholmodSolver::calc_system_gmm( const GMM_MatrixT& _mat)
// std::vector<int> rowind;
// std::vector<double> values;
gmm::get_ccs_symmetric_data( _mat,
'l',
values_,
rowind_,
colptr_ );
if(show_timings_) sw_.start();
COMISO_GMM::get_ccs_symmetric_data( _mat,
'u',
values_,
rowind_,
colptr_ );
if(show_timings_)
{
std::cerr << "Cholmod Timing GMM convert: " << sw_.stop()/1000.0 << "s\n";
std::cerr << "#nnz: " << values_.size() << std::endl;
}
return calc_system( colptr_, rowind_, values_);
}
......@@ -59,13 +69,13 @@ bool CholmodSolver::update_system_gmm( const GMM_MatrixT& _mat)
// std::vector<int> rowind;
// std::vector<double> values;
gmm::get_ccs_symmetric_data( _mat,
'l',
values_,
rowind_,
colptr_ );
COMISO_GMM::get_ccs_symmetric_data( _mat,
'u',
values_,
rowind_,
colptr_ );
return update_system( colptr_, rowind_, values_);
return update_system( colptr_, rowind_, values_);
}
......
......@@ -64,7 +64,7 @@ public:
/// default Constructor
/** _do_gcd specifies if a greatest common devisor correction should be used when no (+-)1-coefficient is found*/
ConstrainedSolver( bool _do_gcd = true): do_gcd_(_do_gcd)
{ epsilon_ = 1e-8; epsilon_squared_ = 1e-16; noisy_ = 1; }