Esempio n. 1
0
void
HCComponent::testModel()
{
    trace_msg( modelchecker, 1, "Check component " << *this );
    if( numberOfCalls++ == 0 )
        initDataStructures();    
    
    //The checker will return always unsat
    if( isConflictual )
        return;

    vector< Literal > assumptions;
    computeAssumptions( assumptions );
    //The checker will return always unsat
    if( isConflictual )
        return;
    
    if( unfoundedSetCandidates.empty() )
        return;
    
    checkModel( assumptions );    
    
    clearUnfoundedSetCandidates();        

    assert( !checker.conflictDetected() );
    if( assumptionLiteral != Literal::null )
        checker.addClause( assumptionLiteral.getOppositeLiteral() );
    assert( !checker.conflictDetected() );
    statistics( &checker, endCheckerInvokation( time( 0 ) ) );

    if( solver.exchangeClauses() )
        sendLearnedClausesToSolver();
}
Esempio n. 2
0
void ProjectCentral::check()
{
  m_CheckInfos.clear();

  if (!mp_FXDesc->modelDescriptor().items().empty())
  {
    checkModel();
  }
  else
  {
    m_CheckInfos.part(ProjectCheckInfos::PART_MODELDEF).updateStatus(PRJ_ERROR);
    m_CheckInfos.part(ProjectCheckInfos::PART_MODELDEF).addMessage(tr("Model is empty"));
  }

  checkSpatialDomain();

  checkDatastore();

  if (!mp_FXDesc->monitoringDescriptor().items().empty())
  {
    checkMonitoring();
  }
  else
  {
    m_CheckInfos.part(ProjectCheckInfos::PART_MONITORING).updateStatus(PRJ_WARNING);
    m_CheckInfos.part(ProjectCheckInfos::PART_MONITORING).addMessage(tr("Monitoring is empty"));
  }

  checkRunConfig();
}
void CFixLocalReactionParameters::fixModel(CModel * pModel)
{
  if (pModel == NULL) return;

  mpModel = pModel;
  checkModel();

  if (mChanges.size() == 0) return;

  changeModel();
}
void UHMM3BuildDialogImpl::sl_buildButtonClicked() {
    getModelValues();
    QString err = checkModel();
    if( !err.isEmpty() ) {
        QMessageBox::critical( this, tr( "Error: bad arguments!" ), err );
        return;
    }
    
    Task * buildTask = NULL;
    if( model.alignmentUsing ) {
        buildTask = new UHMM3BuildToFileTask( model.buildSettings, model.alignment );
    } else {
        buildTask = new UHMM3BuildToFileTask( model.buildSettings, model.inputFile );
    }
    assert( NULL != buildTask );
    
    AppContext::getTaskScheduler()->registerTopLevelTask( buildTask );
    QDialog::accept();
}
Esempio n. 5
0
void HmmerSearchDialog::sl_okButtonClicked() {
    bool objectPrepared = annotationsWidgetController->prepareAnnotationObject();
    if (!objectPrepared) {
        QMessageBox::warning(this, tr("Error"), tr("Cannot create an annotation object. Please check settings"));
        return;
    }

    SAFE_POINT(!model.sequence.isNull(), L10N::nullPointerError("sequence object"), );
    getModelValues();
    QString err = checkModel();
    if (!err.isEmpty()) {
        QMessageBox::critical(this, tr("Error: bad arguments!"), err);
        return;
    }
    if(seqCtx != NULL){
        seqCtx->getAnnotatedDNAView()->tryAddObject(annotationsWidgetController->getModel().getAnnotationObject());
    }

    HmmerSearchTask *searchTask = new HmmerSearchTask(model.searchSettings);
    AppContext::getTaskScheduler()->registerTopLevelTask(searchTask);

    QDialog::accept();
}
Esempio n. 6
0
CModelAnalyzer::CModelAnalyzer(const CModel* model)
{
  checkModel(model);
}
Esempio n. 7
0
// ##### getOctree() #################################################
IndexOct* OctGen::getOctree(Hight maxTreeHight)
    throw (NotEnoughMemoryException*, WrongModelException*) {
  unsigned borderNodes, sumNodes, leafs, innerNodes, normcells;

  checkModel();
  Timer timer;
  octree= new IndexOct(maxTreeHight);
  genHelp= new GenHelp(maxTreeHight,
		       cadModel->getMinPoint(),
		       cadModel->getMaxPoint());

  cerr << "Extrahiere Spline-Flächen ..." << endl;
  timer.reset();
  
#ifdef CLASSIC_MODE
  cerr << "Erzeugen des Oktalbaums ..." << endl; 
  NodeIndex idx= NodeIndex(0, 0, 0, octree->getMaxTreeHight());
  generateClassic(idx);
  cout << endl;
  timer.print(); cout << " benötigt." << endl;  
#else // !CLASSIC_MODE
  cerr << "Einfügen der Oberflächen ..." << endl;
  unsigned maxCount= cadModel->count() - 1;
  cout << " [Nr] " <<  maxCount + 1 << endl;
  cadModel->first();
  while (cadModel->hasObject()) {
    Element obj= cadModel->getObject();
    assert (obj != NULL);
    addObject(obj, cadModel->getObjColor());
    cadModel->next();
  }
  timer.print(); cout << " benötigt." << endl;  

#ifdef FILL_SOLIDS
  octree->stat(octree->getMaxTreeHight(), 
	       sumNodes, leafs, innerNodes, borderNodes, normcells);
  cout << "#Knoten=" << formatLarge(sumNodes) 
       << ", #Blätter=" << formatLarge(leafs)
       << ", #innere Kn.=" << formatLarge(innerNodes) << endl;
  cout << "#Randknoten=" << formatLarge(borderNodes) 
       << ", #Normzellen=" << formatLarge(normcells) << endl;
  cout << "Filling...         " << endl;
  timer.reset();
  FillOct(*octree).fill(this);
  timer.print(); cout << " benötigt." << endl;
#endif // FILL_SOLIDS

#endif // !CLASSIC_MODE
  delete genHelp;
  octree->stat(octree->getMaxTreeHight(), 
	       sumNodes, leafs, innerNodes, borderNodes, normcells);
  cout << "#Knoten=" << formatLarge(sumNodes) 
       << ", #Blätter=" << formatLarge(leafs)
       << ", #innere Kn.=" << formatLarge(innerNodes) << endl;
  cout << "#Randknoten=" << formatLarge(borderNodes) 
       << ", #Normzellen=" << formatLarge(normcells) << endl;
  timer.reset();
  cout << "Flushing..." << endl;
  octree->flush();

  timer.print(); cout << " benötigt." << endl;
  octree->stat(octree->getMaxTreeHight(), 
	       sumNodes, leafs, innerNodes, borderNodes, normcells);
  cout << "#Knoten=" << formatLarge(sumNodes) 
       << ", #Blätter=" << formatLarge(leafs)
       << ", #innere Kn.=" << formatLarge(innerNodes) << endl;
  cout << "#Randknoten=" << formatLarge(borderNodes) 
       << ", #Normzellen=" << formatLarge(normcells) << endl;
  return octree;
}
Esempio n. 8
0
    static void compute(Mat A, Mat B, int n, Mat& Rotation, Mat& Translation, bool& RT_flag){
        vector<int> newvec;
        vector<float> Ratio, inliers_num;
        vector<Mat> R_models , t_models;
        int rows =A.rows;
        float threshold=0.1;
        RT_flag = true;


        //generate n models
        for(int Round = 0; Round<n; Round++){
            int inliers_count=0;
            //randomly select 4 pairs of points and estimate the model
            newvec=shuffle(int(A.rows));
            //cout<<"NWVEC  "<<newvec[0]<<" "<<newvec[1]<<" " <<newvec[2] << " " <<newvec[3]<<endl;
            int select = 4;
//            if (rows > 4)
//                select = 2*rows /3;

            Mat points_curr,points_prev;
            for (int j=0; j<select; ++j){
                int index = newvec[j];
                //cout<<"index" << index<<endl;
                points_prev.push_back(B.row(index));
                points_curr.push_back(A.row(index));
            }
            //cout<<"points_prev  \n"<<points_prev<<endl;
            //cout<<"points_curr  \n"<<points_curr<<endl;


            //model estimation
            Mat R,t;
            poseEstimate::poseestimate::compute(points_curr.t(),points_prev.t(),R,t);
            //model generation done
            //use the generated model to test all the samples to count outliers and inliers
            for (int i=0 ; i<rows; ++i){
                Mat point_p = B.row(i);
                Mat point_c = A.row(i);
                float error;

                checkModel(point_p.t(),point_c.t(),R,t,error);
                //cout<<" ---ERROR--> "<<error;

                // if error is less than threshold inliers_count++
                if (error < threshold){
                    inliers_count +=1;

                }
            }
            //save Ratio, R and t
            float ratio=inliers_count*1.0/rows;
            Ratio.push_back(ratio);
            inliers_num.push_back(inliers_count);
            R_models.push_back(R);
            t_models.push_back(t);
        }
        //ROS_INFO("%d many models created, select best one!",n);
        int index=0;
        float max=0.0;
        for (int i=0; i<n; i++){
            if (max < Ratio[i]){
                max = Ratio[i];
                index = i;
            }
        }
        cout<<"best fit model has a ratio = "<<max<<endl;
        //best model
        float t_limit = 6.0;
        float R_limit = 0.1;

        if (max == 0){
            RT_flag = false;
            Rotation = R_models[index];
            Translation = t_models[index];
            cout<< "estimated t_limit "<<Translation.dot(Translation)<<endl;
            cout<< "estimated R_limit "<<determinant(Rotation)<<endl;
            cout<<"MAX = 0!!!"<<endl;

        } else if (inliers_num[index] >= 4) {
            //Select inlier points according to the best model and then generate an accurate model using all inlier points
            Mat inlierA, inlierB;
            for (int i=0 ; i<rows; ++i){
                Mat point_p = B.row(i);
                Mat point_c = A.row(i);
                float error;

                checkModel(point_p.t(),point_c.t(),R_models[index],t_models[index],error);
                //cout<<" ---ERROR--> "<<error;

                // if error is less than threshold inliers_count++
                if (error < threshold){
                    inlierA.push_back(point_c);
                    inlierB.push_back(point_p);
                }
            }
            poseEstimate::poseestimate::compute(inlierA.t(),inlierB.t(),Rotation,Translation);
        } else{
            Rotation = R_models[index];
            Translation = t_models[index];
        }

        if(Translation.dot(Translation) > t_limit || abs( determinant(Rotation) ) < R_limit){
            RT_flag = false;
            cout<< "estimated t_limit "<<Translation.dot(Translation)<<endl;
            cout<< "estimated R_limit "<<determinant(Rotation)<<endl;

        }
    }