コード例 #1
0
int main() {
  Polyhedron<true> p;
 
  vector<Inequality*> eqs;
  eqs.push_back(new Inequality(-34,55,1));
  Interval<true> xBound;
  xBound.updateUpper(0);
  Interval<true> yBound;
  p.addInequalitySet(xBound, yBound, eqs);
  //cout << "before:\n" << p
  //     << "x in " << xBound << ", y in " << yBound << endl;

  bool correct=p.getNoOfInequalities()==2;

  // Return 1 on error.
  return !correct;
};
コード例 #2
0
int main(int argc) {
  bool chat = argc>1;
  Polyhedron<true> p;
 
  vector<Inequality*> eqs;
  eqs.push_back(new Inequality(-4079,4080,4080));
  eqs.push_back(new Inequality(4079,-4080,-4080));
  Interval<true> xBound;
  Interval<true> yBound;
  xBound.updateLower(2041);
  xBound.updateUpper(4080);
  yBound.updateLower(2041);
  yBound.updateUpper(4080);
  p.addInequalitySet(xBound, yBound, eqs);
  if (chat) cout << "result:\n" << p
		 << "x in " << xBound << ", y in " << yBound << endl;

  // The inequalities only have a single integral point as solution.
  bool correct=!xBound.updateLower(4080) && !xBound.updateUpper(4080);

  // Return 1 on error.
  return !correct;
};