ExampleNLPObjGrad::ExampleNLPObjGrad(
  const VectorSpace::space_ptr_t&  vec_space
  ,value_type                      xo
  ,bool                            has_bounds
  ,bool                            dep_bounded
  )
  :vec_space_(vec_space), vec_space_comp_(Teuchos::null)
  ,initialized_(false), obj_scale_(1.0)
  ,has_bounds_(has_bounds), force_xinit_in_bounds_(true), n_(2*vec_space->dim())
{
  namespace rcp = MemMngPack;

  // Assert the size of the NLP
  TEUCHOS_TEST_FOR_EXCEPTION(
    vec_space->dim() <= 0, std::logic_error
    ,"ExampleNLPObjGrad::ExampleNLPObjGrad(...) Error!" );

  // Setup the aggregate vector space object
  BasisSystemComposite::initialize_space_x(
    vec_space, vec_space, &var_dep_, &var_indep_, &vec_space_comp_ );

  // Set the initial starting point.
  xinit_ = vec_space_comp_->create_member();
  *xinit_ = xo;

  /*
    Setup the sparse bounds
    
    xl(i) = 0.01  \ 
                    }  for i <: bounded_rng
    xu(i) = 20    /
  */

  xl_ = vec_space_comp_->create_member();
  xu_ = vec_space_comp_->create_member();

  if(has_bounds) {
    const Range1D
      bounded_rng   = ( dep_bounded ? var_dep_   : var_indep_ ),
      unbounded_rng = ( dep_bounded ? var_indep_ : var_dep_   );
    *xl_->sub_view(bounded_rng)   = 0.01;
    *xl_->sub_view(unbounded_rng) = -NLP::infinite_bound();
    *xu_->sub_view(bounded_rng)   = 20.0;
    *xu_->sub_view(unbounded_rng) = +NLP::infinite_bound();
  }
  else {
    *xl_ = -NLP::infinite_bound();
    *xu_ = +NLP::infinite_bound();
  }
}