diff --git a/src/LinAlg/VectorCudaKernels.cu b/src/LinAlg/VectorCudaKernels.cu index 405dfff78..29fb6984b 100644 --- a/src/LinAlg/VectorCudaKernels.cu +++ b/src/LinAlg/VectorCudaKernels.cu @@ -622,6 +622,28 @@ __global__ void compute_cusum_cu(int n, int* vec, const double* id) } } +/** @brief set veq[i]=1 and vineq[i]=0 if v1[i-1]=v2[i-1], and veq[i]=0 and vineq[i]=01if v1[i-1]!=v2[i-1]*/ +__global__ void mark_cons_cu(int n, int* veq, int* vineq, const double* v1, const double* v2) +{ + const int num_threads = blockDim.x * gridDim.x; + const int tid = blockIdx.x * blockDim.x + threadIdx.x; + for (int i = tid; i < n; i += num_threads) { + if(i==0) { + veq[i] = 0; + vineq[i] = 0; + } else { + // from i=1..n + if(v1[i-1]==v2[i-1]){ + veq[i] = 1; + vineq[i] = 0; + } else { + veq[i] = 0; + vineq[i] = 1; + } + } + } +} + /// @brief Copy the entries in 'dd' where corresponding 'ix' is nonzero, to vd starting at start_index_in_dest. __global__ void copyToStartingAt_w_pattern_cu(int n_src, int n_dest, @@ -1462,6 +1484,19 @@ void compute_cusum_kernel(int sz, int* buf, const double* id) thrust::inclusive_scan(dev_v, dev_v + sz, dev_v); // in-place scan } +/** @brief compute cusum from the given pattern*/ +void compute_cusum_kernel(int sz, int* ebuf, int* ibuf, const double* v1, const double* v2) +{ + int num_blocks = (sz+block_size-1)/block_size; + mark_cons_cu<<>>(sz, ebuf, ibuf, v1, v2); + + thrust::device_ptr dev_e = thrust::device_pointer_cast(ebuf); + thrust::device_ptr dev_i = thrust::device_pointer_cast(ibuf); + + thrust::inclusive_scan(dev_e, dev_e + sz, dev_e); // in-place scan + thrust::inclusive_scan(dev_i, dev_i + sz, dev_i); // in-place scan +} + } } diff --git a/src/LinAlg/hiopVector.hpp b/src/LinAlg/hiopVector.hpp index 80c720004..624066d02 100644 --- a/src/LinAlg/hiopVector.hpp +++ b/src/LinAlg/hiopVector.hpp @@ -1019,8 +1019,8 @@ class hiopVector * @param[in] xu - lower bound of primal variable `x` * @param[in] ixl - index of the variables with lower bounds * @param[in] ixu - index of the variables with upper bounds - * @param[out] n_bnds_low - number of variables with lower bounds only - * @param[out] n_bnds_upp - number of variables with upper bounds only + * @param[out] n_bnds_low - number of variables with lower bounds + * @param[out] n_bnds_upp - number of variables with upper bounds * @param[out] n_bnds_lu - number of variables with both lower and upper bounds * @param[out] n_fixed_vars - number of fixed variables * @param[in] fixed_var_tol - tolerance used to define fixed variables @@ -1050,6 +1050,44 @@ class hiopVector const double& fixed_var_tol, const double& fixed_var_perturb) = 0; + /** + * @brief process constraints. Firstly the constraints are split to equalities and + * inequalities. Then it preprocesses inequality bounds and returns counts of + * the constraints with lower, upper, and lower and upper bounds. + * + * @param[in] this - crhs, the right hand side of equality constraints + * @param[in] gl_vec - lower bounds for all the constraints + * @param[in] gu_vec - upper bounds for all the constraints + * @param[out] dl_vec - lower bounds for inequality constraints + * @param[out] du_vec - upper bounds for inequality constraints + * @param[out] idl_vec - index of the inequality constraints with lower bounds + * @param[out] idu_vec - index of the inequality constraints with upper bounds + * @param[out] n_ineq_low - number of inequality constraints with lower bounds + * @param[out] n_ineq_upp - number of inequality constraints with lower bounds + * @param[out] n_ineq_lu - number of inequality constraints with both lower and upper bounds + * @param[out] cons_eq_mapping - a map between equality constaints and full list of constraints + * @param[out] cons_ineq_mapping - a map between inequality constaints and full list of constraints + * @param[out] eqcon_type - types of all the equality constraints + * @param[out] incon_type - types of all the inequality constraints + * @param[in] cons_type - types of all the constraints + * + * @pre this is a local method + */ + virtual void process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type) = 0; + protected: size_type n_; //we assume sequential data protected: diff --git a/src/LinAlg/hiopVectorCuda.cpp b/src/LinAlg/hiopVectorCuda.cpp index 1bf877992..17bfbe0ba 100644 --- a/src/LinAlg/hiopVectorCuda.cpp +++ b/src/LinAlg/hiopVectorCuda.cpp @@ -1151,5 +1151,23 @@ void hiopVectorCuda::relax_bounds_vec(hiopVector& xu, fixed_var_perturb); } +void hiopVectorCuda::process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type) +{ + assert(0&&"not yet"); +} + } // namespace hiop diff --git a/src/LinAlg/hiopVectorCuda.hpp b/src/LinAlg/hiopVectorCuda.hpp index 7ec1b3faa..6550a5f7b 100644 --- a/src/LinAlg/hiopVectorCuda.hpp +++ b/src/LinAlg/hiopVectorCuda.hpp @@ -362,6 +362,21 @@ class hiopVectorCuda : public hiopVector const double& fixed_var_tol, const double& fixed_var_perturb); + virtual void process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type); + /* functions for this class */ inline MPI_Comm get_mpi_comm() const { return comm_; } diff --git a/src/LinAlg/hiopVectorHip.cpp b/src/LinAlg/hiopVectorHip.cpp index e2a173468..38e1c79c2 100644 --- a/src/LinAlg/hiopVectorHip.cpp +++ b/src/LinAlg/hiopVectorHip.cpp @@ -1155,5 +1155,23 @@ void hiopVectorHip::relax_bounds_vec(hiopVector& xu, fixed_var_perturb); } +void hiopVectorHip::process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type) +{ + assert(0&&"not yet"); +} + } // namespace hiop diff --git a/src/LinAlg/hiopVectorHip.hpp b/src/LinAlg/hiopVectorHip.hpp index de594201c..0335ff652 100644 --- a/src/LinAlg/hiopVectorHip.hpp +++ b/src/LinAlg/hiopVectorHip.hpp @@ -364,6 +364,21 @@ class hiopVectorHip : public hiopVector const double& fixed_var_tol, const double& fixed_var_perturb); + virtual void process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type); + /* functions for this class */ inline MPI_Comm get_mpi_comm() const { return comm_; } diff --git a/src/LinAlg/hiopVectorPar.cpp b/src/LinAlg/hiopVectorPar.cpp index b50927729..7ca00953b 100644 --- a/src/LinAlg/hiopVectorPar.cpp +++ b/src/LinAlg/hiopVectorPar.cpp @@ -1406,4 +1406,92 @@ void hiopVectorPar::relax_bounds_vec(hiopVector& xu, } } +void hiopVectorPar::process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type) +{ +#ifdef HIOP_DEEPCHECKS + assert(gl_vec.get_local_size() == gu_vec.get_local_size()); + assert(dl_vec.get_local_size() == du_vec.get_local_size()); + assert(dl_vec.get_local_size() == idl_vec.get_local_size()); + assert(dl_vec.get_local_size() == idu_vec.get_local_size()); + assert(dl_vec.get_local_size() + this->get_local_size() == gu_vec.get_local_size()); +#endif + + double *dl = dl_vec.local_data(); + double *du = du_vec.local_data(); + const double *gl = gl_vec.local_data_const(); + const double *gu = gu_vec.local_data_const(); + double* idl = idl_vec.local_data(); + double* idu = idu_vec.local_data(); + + double *c_rhs = this->local_data(); + index_type *eqcon_map = cons_eq_mapping.local_data(); + index_type *incon_map = cons_ineq_mapping.local_data(); + + size_type n_eq = this->get_local_size(); + size_type n_in = dl_vec.get_local_size(); + size_type n_cons = n_eq + n_in; + + /* splitting (preprocessing) step done on the CPU */ + size_type it_eq = 0; + size_type it_in = 0; + for(index_type i = 0; i < n_cons; i++) { + if(gl[i] == gu[i]) { + eqcon_type[it_eq] = cons_type[i]; + c_rhs[it_eq] = gl[i]; + eqcon_map[it_eq] = i; + it_eq++; + } else { +#ifdef HIOP_DEEPCHECKS + assert(gl[i] <= gu[i] && "please fix the inconsistent inequality constraints, otherwise the problem is infeasible"); +#endif + incon_map[it_in] = cons_type[i]; + dl[it_in] = gl[i]; + du[it_in] = gu[i]; + incon_map[it_in] = i; + it_in++; + } + } + assert(it_eq == n_eq); + assert(it_in == n_in); + + /* iterate over the inequalities and build the idl(ow) and idu(pp) vectors */ + n_ineq_low = 0; + n_ineq_upp = 0; + n_ineq_lu = 0; + + for(index_type i=0; i-1e20) { + idl[i] = 1.; + n_ineq_low++; + if(du[i]< 1e20) { + n_ineq_lu++; + } + } + else { + idl[i]=0.; + } + + if(du[i]< 1e20) { + idu[i] = 1.; + n_ineq_upp++; + } else { + idu[i]=0.; + } + } +} + + }; diff --git a/src/LinAlg/hiopVectorPar.hpp b/src/LinAlg/hiopVectorPar.hpp index ae10ad7db..ccc767702 100644 --- a/src/LinAlg/hiopVectorPar.hpp +++ b/src/LinAlg/hiopVectorPar.hpp @@ -324,6 +324,21 @@ class hiopVectorPar : public hiopVector const double& fixed_var_tol, const double& fixed_var_perturb); + virtual void process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type); + /** * @brief accessor to the execution policy */ diff --git a/src/LinAlg/hiopVectorRaja.hpp b/src/LinAlg/hiopVectorRaja.hpp index ae0b936cc..020f3da2f 100644 --- a/src/LinAlg/hiopVectorRaja.hpp +++ b/src/LinAlg/hiopVectorRaja.hpp @@ -327,6 +327,21 @@ class hiopVectorRaja : public hiopVector const double& fixed_var_tol, const double& fixed_var_perturb); + virtual void process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type); + const ExecSpace& exec_space() const { return exec_space_; diff --git a/src/LinAlg/hiopVectorRajaImpl.hpp b/src/LinAlg/hiopVectorRajaImpl.hpp index 6e8b552cc..be5b796b0 100644 --- a/src/LinAlg/hiopVectorRajaImpl.hpp +++ b/src/LinAlg/hiopVectorRajaImpl.hpp @@ -2351,4 +2351,149 @@ void hiopVectorRaja::relax_bounds_vec(hiopVector& xu, }); } +template +void hiopVectorRaja::process_constraints_local(const hiopVector& gl_vec, + const hiopVector& gu_vec, + hiopVector& dl_vec, + hiopVector& du_vec, + hiopVector& idl_vec, + hiopVector& idu_vec, + size_type& n_ineq_low, + size_type& n_ineq_upp, + size_type& n_ineq_lu, + hiopVectorInt& cons_eq_mapping, + hiopVectorInt& cons_ineq_mapping, + hiopInterfaceBase::NonlinearityType* eqcon_type, + hiopInterfaceBase::NonlinearityType* incon_type, + hiopInterfaceBase::NonlinearityType* cons_type) +{ +#ifdef HIOP_DEEPCHECKS + assert(gl_vec.get_local_size() == gu_vec.get_local_size()); + assert(dl_vec.get_local_size() == du_vec.get_local_size()); + assert(dl_vec.get_local_size() == idl_vec.get_local_size()); + assert(dl_vec.get_local_size() == idu_vec.get_local_size()); + assert(dl_vec.get_local_size() + this->get_local_size() == gu_vec.get_local_size()); +#endif + + double *dl = dl_vec.local_data(); + double *du = du_vec.local_data(); + const double *gl = gl_vec.local_data_const(); + const double *gu = gu_vec.local_data_const(); + double* idl = idl_vec.local_data(); + double* idu = idu_vec.local_data(); + + double *c_rhs = this->local_data(); + index_type *eqcon_map = cons_eq_mapping.local_data(); + index_type *incon_map = cons_ineq_mapping.local_data(); + + size_type n_eq = this->get_local_size(); + size_type n_in = dl_vec.get_local_size(); + size_type n_cons = n_eq + n_in; + + hiopVectorInt* idx_eq_cumsum = LinearAlgebraFactory::create_vector_int(mem_space_, n_cons); + hiopVectorInt* idx_in_cumsum = LinearAlgebraFactory::create_vector_int(mem_space_, n_cons); + index_type* find_eq = idx_eq_cumsum->local_data(); + index_type* find_in = idx_in_cumsum->local_data(); + + RAJA::ReduceSum< hiop_raja_reduce, int > sum_n_bnds_low(0); + RAJA::ReduceSum< hiop_raja_reduce, int > sum_n_bnds_upp(0); + RAJA::ReduceSum< hiop_raja_reduce, int > sum_n_bnds_lu(0); + + + RAJA::forall( + RAJA::RangeSegment(0, n_cons), + RAJA_LAMBDA(RAJA::Index_type i) + { + if(gl[i] == gu[i]) { + find_eq[i] = 1; + find_in[i] = 0; + } else { + find_eq[i] = 0; + find_in[i] = 1; + } + } + ); + RAJA::inclusive_scan_inplace(RAJA::make_span(idx_eq_cumsum, n_cons), RAJA::operators::plus()); + RAJA::inclusive_scan_inplace(RAJA::make_span(idx_in_cumsum, n_cons), RAJA::operators::plus()); + + // eg. eq -- ineq + // (0 1 0) -- (1,0,1) + // (0,1,1) -- (1,1,2) after scan + // map [1] [0,2] + + index_type* nnz_cumsum = idx_cumsum_->local_data(); + index_type v_n_local = v.n_local_; + RAJA::forall( + RAJA::RangeSegment(0, n_cons), + RAJA_LAMBDA(RAJA::Index_type i) + { + if(i == 0) { + if(idx_eq_cumsum[i] == 1) { + eqcon_type[i] = cons_type[i]; + c_rhs[i] = gl[i]; + eqcon_map[i] = i; + } else { + incon_map[i] = cons_type[i]; + dl[i] = gl[i]; + du[i] = gu[i]; + incon_map[i] = i; + + if(gl[i]>-1e20) { + idl[i] = 1.; + sum_n_bnds_low += 1; + if(gu[i]< 1e20) { + sum_n_bnds_lu += 1; + } + } else { + idl[i] = 0.; + } + if(gu[i]< 1e20) { + idu[i] = 1.; + sum_n_bnds_upp += 1; + } else { + idu[i] = 0.; + } + } + } else { + if(idx_eq_cumsum[i] != idx_eq_cumsum[i-1]){ + assert(idx_eq_cumsum[i] == idx_eq_cumsum[i-1] + 1); + int eq_idx = idx_eq_cumsum[i] - 1; + eqcon_type[eq_idx] = cons_type[i]; + c_rhs[eq_idx] = gl[i]; + eqcon_map[eq_idx] = i; + } else { + assert(idx_in_cumsum[i] == idx_in_cumsum[i-1] + 1); + int in_idx = idx_in_cumsum[i] - 1; + incon_map[in_idx] = cons_type[i]; + dl[in_idx] = gl[i]; + du[in_idx] = gu[i]; + + if(gl[i]>-1e20) { + idl[in_idx] = 1.; + sum_n_bnds_low += 1; + if(gu[i]< 1e20) { + sum_n_bnds_lu += 1; + } + } else { + idl[in_idx] = 0.; + } + if(gu[i]< 1e20) { + idu[in_idx] = 1.; + sum_n_bnds_upp += 1; + } else { + idu[in_idx] = 0.; + } + } + } + } + ); + + n_bnds_low = sum_n_bnds_low.get(); + n_bnds_upp = sum_n_bnds_upp.get(); + n_bnds_lu = sum_n_bnds_lu.get(); + + return true; +} + + } // namespace hiop diff --git a/src/Optimization/hiopNlpFormulation.cpp b/src/Optimization/hiopNlpFormulation.cpp index ac50c04fa..76fb5ba14 100644 --- a/src/Optimization/hiopNlpFormulation.cpp +++ b/src/Optimization/hiopNlpFormulation.cpp @@ -488,6 +488,18 @@ bool hiopNlpFormulation::process_constraints() n_cons_eq_ = gl->num_match(*gu); n_cons_ineq_ = n_cons_ - n_cons_eq_; + cons_eq_mapping_ = LinearAlgebraFactory::create_vector_int(mem_space, n_cons_eq_); + cons_ineq_mapping_ = LinearAlgebraFactory::create_vector_int(mem_space, n_cons_ineq_); + c_rhs_ = LinearAlgebraFactory::create_vector(mem_space, n_cons_eq_); + dl_ = LinearAlgebraFactory::create_vector(mem_space, n_cons_ineq_); + du_ = dl_->alloc_clone(); + idl_ = dl_->alloc_clone(); + idu_ = du_->alloc_clone(); + + cons_eq_type_ = new hiopInterfaceBase::NonlinearityType[n_cons_eq_]; + cons_ineq_type_ = new hiopInterfaceBase::NonlinearityType[n_cons_ineq_]; + + // transfer to host hiopVectorPar gl_host(n_cons_); hiopVectorPar gu_host(n_cons_); @@ -497,100 +509,26 @@ bool hiopNlpFormulation::process_constraints() double* gl_vec = gl_host.local_data(); double* gu_vec = gu_host.local_data(); - /* Allocate host c_rhs, dl, and du (all serial in this formulation) for on host processing. */ - hiopVectorPar c_rhs_host(n_cons_eq_); - cons_eq_type_ = new hiopInterfaceBase::NonlinearityType[n_cons_eq_]; - hiopVectorPar dl_host(n_cons_ineq_); - hiopVectorPar du_host(n_cons_ineq_); - cons_ineq_type_ = new hiopInterfaceBase::NonlinearityType[n_cons_ineq_]; - hiopVectorIntSeq cons_eq_mapping_host(n_cons_eq_); - hiopVectorIntSeq cons_ineq_mapping_host(n_cons_ineq_); - - /* copy lower and upper bounds - constraints */ - double* dl_vec = dl_host.local_data(); - double* du_vec = du_host.local_data(); - - double *c_rhsvec = c_rhs_host.local_data(); - index_type *cons_eq_mapping = cons_eq_mapping_host.local_data(); - index_type *cons_ineq_mapping = cons_ineq_mapping_host.local_data(); - - /* splitting (preprocessing) step done on the CPU */ - int it_eq=0, it_ineq=0; - for(int i=0;iprocess_constraints_local(*gl, + *gu, + *dl_, + *du_, + *idl_, + *idu_, + n_ineq_low_, + n_ineq_upp_, + n_ineq_lu_, + *cons_eq_mapping_, + *cons_ineq_mapping_, + cons_eq_type_, + cons_ineq_type_, + cons_type); + /* delete the temporary buffers */ delete gl; delete gu; delete[] cons_type; - - /* iterate over the inequalities and build the idl(ow) and idu(pp) vectors */ - n_ineq_low_ = 0; - n_ineq_upp_ = 0; - n_ineq_lu_ = 0; - - hiopVectorPar idl_host(n_cons_ineq_); - hiopVectorPar idu_host(n_cons_ineq_); - - double* idl_vec = idl_host.local_data(); - double* idu_vec = idu_host.local_data(); - for(int i=0; i-1e20) { - idl_vec[i]=1.; - n_ineq_low_++; - if(du_vec[i]< 1e20) { - n_ineq_lu_++; - } - } - else { - idl_vec[i]=0.; - } - - if(du_vec[i]< 1e20) { - idu_vec[i]=1.; - n_ineq_upp_++; - } else { - idu_vec[i]=0.; - } - } - - // - // copy from temporary host vectors - // - c_rhs_ = LinearAlgebraFactory::create_vector(mem_space, n_cons_eq_); - c_rhs_->copy_from_vectorpar(c_rhs_host); - - dl_ = LinearAlgebraFactory::create_vector(mem_space, n_cons_ineq_); - dl_->copy_from_vectorpar(dl_host); - du_ = dl_->alloc_clone(); - du_->copy_from_vectorpar(du_host); - - cons_eq_mapping_ = LinearAlgebraFactory::create_vector_int(mem_space, n_cons_eq_); - cons_eq_mapping_->copy_from_vectorseq(cons_eq_mapping_host); - cons_ineq_mapping_ = LinearAlgebraFactory::create_vector_int(mem_space, n_cons_ineq_); - cons_ineq_mapping_->copy_from_vectorseq(cons_ineq_mapping_host); - - idl_ = dl_->alloc_clone(); - idl_->copy_from_vectorpar(idl_host); - idu_ = du_->alloc_clone(); - idu_->copy_from_vectorpar(idu_host); return true; }