Exemple #1
0
 void Instance::CreateGlobalProblem() {
     ComputeWeightedBudget();
     for (int i = 0; i < global_problem_.num_partitions_; ++i) {
         // Construct subproblems.
         vector<pair<long double, long double> >* coefficients;
         coefficients = new vector<pair<long double, long double> >();
         vector<int>* advertiser_index = new vector<int>();
         
         // Go through bids matrix and identify all bids for impression i.
         int subproblem_size = 0;
         /*for (int j = 0; j < num_advertisers_; ++j) {
                 if (bids_matrix_[j].find(i) != bids_matrix_[j].end()) {
                     coefficients->push_back(make_pair(bids_matrix_[j].find(i)->second,
                                                            bids_matrix_[j].find(i)->second * weights_[j]));
                 advertiser_index->push_back(j);
                 ++subproblem_size;
             }
         }*/
         
         for (__gnu_cxx::hash_map<int, long double>::iterator iter = transpose_bids_matrix_[i].begin();
              iter != transpose_bids_matrix_[i].end();
              ++iter) {
             coefficients->push_back(make_pair(iter->second,
                                                    weights_[iter->first]));
             advertiser_index->push_back(iter->first);
             ++subproblem_size;
         }
         
         global_problem_.subproblems_.push_back(Subproblem(subproblem_size, coefficients, advertiser_index));
     }
 }
void MapListExtractInner::viewStructure(ostream& ostr) const
{
  EnumertatorProblemView pv(oid(),"Extract inner automorphisms from a list",
			    Text("Extract inner automorphisms from") +
			    Name( theList ) ,
			    helpID("MapListExtractInner",
				   theList.getGroup()),
			    Text("inner auto")
			    );
  
  //  pv.addParameter(EditInteger("minL","Minimal length ",0,1,1,30000));
  // pv.addParameter(EditInteger("maxL","Maximal length ",0,30000,1,30000));
  
  
  pv.addProblem( Subproblem("Sp1",ThisARCSlotID(),
			    Text("For the use of the problem"),40));
  
  //RadioButton rRB1("ToFile","Extract to a file");
  //RadioButton rRB2("ToList","Extract to another list");
    
  // RadioButtonGroup extractRBG("ExtractTo");
  
  //  extractRBG.add(rRB1);
  //  extractRBG.add(rRB2);

  //  pv.addParameter(extractRBG);
 
  submit(ostr, pv);

}
void SMListExtractCommutatorsInFree::viewStructure(ostream& ostr) const
{
  EnumertatorProblemView pv(oid(),"Extract commutators from a list",
			    Text("Extract commutators from ") +
			    Name( theList ) ,
			    helpID("SMListExtractCommutatorsInFree",
				   theList.getGroup()),
			    Text("commut")
			    );
  
  //  RadioButton rRB1("ToFile","Extract to a file");
  //  RadioButton rRB2("ToList","Extract to another list");
  
  //  RadioButtonGroup extractRBG("ExtractTo");
  
  //  extractRBG.add(rRB1);
  //  extractRBG.add(rRB2);
  
  //  pv.addParameter(extractRBG);
  pv.addProblem( Subproblem("Sp1",ThisARCSlotID(),
			    Text("For the use of enumerator"),40));
  
  submit(ostr, pv);

}
void SGListExtractOfRank::viewStructure(ostream& ostr) const
{
  EnumertatorProblemView pv(oid(),"Extract subgroups of a given rank from a list",
			    Text("Extract subgroups of a given rank from ") +
			    Name( theList ) ,
			    helpID("SGListExtractOfRank",
				   theList.getGroup()),
			    Text("rank sgs")
			    );
  
  pv.addParameter(EditInteger("minRank","Minimal rank ",0,0,0,30000));
  pv.addParameter(EditInteger("maxRank","Maximal rank ",0,100,0 ,30000));
  
  
  pv.addProblem( Subproblem("Sp1",ThisARCSlotID(),
			    Text("For the use of the problem"),40));
  
  // RadioButton rRB1("ToFile","Extract to a file");
  // RadioButton rRB2("ToList","Extract to another list");
    
  // RadioButtonGroup extractRBG("ExtractTo");
  
  //    extractRBG.add(rRB1);
  //  extractRBG.add(rRB2);
  
  //  pv.addParameter(extractRBG);
 
  submit(ostr, pv);

}
    void AllocationMW::CreateGlobalProblem() {
        ComputeWeightedBudget();
        for (int i = 0; i < global_problem_.num_partitions_; ++i) {
            // Construct subproblems.
            //vector<pair<long double, long double> >* coefficients = new vector<pair<long double, long double> >();
            //vector<int>* advertiser_index = new vector<int>();
            vector<pair<long double, long double> > coefficients;
            coefficients.reserve((*transpose_bids_matrix_)[i].size());
            vector<int> advertiser_index;
            advertiser_index.reserve((*transpose_bids_matrix_)[i].size());

            
            // Go through bids matrix and identify all bids for impression i.
            int subproblem_size = 0;

            for (int j = 0; j < (*transpose_bids_matrix_)[i].size(); ++j) {
                coefficients.push_back(make_pair((*transpose_bids_matrix_)[i][j].second,
                                                  weights_[(*transpose_bids_matrix_)[i][j].first]));
                advertiser_index.push_back((*transpose_bids_matrix_)[i][j].first);
                ++subproblem_size;
            }

            global_problem_.subproblems_.push_back(Subproblem(subproblem_size, &coefficients, &advertiser_index));
            //(*coefficients).clear();
            //(*advertiser_index).clear();
        }
        (*transpose_bids_matrix_).clear();
        // cout << "Size of global problem object is " << (sizeof(global_problem_) * 4.0) / (1024.0 * 1024.0) << "\n";
    }