returnValue OCP::subjectTo( const int index_, const ConstraintComponent& component ){ for( uint i=0; i<component.getDim(); ++i ) constraint.add( index_,component(i) ); return SUCCESSFUL_RETURN; }
returnValue OCP::subjectTo( const TimeHorizonElement index_, const ConstraintComponent& component ){ uint i; switch( index_ ){ case AT_START: for( i = 0; i < component.getDim(); i++ ) ACADO_TRY( constraint.add( 0,component(i) ) ); return SUCCESSFUL_RETURN; case AT_END: for( i = 0; i < component.getDim(); i++ ) ACADO_TRY( constraint.add( grid.getLastIndex(),component(i) ) ); return SUCCESSFUL_RETURN; default: return ACADOERROR(RET_UNKNOWN_BUG); } return SUCCESSFUL_RETURN; }
returnValue OCP::subjectTo( int index_, const ConstraintComponent& component ) { ASSERT(index_ >= AT_START); if (index_ == AT_START) { for (unsigned el = 0; el < component.getDim(); ++el) ACADO_TRY( constraint->add( 0,component( el ) ) ); } else if (index_ == AT_END) { for (unsigned el = 0; el < component.getDim(); ++el) ACADO_TRY(constraint->add(grid->getLastIndex(), component( el ))); } else { for (unsigned el = 0; el < component.getDim(); ++el) constraint->add(index_, component(el)); } return SUCCESSFUL_RETURN; }