Esempio n. 1
0
 /// Constructor for cloning
 QueenArmies(bool share, QueenArmies& s)
   : MaximizeScript(share,s), n(s.n) {
   U.update(*this, share, s.U);
   W.update(*this, share, s.W);
   w.update(*this, share, s.w);
   b.update(*this, share, s.b);
   q.update(*this, share, s.q);
 }
Esempio n. 2
0
 /// Constructor for cloning e
 CrowdedChess(bool share, CrowdedChess& e)
   : Script(share,e), n(e.n) {
   s.update(*this, share, e.s);
   queens.update(*this, share, e.queens);
   rooks.update(*this, share, e.rooks);
   knights.update(*this, share, e.knights);
 }
Esempio n. 3
0
Ritemset_Stat statMyRegression ( const BoolVarArray &transactions, const vector<float> &labels ) {
  
  /// THIS FUNCTION NEEDS TO COMPUTE STATISTICS FOR AN ITEMSET BASED ON THE TRANSACTIONS
  /// IT COVERS. 
  Ritemset_Stat stat;
  
  // calculate the number and average labels of the (un)covered
  double average_label_covered = 0; 	//average of labels of contained example: m1
  int nb_covered = 0; 			//number of contained examples
  double average_label_uncovered = 0; 	//average of labels of not contained examples: m2
  int nb_uncovered = 0;			//number of not contained examples
  
  /// EXAMPLE OF LOOP THROUGH TRANSACTIONS
  for ( int i = 0; i < transactions.size (); ++i ) {
    if ( transactions[i].one () ) {
		/// DO SOMETHING BASED ON labels[i];
		average_label_covered += labels[i];       
		nb_covered++;   
    }
    else {
        /// transactions[i].zero ()
        /// DO SOMETHING ELSE BASED ON labels[i];
		average_label_uncovered += labels[i];
		nb_uncovered++;
    }
  }
  //calculate the averages
	if( nb_covered != 0) {
		average_label_covered /= nb_covered;
	}

	if (nb_uncovered !=0) {
		 average_label_uncovered /= nb_uncovered;
	}
  
  

  // now calculate the distances for the mean square error calculation
  double error = 0;
  double diff = 0; //temp variable indiciating the difference between m1 or m2 and the example
  for ( int i = 0; i < transactions.size (); ++i ) {
    if ( transactions[i].one () ) {
		diff = (labels[i]-average_label_covered);

    }
    else {
        diff = (labels[i]-average_label_uncovered); //error also takes in account uncovered???
    }
    error += (diff * diff);
  }
  
  /// ASSIGN stat.prediction - the prediction made for this itemset based on the transactions it covers (for instance, the mean of the covered transactions)
  /// ASSIGN stat.tot - the number of transactions covered by this itemset
  /// ASSIGN stat.value - the error measure calculated for this itemset
  
  stat.tot = nb_covered;
  stat.value = error;
  stat.prediction = average_label_covered;

  return stat;
}
Esempio n. 4
0
 /// Constructor for cloning \a s
 OpenShop(bool share, OpenShop& s) : MinimizeScript(share,s), spec(s.spec) {
     b.update(*this, share, s.b);
     makespan.update(*this, share, s.makespan);
     _start.update(*this, share, s._start);
 }
Esempio n. 5
0
 /// Constructor for cloning \a s
 Warehouses(bool share, Warehouses& s) : IntMinimizeScript(share,s) {
   supplier.update(*this, share, s.supplier);
   open.update(*this, share, s.open);
   c_store.update(*this, share, s.c_store);
   c_total.update(*this, share, s.c_total);
 }
Esempio n. 6
0
 /// Constructor for cloning \a s
 MineSweeper(bool share, MineSweeper& s) :
     Script(share,s), spec(s.spec), size(s.size) {
     b.update(*this, share, s.b);
 }
Esempio n. 7
0
 /// Constructor for cloning \a s
 Nonogram(bool share, Nonogram& s) : Script(share,s), spec(s.spec) {
   b.update(*this, share, s.b);
 }
Esempio n. 8
0
 /// Constructor for cloning
 Sat(bool share, Sat& s) : Script(share,s) {
   x.update(*this, share, s.x);
 }
Esempio n. 9
0
 QBFProblem(bool share, QBFProblem& p) : Script(share,p), QSpaceInfo(*this,share,p)
 {
   X.update(*this,share,p.X);
 }
Esempio n. 10
0
 /// Constructor for cloning \a s
 BIBD(bool share, BIBD& s)
   : Script(share,s), opt(s.opt) {
   _p.update(*this,share,s._p);
 }