当前位置: 首页>>代码示例>>C++>>正文


C++ base类代码示例

本文整理汇总了C++中base的典型用法代码示例。如果您正苦于以下问题:C++ base类的具体用法?C++ base怎么用?C++ base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transform

 //////////////////////////////////////////////////////////////////////
 // Basic operations
 self_ptr transform(const transformation& t) const {
   self_ptr new_paths(new self());
   new_paths->reserve(size());
   for (typename base::const_iterator i = begin(); i != end(); ++i)
     new_paths->push_back((*i)->transform(t));
   return new_paths;
 }
开发者ID:elaboris,项目名称:gamera,代码行数:9,代码来源:pathlist.hpp

示例2: base

/**
 * Constructor of antibodies meta-problem
 *
 * Note: This problem is not intended to be used by itself. Instead use the
 * cstrs_immune_system algorithm if you want to solve constrained problems.
 *
 * @param[in] problem base::problem to be used to set up the boundaries
 * @param[in] method method_type to used for the distance computation.
 * Two posssibililties are available: HAMMING, EUCLIDEAN.
 */
antibodies_problem::antibodies_problem(const base &problem, const algorithm::cstrs_immune_system::distance_method_type method):
	base((int)problem.get_dimension(),
		 problem.get_i_dimension(),
		 problem.get_f_dimension(),
		 0,
		 0,
		 0.),
	m_original_problem(problem.clone()),
	m_pop_antigens(),
	m_method(method)
{
	if(m_original_problem->get_c_dimension() <= 0){
		pagmo_throw(value_error,"The original problem has no constraints.");
	}

	// check that the dimension of the problem is 1
	if(m_original_problem->get_f_dimension() != 1) {
		pagmo_throw(value_error,"The original fitness dimension of the problem must be one, multi objective problems can't be handled with co-evolution meta problem.");
	}

	// encoding for hamming distance
	m_bit_encoding = 25;
	m_max_encoding_integer = int(std::pow(2., m_bit_encoding));

	set_bounds(m_original_problem->get_lb(),m_original_problem->get_ub());
}
开发者ID:YS-L,项目名称:pagmo,代码行数:36,代码来源:antibodies_problem.cpp

示例3: modify_edge

 /** pass through */ 
 void modify_edge(base* parent, edge_id_t e) {
   vertex_id_t v = g->target(e);
   locks[v].lock();  
   if (basicselector == false) {
     bool t = test_vertex(v);
     bool hasv = has_vertex(v);
     if (hasv && !t) {
       // if test fails, and we currently have the vertex, this is
       // a deletion
       vset[v] = 0;
       numv.dec();
       trigger_all_erase(v);
     } else if (!hasv && t) {
       // if test succeeds, and we currently do not have the vertex,
       // this is an insertion
       vset[v] = 1;
       numv.inc();
       trigger_all_insert(v);
     }
     if (t) trigger_all_modify_edge(e);
   }
   else {
     if (has_vertex(v)) trigger_all_modify_edge(e);
   }
   locks[v].unlock();  
 }
开发者ID:ekoontz,项目名称:graphlab,代码行数:27,代码来源:restricted_vertex_set.hpp

示例4: add_to

