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; }
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; }
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_ ); }