Changeset 5890


Ignore:
Timestamp:
11/30/08 22:36:26 (5 years ago)
Author:
jdsiiro
Message:

Fix to the AmplApplication? to propagate the AMPL problem size from the
relaxed core application out to the outer mixed integer application.

This partially fixes #4242 -- however, there is still a disconnect
between the initial point cache and the ColinOptSolver? "curr".

Location:
colin/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • colin/trunk/colin/OptApplication_Base.h

    r5786 r5890  
    276276   const EvaluationManager_Base* default_eval_mngr() const 
    277277   { return NULL; } 
    278  
     278public: 
    279279   ///  
    280280   virtual  
    281281   OptApplication_Base* get_wrapped_application() const 
    282282   { return NULL; } 
    283  
     283protected: 
    284284   /// Cause the application to actually start computing the requests 
    285285   virtual  
  • colin/trunk/colin/WeightedSumApplication.h

    r5822 r5890  
    5858   /// The ProblemT for the base multi-objective application 
    5959#if 0 
    60    WEH - this doesn't compile.  I think that the 'or' here sets teh nondeterministic 
     60   //WEH - this doesn't compile.  I think that the 'or' here sets teh nondeterministic 
    6161        response, but I don't think that that's what we intend. 
    6262   typedef typename 
  • colin/trunk/src/AmplApplication.cpp

    r5821 r5890  
    677677   Any base_init_point = tmp.second->set_nl_file(fname, &data->info); 
    678678 
     679   std::set<ObjectType> exclude; 
     680   exclude.insert(ObjectType::get<OptApplication_RealDomain>()); 
     681   exclude.insert(ObjectType::get<OptApplication_IntDomain>()); 
     682   this->reference_external_app_data(tmp.second, exclude); 
     683    
     684   // reset the underlying real domain into the mixed int domain 
     685   set_num_real_vars(data->info.NumReal); 
     686   set_num_int_vars(data->info.NumInteger, data->info.NumBinary); 
     687 
     688   // map the variable bounds into the mixed int domain 
     689   vector<Real_t>::iterator l = data->info.lower.begin(); 
     690   vector<Real_t>::iterator u = data->info.upper.begin(); 
     691   vector<Real_t> rl; 
     692   vector<Real_t> ru; 
     693   vector<int>    il; 
     694   vector<int>    iu; 
     695   rl.reserve(data->info.NumReal); 
     696   ru.reserve(data->info.NumReal); 
     697   il.reserve(data->info.NumInteger); 
     698   iu.reserve(data->info.NumInteger); 
     699   vector<char>::iterator var = data->info.var_type.begin(); 
     700   vector<char>::iterator varEnd = data->info.var_type.end(); 
     701   bool bounds_ok = true; 
     702   int i; 
     703   for( ; var != varEnd; ++var ) 
     704   { 
     705      if ( *var == 0 ) 
     706      { 
     707         rl.push_back(*(l++)); 
     708         ru.push_back(*(u++)); 
     709      } 
     710      else if ( *var == 1 ) 
     711      { 
     712         i = (int)(0.5 + *l); 
     713         bounds_ok &= ( fabs((double)i - *l) < EPS ); 
     714         il.push_back(i); 
     715         ++l; 
     716 
     717         i = (int)(0.5 + *u); 
     718         bounds_ok &= ( fabs((double)i - *u) < EPS ); 
     719         iu.push_back(i); 
     720         ++u; 
     721      } 
     722      else if ( *var != 2 ) 
     723         EXCEPTION_MNGR(std::runtime_error, "AmplApplication::set_nl_file(): " 
     724                        "invalid variable type found (" << *var << ")"); 
     725   } 
     726   if ( ! bounds_ok ) 
     727      EXCEPTION_MNGR(std::runtime_error, "AmplApplication::set_nl_file(): " 
     728                     "non-integer bound supplied for integer variable"); 
     729 
    679730   Any init_point; 
    680731   map_domain(base_init_point, init_point, false); 
     
    696747         EXCEPTION_MNGR(std::runtime_error, "AmplApplication::map_domain(): " 
    697748                        "real domain size mismatch (" << vars.Real().size() 
    698                         << " != " << data->info.NumReal); 
     749                        << " != " << data->info.NumReal <<")"); 
    699750      if ( vars.Integer().size() != data->info.NumInteger ) 
    700751         EXCEPTION_MNGR(std::runtime_error, "AmplApplication::map_domain(): " 
    701752                        "integer domain size mismatch ("  
    702753                        << vars.Integer().size() 
    703                         << " != " << data->info.NumInteger); 
     754                        << " != " << data->info.NumInteger << ")"); 
    704755      if ( vars.Binary().size() != data->info.NumBinary ) 
    705756         EXCEPTION_MNGR(std::runtime_error, "AmplApplication::map_domain(): " 
    706757                        "binary domain size mismatch (" << vars.Binary().size() 
    707                         << " != " << data->info.NumBinary); 
     758                        << " != " << data->info.NumBinary << ")"); 
    708759       
    709760      BasicArray<double> &relaxed = native.set<BasicArray<double> >(); 
  • colin/trunk/src/AmplDriver.cpp

    r5819 r5890  
    251251   // 
    252252   solver->set_problem(problem.first); 
    253    solver->add_initial_point(initial_point); 
     253   //OptApplication_Base* a = solver->get_problem_handle().operator->(); 
     254   //while ( a != NULL ) 
     255   //{ 
     256   //   std::cerr << "Problem: " << utilib::demangledName(typeid(*a)) 
     257   //             << std::endl; 
     258   //   a = a->get_wrapped_application(); 
     259   //} 
     260   //std::cerr << "initial point = " << initial_point << std::endl; 
     261   if ( !initial_point.empty() ) 
     262      solver->add_initial_point(initial_point); 
    254263 
    255264   // 
Note: See TracChangeset for help on using the changeset viewer.