void Assignment::Initialize(void) { SetRank( -1 ); SetLHS( "", NULL ); SetRHS( NULL ); vector<string> empty; SetLoopCounters( empty ); //References.clear(); GetReferences()->clear(); normalized_domain.clear(); }
void Assignment::Set(string __lhs, FADA_Index* __lhs_index, Expression* __exp) { SetLHS( __lhs, __lhs_index); SetRHS( __exp ); }
void RD_SubproblemLP::ApplyScenario( const Scenario &Sc, // ) Bool_T NewTrialPoint, #ifndef NDEBUG Int_T nn, #else Int_T, #endif const Real_T *TrialPoint ) { assert( nn == n1st && TrialPoint != NULL ); //-------------------------------------------------------------------------- // Compute the new right hand side and cost to match the current scenario. // // Algorithm: // 1. h <- d_base; q <- q_base // 2. h += Delta_d; h -= Delta_T * y; q += Delta_q // 3. if( y changed ) // T_base_y <- T_base * y // 4. h -= T_base_y // // Step 2 is performed as one because Delta_d, Delta_T and Delta_q are // stored together on the same list corresponding to one scenario. // h.Copy( d_base, m2st, m2st ); q.Copy( q_base, n, n ); // // Now add the scenario-specific modifications. // for( Int_T l = Sc.GetLength(), j = 0; j < l; j++ ) { for( Int_T i = 0, bl = Sc[j].Len(); i < bl; i++ ) { const Delta &d = Sc[j][i]; switch( d.type ) { case Delta::RHS: h[d.row] += d.value; break; case Delta::MATRIX: assert( d.col >= 0 && d.col <= nn ); h[d.row] -= d.value * TrialPoint[d.col]; break; case Delta::COST: q[d.col] = d.value; break; default: #ifndef NDEBUG abort(); #endif break; } } } //-------------------------------------------------------------------------- // Check if 'TrialPoint' has changed. If so - recompute 'T_base_y'. // if( NewTrialPoint ) { T_base_y.Fill( 0.0, m2st ); Ptr<Real_T> a; Ptr<Int_T> row; Int_T len; for( Int_T j = 0; j < n1st; j++ ) for( T_base.GetColumn( j, a, row, len ); len; --len, ++a, ++row ) T_base_y[*row] += *a * TrialPoint[j]; } for( Int_T i = 0; i < m2st; i++ ) h[i] -= T_base_y[i]; //-------------------------------------------------------------------------- // Replace the right hand side and cost of the LP with computed ones. // SetRHS( h ); c.Copy( q, n, n ); }