void CEntityFactory::setMapBlueprints(const std::string &type, const std::string &component, bool value)
	{
		//Si el tipo de entidad no esta añadido 
		if(_mapBlueprints.find(type) == _mapBlueprints.end())
		{
			//Lo añado, con un vector de pares de componentes/de si esta despierto o no
			_mapBlueprints[type] = std::vector<std::pair<std::string, bool>>();
		}

		//Obtengo el vector de componentes que se ha leido hasta el momento del tipo de entidad indicado
		std::vector<std::pair<std::string, bool>> vec = _mapBlueprints[type];
		//Creammos el par, componente y estado (despierto o dormido)
		std::pair<std::string, bool> couple(component, value);
		//Lo metemos en el map
		_mapBlueprints[type].push_back(couple);
	}
Exemplo n.º 2
0
int main (int argc, const char * argv[])
{
    
    int iAmInt = 9;
    
    i_am_cool cool_boy(1,0.5,3);
    i_am_cooler cooler_boy(1,2,0.1,0.2,'A','B');
    
	i_am_cool *cool_pointer = new i_am_cool(3,-3.141592,'E');
    
    i_am_cool cool_array[5];
    
    cool_array[3].floating = 5.25;
    cool_array[4].integer = 6;
    cool_array[2].character = 'Q';
    
    int int_array[] = {1,2,3,4,5};
    
    IWrapPointers wrapper;
        
    *int_array = -1;
    
    int* pointer = &cool_array[4].integer;
    
    IWrapPointers *wrap_pointer = &wrapper;
    
    Couple couple(9,9.99,'X');
	
	SimpleWithPointers sparray[] = 
        {SimpleWithPointers(-1,-2,'3'),
        SimpleWithPointers(-4,-5,'6'),
        SimpleWithPointers(-7,-8,'9')};
    
    Simple a_simple_object(3,0.14,'E');
    
    VeryLong a_long_guy;
    
    return 0; // Set break point at this line.
}
Exemplo n.º 3
0
int main(int argc, const char** argv) {
  std::ios_base::sync_with_stdio(false);
  (std::cout << std::fixed).precision(10);
  (std::cerr << std::fixed).precision(10);
  Options opts;
  if(!init_tool(argc, argv, &opts)) {
    print_usage();
    return 1;
  }

  crf.lambda[0] = 1000;
  crf.lambda[1] = 1;
  crf.lambda[2] = 1;
  crf.lambda[3] = 1;
  crf.lambda[4] = 1;
  crf.lambda[5] = 1;
  baseline_crf.lambda[0] = 1;

  switch(opts.get_mode()) {
  case Options::Mode::RESYNTH:
    return resynthesize(opts);
  case Options::Mode::TRAIN:
    return gridsearch::train(opts);
  case Options::Mode::BASELINE:
    return baseline(opts);
  case Options::Mode::COMPARE:
    return compare(opts);
  case Options::Mode::COUPLE:
    return couple(opts);
  case Options::Mode::PSOLA:
    return psola(opts);
  default:
    ERROR("Unrecognized mode " << opts.mode);
    return 1;
  }

  return 0;
}
Exemplo n.º 4
0
void 
movevtxs (
    struct vtx_data **graph,	/* data structure with vertex weights */
    int nvtxs,		/* number of vertices in graph */
    int nsets,		/* how many sets am I dividing into? */
    double *dist,			/* distances defining splitter */
    int *indices[][MAXSETS],	/* indices that define order in sorted lists */
    double *vals[][MAXSETS],	/* values in sorted lists */
    int startvtx[][MAXSETS],	/* index values corresponding to splitter */
    int *sets,			/* set assignment for each vertex */
    double *size,			/* sizes of the different sets */
    double *goal,			/* desired set sizes */
    int vwgt_max		/* largest vertex weight */
)
{
    double    largest;		/* largest overshoot from desired size */
    double    smallest;		/* largest undershoot from desired size */
    int       active[MAXSETS];	/* flags sets trying to change size */
    double    delta;		/* amount distances must change */
    int       vtx;		/* vertex being moved */
    int     to, from;		/* set vertex is being moved to/from */
    int       weight;		/* weight of vertex being moved */
    int       done;		/* have I successfully move a vertex? */

    /* int npass=0; *//* counts passes through main loop */
    int       badset=-1;		/* most unbalanced set */
    int       toobig=0;		/* badset too large or too small? */
    int       balanced;		/* is balance attained? */
    double    imbalance;	/* amount of imbalance in badset */
    int       i;		/* loop counter */

    /* Find most unbalanced set. */

    imbalance = largest = smallest = 0;
    for (i = 0; i < nsets; i++) {
	if (size[i] - goal[i] > largest) {
	    largest = size[i] - goal[i];
	    if (largest > imbalance) {
		imbalance = largest;
		badset = i;
		toobig = 1;
	    }
	}
	else if (goal[i] - size[i] > smallest) {
	    smallest = goal[i] - size[i];
	    if (smallest > imbalance) {
		imbalance = smallest;
		badset = i;
		toobig = -1;
	    }
	}
    }
    if (largest + smallest <= vwgt_max)
	balanced = TRUE;
    else
	balanced = FALSE;


    /* If not balanced, change distances to move vertices between sets. */
    while (!balanced) {
	/* npass++; */
	for (i = 0; i < nsets; i++)
	    active[i] = FALSE;
	active[badset] = TRUE;

	done = FALSE;
	while (!done) {
	    nextmove(nvtxs, nsets, vals, indices, startvtx, dist, sets,
		     toobig, active, &vtx, &to, &delta);
	    from = sets[vtx];
	    weight = graph[vtx]->vwgt;

	    /* Now adjust all active dists to reflect this move so far. */
	    for (i = 0; i < nsets; i++)
		if (active[i])
		    dist[i] -= toobig * delta;

	    if (toobig > 0) {
		if (size[to] + weight - goal[to] < largest) {
		    done = TRUE;
		    size[from] -= graph[vtx]->vwgt;
		    size[to] += graph[vtx]->vwgt;
		    sets[vtx] = to;
		    undo_coupling(graph, sets, nsets, from, to, toobig, badset,
				  size);
		}
		else {
		    couple(nsets, from, to, vtx);
		    active[to] = TRUE;
		}
	    }
	    else {
		if (goal[from] - (size[from] - weight) < smallest) {
		    done = TRUE;
		    size[from] -= graph[vtx]->vwgt;
		    size[to] += graph[vtx]->vwgt;
		    sets[vtx] = to;
		    undo_coupling(graph, sets, nsets, from, to, toobig, badset,
				  size);
		}
		else {
		    couple(nsets, from, to, vtx);
		    active[from] = TRUE;
		}
	    }
	}

	/* Find most unbalanced set. */
	imbalance = largest = smallest = 0;
	for (i = 0; i < nsets; i++) {
	    if (size[i] - goal[i] > largest) {
		largest = size[i] - goal[i];
		if (largest > imbalance) {
		    imbalance = largest;
		    badset = i;
		    toobig = 1;
		}
	    }
	    else if (goal[i] - size[i] > smallest) {
		smallest = goal[i] - size[i];
		if (smallest > imbalance) {
		    imbalance = smallest;
		    badset = i;
		    toobig = -1;
		}
	    }
	}
	if (largest + smallest <= vwgt_max)
	    balanced = TRUE;
	else
	    balanced = FALSE;
    }
}
Exemplo n.º 5
0
void MSTypeEntryField<Type>::model(Type& model_)
{ couple(&model_); }
Exemplo n.º 6
0
void MSIntMatrixView::model(MSIntMatrix& model_)
{ couple(&model_); }
Exemplo n.º 7
0
void MSOptionPopupMenu::model(MSStringVector& options_) 
{ couple(&options_); }
Exemplo n.º 8
0
void MSOptionMenu::model(MSString &model_)
{ couple(&model_); }
Exemplo n.º 9
0
void MSComboField::model(MSString& model_)
{ couple(&model_); }
Exemplo n.º 10
0
void MSIntTableColumn::model(MSIntVector& model_)
{ couple(&model_); }
Exemplo n.º 11
0
void MSStringEntryField::model(MSString& model_)
{ couple(&model_); }