void unipoly::add_to(base &x, base &y)
{
	unipoly& px = x.as_unipoly();
	unipoly py;
	base a;
	INT d1, d2, d3, i;
	
	if (s_kind() != UNIPOLY) {
		cout << "unipoly::add_to() this not a unipoly\n";
		exit(1);
		}
	if (x.s_kind() != UNIPOLY) {
		cout << "unipoly::add_to() x is not a unipoly\n";
		exit(1);
		}
	d1 = degree();
	d2 = px.degree();
	d3 = MAXIMUM(d1, d2);
	
	py.m_l(d3 + 1);
	a = s_i(0);
	a.zero();
	for (i = 0; i <= d1; i++) {
		py[i] = s_i(i);
		}
	for (; i <= d3; i++) {
		py[i] = a;
		}
	for (i = 0; i <= d2; i++) {
		py[i] += px.s_i(i);
		}
	py.swap(y);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:33,代码来源:unipoly.C

示例5: mult_to

void unipoly::mult_to(base &x, base &y)
{
	unipoly& px = x.as_unipoly();
	unipoly py;
	base a;
	INT d1, d2, d3, i, j, k;
	
	if (s_kind() != UNIPOLY) {
		cout << "unipoly::mult_to() this not a unipoly\n";
		exit(1);
		}
	if (x.s_kind() != UNIPOLY) {
		cout << "unipoly::mult_to() x is not a unipoly\n";
		exit(1);
		}
	d1 = degree();
	d2 = px.degree();
	d3 = d1 + d2;
	
	py.m_l(d3 + 1);
	a = s_i(0);
	a.zero();
	for (i = 0; i <= d3; i++) {
		py[i] = a;
		}
	for (i = 0; i <= d1; i++) {
		for (j = 0; j <= d2; j++) {
			k = i + j;
			a.mult(s_i(i), px.s_i(j));
			py[k] += a;
			}
		}
	py.swap(y);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:34,代码来源:unipoly.C

示例6: base_meta

/**
 * Constructor using initial constrained problem
 *
 * @param[in] problem base::problem to be modified to use a constrained to
 * multi-objective handling technique.
 * @param[in] method method_type to be modified to use a single constrained
 * to multi-objective approach defined with OBJ_CSTRS, OBJ_CSTRSVIO or OBJ_EQVIO_INEQVIO
 *
 */
con2mo::con2mo(const base &problem, const method_type method):
		base_meta(
		 problem,
		 problem.get_dimension(),
		 problem.get_i_dimension(),
		 __mo_dimension__(problem, method),
		 0,
		 0,
		 std::vector<double>()),
	m_method(method)
{}
开发者ID:DinCahill,项目名称:pagmo,代码行数:20,代码来源:con2mo.cpp

示例7: copyobject_to

void hollerith::copyobject_to(base &x)
{
#ifdef HOLLERITH_COPY_VERBOSE
	cout << "in hollerith::copyobject_to()\n";
#endif
	x.freeself();
	hollerith & xx = x.change_to_hollerith();
	if (s() == NULL)
		return;
	xx.init(s());
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:11,代码来源:hollerith.C

示例8: copyobject_to

void number_partition::copyobject_to(base &x)
{
#ifdef PARTITION_COPY_VERBOSE
	cout << "number_partition::copyobject_to()\n";
	print_as_vector(cout);
#endif
	Vector::copyobject_to(x);
	x.as_number_partition().settype_number_partition();
#ifdef PARTITION_COPY_VERBOSE
	x.as_number_partition().print_as_vector(cout);
#endif
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:number_partition.C

示例9: normalize

void unipoly::normalize(base &p)
{
	if (p.s_kind() != UNIPOLY) {
		cout << "unipoly::normalize() p not an UNIPOLY" << endl;
		exit(1);
		}
	unipoly p1 = p.as_unipoly();
	unipoly q, r;
	
	integral_division(p1, q, r, 0); 
	swap(r);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:unipoly.C

示例10: copyobject_to

void unipoly::copyobject_to(base &x)
{
#ifdef COPY_VERBOSE
	cout << "unipoly::copyobject_to()\n";
	print_as_vector(cout);
#endif
	Vector::copyobject_to(x);
	x.as_unipoly().settype_unipoly();
#ifdef COPY_VERBOSE
	x.as_unipoly().print_as_vector(cout);
#endif
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:unipoly.C

示例11: compare_with

INT hollerith::compare_with(base &a)
{
	BYTE *p1, *p2;
	
	if (a.s_kind() != HOLLERITH) {
		cout << "hollerith::compare_with() a is not a hollerith object" << endl;
		exit(1);
		}
	p1 = s();
	p2 = a.as_hollerith().s();
	return strcmp(p1, p2);
}
开发者ID:SALAM2016,项目名称:orbiter,代码行数:12,代码来源:hollerith.C

示例12: make_record_iterator

 typename vector_assignment_dataset<LA>::record_iterator_type
 vector_assignment_dataset<LA>::begin() const {
   if (nrecords > 0)
     return make_record_iterator(0, &(finite_data[0]), &(vector_data[0]));
   else
     return make_record_iterator(0);
 }
开发者ID:vdeepak13,项目名称:sill,代码行数:7,代码来源:vector_assignment_dataset.hpp

示例13: main

int main(int argc, char* argv[]) {
  // Even if using just client calls, we set up a service. Client calls
  // will use the service's io_manager and use it to collect stats
  // automatically.
  ServiceManager service(8 /* num_workers */);
  HTTPService http_service(15000, &service);

  // Open and "fire" N parallel clients.
  const int parallel = 32;
  Client clients[parallel];
  for (int i=0; i<parallel; ++i) {
    ConnectCallback* connect_cb = makeCallableOnce(&Client::start, &clients[i]);
    http_service.asyncConnect("127.0.0.1", 15001, connect_cb);
  }

  // Launch a progress meter in the background. If things hang, let
  // the meter kill this process.
  ProgressMeter meter(&service);
  Callback<void>* progress_cb = makeCallableOnce(&ProgressMeter::check, &meter);
  IOManager* io_manager = service.io_manager();
  io_manager->addTimer(1.0 /*sec*/ , progress_cb);

  // We'd need a '/quit' request to break out of the server.
  // TODO have SIGINT break out nicely as well.
  service.run();

  return 0;
}
开发者ID:Matt8109,项目名称:HighPerformanceWebServer,代码行数:28,代码来源:client_async.cpp

示例14: descendFromMultiSPs

// Do gradient descend from multiple starting points
void GradientMatcher::descendFromMultiSPs() {
  printXXMatrWithScore(xx_len_);
  mul_desc_.clear();
  for (int i = 0; i < NUMOFINITDESCENDPOINTS; ++i) {
    mul_desc_.push_back(new MulDesc(n_features_));
  }
  sign_count_.clear();
  sign_count_.resize(n_features_);

  WaitAllDone* waitAllDone = new WaitAllDone();

  finishedCounter = 0;
  for (int ind = 0; ind < NUMOFINITDESCENDPOINTS; ++ind) {
    Person::randWeightsGenerator(mul_desc_[ind]->guessWArr, n_features_);

    Callback<void>* task = makeCallableOnce(&GradientMatcher::feedRandCandsResults,
        this, mul_desc_[ind], 0.001, -1, (double*)NULL);
    thr_pool_->addTask(task);
    // feedRandCandsResults(mul_desc_.back()->guessWArr);
  }
  Callback<void>* allDone = makeCallableOnce(&WaitAllDone::jobsDoneSignal,
      waitAllDone);
  thr_pool_->addTask(allDone);
  waitAllDone->wait();

  std::cerr << "-----------------------------" << "NumFinished: " << finishedCounter
    << std::endl;
  // signCountDowork(mul_desc_.back()->guessWArr, signCounter);
  printSignCounter(sign_count_);
  delete waitAllDone;
}
开发者ID:oveis,项目名称:Heuristic,代码行数:32,代码来源:gradient_matcher.cpp

示例15: FromExploded

// static
Time Time::FromExploded(bool is_local, const Exploded& exploded)
{
    // 创建系统拆分时间结构, 代表本地时间或者UTC.
    SYSTEMTIME st;
    st.wYear = exploded.year;
    st.wMonth = exploded.month;
    st.wDayOfWeek = exploded.day_of_week;
    st.wDay = exploded.day_of_month;
    st.wHour = exploded.hour;
    st.wMinute = exploded.minute;
    st.wSecond = exploded.second;
    st.wMilliseconds = exploded.millisecond;

    // 转换到FILETIME.
    FILETIME ft;
    if(!SystemTimeToFileTime(&st, &ft))
    {
        NOTREACHED() << "Unable to convert time";
        return Time(0);
    }

    // 确保是UTC.
    if(is_local)
    {
        FILETIME utc_ft;
        LocalFileTimeToFileTime(&ft, &utc_ft);
        return Time(FileTimeToMicroseconds(utc_ft));
    }
    return Time(FileTimeToMicroseconds(ft));
}
开发者ID:hgl888,项目名称:x-framework,代码行数:31,代码来源:time.cpp


注:本文中的base类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。