本文整理汇总了C++中Column::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Column::insert方法的具体用法?C++ Column::insert怎么用?C++ Column::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extract
void IOracle::extract(DoubleVector const & x, Column & column) {
for (int v(0); v < _input->nV(); ++v) {
if (x[v] > 0.5) {
column.insert(v);
}
}
column.cost() = column.computeCost();
}
示例2: GenerateColumn
Column* GameTable::GenerateColumn(Uint32 col)
{
Column* iCol = new Column();
// The number of blocks to create
auto rows = rowNum;//randColNum();
for (Uint32 row = 0; row < rows; row++)
{
// Generate new block
auto bColour = static_cast<BlockColour>(randBlockColor());
auto bType = static_cast<BlockType>(randBlockType());
Block* block = new Block(bColour, bType, col, row, 1, 1, ulPos);
// Generate the pair to populate the column
auto pair = std::make_pair(row, block);
// Insert pair
iCol->insert(pair);
}
return iCol;
}
示例3: genColumn
int Variable::genColumn(
Active<Constraint, Variable> *actCon,
Column &col) const
{
double eps = master_->machineEps();
double minusEps = -eps;
int n = actCon->number();
expand();
for (int i = 0; i < n; i++) {
double co = (*actCon)[i]->coeff(this);
if (co > eps || co < minusEps) col.insert(i,co);
}
col.obj(obj());
col.lBound(lBound());
col.uBound(uBound());
compress();
return col.nnz();
}
示例4: UpdateTable
void GameTable::UpdateTable()
{
Uint32 lastRow = 0, lastCol = colLimit - 1;
Column colMap;
bool shouldSwap = false;
bool shouldMoveCol = false;
// Let's traverse this in the reverse order
for (auto rit = table->rbegin(); rit != table->rend(); ++rit)
{
auto col = rit->first;
auto colRow = rit->second;
shouldMoveCol = lastCol != col;
shouldSwap = false;
colMap.clear();
lastRow = 0;
// For each block in the current column
for (auto& p2 : *colRow)
{
auto row = p2.first;
auto block = p2.second;
auto finalRow = (lastRow != row) ? lastRow : row;
auto finalCol = (lastCol != col) ? lastCol : col;
if (finalRow != row || finalCol != col)
{
// If there is a gap, then recreate the pair
block->MoveTo(finalCol, finalRow);
// Generate the pair to populate the column
auto pair = std::make_pair(finalRow, block);
// Insert pair
colMap.insert(pair);
shouldSwap = true;
}
else
{
// If there is no gap, then maintain the pair
// Insert pair
colMap.insert(p2);
}
lastRow++;
}
if (shouldSwap)
{
colRow->swap(colMap);
}
if (shouldMoveCol)
{
table->erase(col);
table->insert(std::make_pair(lastCol, colRow));
}
lastCol--;
}
// Clean up
colMap.clear();
}