本文整理汇总了C++中Expression::getComponent方法的典型用法代码示例。如果您正苦于以下问题:C++ Expression::getComponent方法的具体用法?C++ Expression::getComponent怎么用?C++ Expression::getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::getComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addItem
returnValue LogRecord::addItem( const Expression& _name,
const char* const _label
)
{
if (items.count(make_pair(_name.getComponent( 0 ), LRT_VARIABLE)))
return SUCCESSFUL_RETURN;
items[ make_pair(_name.getComponent( 0 ), LRT_VARIABLE) ] = LogRecordData( _label );
return SUCCESSFUL_RETURN;
}
示例2: add
returnValue PointConstraint::add( const double lb_, const Expression& arg, const double ub_ ){
if( fcn == 0 )
return ACADOERROR(RET_MEMBER_NOT_INITIALISED);
// CHECK FOR A SIMPLE BOUND:
// -------------------------
VariableType varType = arg.getVariableType( );
int component = arg.getComponent (0);
if( arg.isVariable() == BT_TRUE ){
if( varType != VT_INTERMEDIATE_STATE ){
nb++;
var = (VariableType*)realloc(var , nb*sizeof(VariableType));
index = (int* )realloc(index, nb*sizeof(int ));
blb = (double* )realloc(blb , nb*sizeof(double ));
bub = (double* )realloc(bub , nb*sizeof(double ));
var [nb-1] = varType ;
index[nb-1] = component;
blb [nb-1] = lb_ ;
bub [nb-1] = ub_ ;
}
}
// ADD THE ARGUMENT TO THE FUNCTION TO BE EVALUATED:
// -------------------------------------------------
fcn[0] << arg;
lb[0] = (double*)realloc(lb[0],fcn[0].getDim()*sizeof(double));
ub[0] = (double*)realloc(ub[0],fcn[0].getDim()*sizeof(double));
ub[0][fcn[0].getDim()-1] = ub_;
lb[0][fcn[0].getDim()-1] = lb_;
return SUCCESSFUL_RETURN;
}
示例3: add
returnValue Constraint::add( const Vector lb_, const Expression &arg, const Vector ub_ ) {
// CHECK FEASIBILITY:
// ------------------
if( lb_.getDim() != ub_.getDim() ) return ACADOERROR(RET_INFEASIBLE_CONSTRAINT);
if( lb_.getDim() != grid.getNumPoints() ) return ACADOERROR(RET_INFEASIBLE_CONSTRAINT);
if( (lb_ <= (const VectorspaceElement&)ub_) == BT_FALSE ) return ACADOERROR(RET_INFEASIBLE_CONSTRAINT);
// CHECK FOR A BOUND:
// -----------------------
VariableType varType = arg.getVariableType();
int component = arg.getComponent(0) ;
if( arg.isVariable( ) == BT_TRUE ) {
if( varType != VT_INTERMEDIATE_STATE ) {
nb++;
var = (VariableType*)realloc(var , nb*sizeof(VariableType));
index = (int* )realloc(index, nb*sizeof(int ));
blb = (Vector** )realloc(blb , nb*sizeof(Vector* ));
bub = (Vector** )realloc(bub , nb*sizeof(Vector* ));
var [nb-1] = varType ;
index[nb-1] = component;
blb [nb-1] = new Vector( lb_ );
bub [nb-1] = new Vector( ub_ );
return SUCCESSFUL_RETURN;
}
}
// SAVE THE ARGUMENT AS A Path Constraint:
// ---------------------------------------
return path_constraint->add( lb_, arg, ub_ );
}