Logo Search packages:      
Sourcecode: inkscape version File versions

void vpsc::Solver::satisfy (  )  [virtual]

Produces a feasible - though not necessarily optimal - solution by examining blocks in the partial order defined by the directed acyclic graph of constraints. For each block (when processing left to right) we maintain the invariant that all constraints to the left of the block (incoming constraints) are satisfied. This is done by repeatedly merging blocks into bigger blocks across violated constraints (most violated first) fixing the position of variables inside blocks relative to one another so that constraints internal to the block are satisfied.

Definition at line 72 of file solve_VPSC.cpp.

References vpsc::Blocks::cleanup(), vpsc::Blocks::mergeLeft(), and vpsc::Blocks::totalOrder().

Referenced by solve().

                     {
      list<Variable*> *vs=bs->totalOrder();
      for(list<Variable*>::iterator i=vs->begin();i!=vs->end();++i) {
            Variable *v=*i;
            if(!v->block->deleted) {
                  bs->mergeLeft(v->block);
            }
      }
      bs->cleanup();
      for(unsigned i=0;i<m;i++) {
            if(cs[i]->slack() < ZERO_UPPERBOUND) {
#ifdef RECTANGLE_OVERLAP_LOGGING
                  ofstream f(LOGFILE,ios::app);
                  f<<"Error: Unsatisfied constraint: "<<*cs[i]<<endl;
#endif
                  //assert(cs[i]->slack()>-0.0000001);
                  throw "Unsatisfied constraint";
            }
      }
      delete vs;
}


Generated by  Doxygen 1.6.0   Back to index