• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ipopt::SmartPtr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ipopt::SmartPtr的典型用法代码示例。如果您正苦于以下问题:C++ SmartPtr类的具体用法?C++ SmartPtr怎么用?C++ SmartPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SmartPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: chooseOptions

  /** Ouptut a bonmin.opt file with options default values and short descritpions.*/
  void
  RegisteredOptions::writeBonminOpt(std::ostream &os, ExtraCategoriesInfo which){
      std::list< Ipopt::RegisteredOption * > options;
      chooseOptions(which, options);

      //Create journalist to write to os
      Ipopt::Journalist jnlst;
      Ipopt::SmartPtr<Ipopt::StreamJournal> J = new Ipopt::StreamJournal("options_journal", Ipopt::J_ALL);
      J->SetOutputStream(&os);
      J->SetPrintLevel(Ipopt::J_DOCUMENTATION, Ipopt::J_SUMMARY);
      jnlst.AddJournal(GetRawPtr(J));

      std::string registeringCategory = "";
      for(std::list< Ipopt::RegisteredOption * >::iterator i = options.begin();
           i != options.end() ; i++)
       {
          if((*i)->RegisteringCategory() != registeringCategory){
           registeringCategory = (*i)->RegisteringCategory();
             os<<std::endl<<"# registering category: "<<registeringCategory<<std::endl<<std::endl;
           }
           os<<"bonmin.";
           os.setf(std::ios::left);
           os.width(37);
           os<<(*i)->Name()<<" ";
           os.width(10);
           os<<makeNumber(defaultAsString(*i))<<"\t#";
           os<<(*i)->ShortDescription();
           os<<std::endl;            
       }
    }
开发者ID:coin-or,项目名称:Bonmin,代码行数:31,代码来源:BonRegisteredOptions.cpp


示例2: StrongBranchingSolver

  LpBranchingSolver::LpBranchingSolver(BabSetupBase * b) :
      StrongBranchingSolver(b->nonlinearSolver()),
      lin_(NULL),
      warm_(NULL),
      ecp_(NULL)
  {
    Ipopt::SmartPtr<TNLPSolver> tnlp_solver =
       static_cast<TNLPSolver *> (b->nonlinearSolver()->solver());
    Ipopt::SmartPtr<Ipopt::OptionsList> options = tnlp_solver->options();

	    options->GetIntegerValue("ecp_max_rounds_strong",
	                             maxCuttingPlaneIterations_,
                                     b->nonlinearSolver()->prefix());
	    options->GetNumericValue("ecp_abs_tol_strong",
                                     abs_ecp_tol_,
                                     b->nonlinearSolver()->prefix());
	    options->GetNumericValue("ecp_rel_tol_strong",
                                     rel_ecp_tol_,
                                     b->nonlinearSolver()->prefix());
	    int dummy;
	    options->GetEnumValue("lp_strong_warmstart_method", 
                                  dummy,
                                  b->nonlinearSolver()->prefix());
	    warm_start_mode_ = (WarmStartMethod) dummy;
	  }
开发者ID:coin-or,项目名称:Bonmin,代码行数:25,代码来源:BonLpBranchingSolver.cpp


示例3: registerOptions

void HeuristicInnerApproximation::registerOptions(Ipopt::SmartPtr<
    Bonmin::RegisteredOptions> roptions) {
  roptions->SetRegisteringCategory("Initial Approximations descriptions",
      RegisteredOptions::UndocumentedCategory);
  roptions->AddStringOption2("heuristic_inner_approximation",
      "if yes runs the InnerApproximation heuristic", "yes", "no",
      "don't run it", "yes", "runs the heuristic", "");

        roptions->setOptionExtraInfo("heuristic_inner_approximation", 63);
}
开发者ID:coin-or,项目名称:Bonmin,代码行数:10,代码来源:BonHeuristicInnerApproximation.cpp


示例4:

 void
 LpBranchingSolver::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions)
 {
   roptions->SetRegisteringCategory("ECP based strong branching",RegisteredOptions::UndocumentedCategory);
   roptions->AddLowerBoundedIntegerOption
   ("ecp_max_rounds_strong",
    "Set the maximal number of rounds of ECP cuts in strong branching.",
    0,0,
    "");
   roptions->setOptionExtraInfo("ecp_max_rounds_strong",63);
   roptions->AddLowerBoundedNumberOption
   ("ecp_abs_tol_strong",
    "Set the absolute termination tolerance for ECP rounds in strong branching.",
    0,false,1e-6,
    "");
   roptions->setOptionExtraInfo("ecp_abs_tol_strong",63);
   roptions->AddLowerBoundedNumberOption
   ("ecp_rel_tol_strong",
    "Set the relative termination tolerance for ECP rounds in strong branching.",
    0,false,1e-1,
    "");
   roptions->setOptionExtraInfo("ecp_rel_tol_strong",63);
   roptions->AddStringOption2
   ("lp_strong_warmstart_method",
    "Choose method to use for warm starting lp in strong branching",
    "Basis",
    "Basis", "Use optimal basis of node",
    "Clone", "Clone optimal problem of node",
    "(Advanced stuff)");
   roptions->setOptionExtraInfo("lp_strong_warmstart_method",63);
 }
开发者ID:coin-or,项目名称:Bonmin,代码行数:31,代码来源:BonLpBranchingSolver.cpp


示例5: solve

bool IASolverRelaxed::solve()
{
  
  // solve the nlp to get a non-integral solution, which we hope is close to a good integer solution    
  // adapted from HS071 ipopt example

  // p_norm set in constructor. 3 seems to work well, comes close to lex-max-min
  // smaller p has the effect of valuing the fidelity of shorter curves over longer curves more
  // larger p approaches min max
  IANlp *myianlp = new IANlp(iaData, iaSolution, silent);
  Ipopt::SmartPtr<TNLP> mynlp = myianlp; // Ipopt requires the use of smartptrs!
  
  Ipopt::SmartPtr<Ipopt::IpoptApplication> app = IpoptApplicationFactory();
  app->Options()->SetNumericValue("tol", 1e-7); // 2 seems close enough, could do less, say .1
  app->Options()->SetStringValue("mu_strategy", "adaptive");
  // print level 0 to 12, most. Ipopt Default is 5
  int print_level = (silent) ? 0 : 1; // 1, 5
  // int print_level = 5;
  app->Options()->SetIntegerValue("print_level", print_level);  
  // uncomment next line to write the solution to an output file
  // app->Options()->SetStringValue("output_file", "IA.out");  
  // The following overwrites the default name (ipopt.opt) of the options file
  // app->Options()->SetStringValue("option_file_name", "IA.opt");
  
  // Intialize the IpoptApplication and process the options
  Ipopt::ApplicationReturnStatus status;
  status = app->Initialize();
  if (status != Ipopt::Solve_Succeeded) {
    if (!silent)
      printf("\n\n*** Error during ipopt initialization!\n");
    return (int) status;
  }
  
  // Ask Ipopt to solve the problem
  status = app->OptimizeTNLP(mynlp); // the inherited IANlp
  // todo: also check for a valid solution even if ! Solve_Succeeded, such as a sub-optimal time-out
  bool is_solved = (status == Ipopt::Solve_Succeeded);
  bool is_satisfied = is_solved && equal_constraints( false, debugging );
  // don't check even-ness, as those are like the integrality constraints and are not solved here
  
  if (!silent)
  {
    if (is_solved) {
      printf("\n\n*** The relaxed problem solved!");
      if (!is_satisfied)
        printf(" But equality-constraints were VIOLATED!");
      printf("\n");
    }
    else {
      printf("\n\n*** The relaxed problem FAILED!\n");
    }
  }
  return is_satisfied;
}  
开发者ID:vibraphone,项目名称:meshkit,代码行数:54,代码来源:IASolverRelaxed.cpp


示例6: solve

IpoptSolution CppADSolver::solve(OptProblemData &data){
    size_t n = opt_prob->num_of_variables();
    size_t m = opt_prob->num_of_constraints();
    // create the Ipopt interface
    cppad_ipopt_solution solution;
    CppADOptProblemData cppad_data(data);
    Ipopt::SmartPtr<Ipopt::TNLP> cppad_nlp = new cppad_ipopt_nlp(
        n, m, cppad_data.x_i, cppad_data.x_l, cppad_data.x_u, cppad_data.g_l, cppad_data.g_u, &(*fg_info_ptr), &solution
        );

    // Create an instance of the IpoptApplication
    Ipopt::SmartPtr<Ipopt::IpoptApplication> app = new IpoptApplication();

    // turn off any printing
    app->Options()->SetIntegerValue("print_level", 4);
    app->Options()->SetStringValue("sb", "yes");

    // maximum number of iterations
    app->Options()->SetIntegerValue("max_iter", 5000);

    // approximate accuracy in first order necessary conditions;
    // see Mathematical Programming, Volume 106, Number 1, 
    // Pages 25-57, Equation (6)
    app->Options()->SetNumericValue("tol", 1e-9);

    // derivative testing
//    app->Options()->
//    SetStringValue("derivative_test", "second-order");
//    app->Options()-> SetNumericValue(
//            "point_perturbation_radius", 0.
//    );

    // Initialize the IpoptApplication and process the options
    Ipopt::ApplicationReturnStatus status = app->Initialize();
    assert(status == Ipopt::Solve_Succeeded);

    // Run the IpoptApplication
    status = app->OptimizeTNLP(cppad_nlp);
    return IpoptSolution(solution);
}
开发者ID:mayudong07,项目名称:cppad_ipopt_solver,代码行数:40,代码来源:CppADSolver.cpp


示例7: defaultAsString

 static std::string defaultAsString(Ipopt::SmartPtr< Ipopt::RegisteredOption > opt){
   Ipopt::RegisteredOptionType T = opt->Type();
   switch(T){
     case Ipopt::OT_Number: return makeString(opt->DefaultNumber());
     case Ipopt::OT_Integer: return makeString(opt->DefaultInteger());
     case Ipopt::OT_String: return (opt->DefaultString());
     case Ipopt::OT_Unknown: 
     default:
        return "Unknown type of option";
   }
 }
开发者ID:coin-or,项目名称:Bonmin,代码行数:11,代码来源:BonRegisteredOptions.cpp


示例8: Heuristics

 void
 MilpRounding::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions){
   roptions->SetRegisteringCategory("Primal Heuristics (undocumented)", RegisteredOptions::UndocumentedCategory);
  roptions->AddStringOption2(
    "MILP_rounding_heuristic",
    "if yes runs the heuristic",
    "no",
    "no", "don't run it",
    "yes", "runs the heuristic",
    "");
 }
开发者ID:coin-or,项目名称:Bonmin,代码行数:11,代码来源:BonMilpRounding.cpp


示例9:

 void
 HeuristicDiveVectorLength::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions){
   roptions->SetRegisteringCategory("Primal Heuristics", RegisteredOptions::BonminCategory);
  roptions->AddStringOption2(
    "heuristic_dive_vectorLength",
    "if yes runs the Dive VectorLength heuristic",
    "no",
    "no", "",
    "yes", "",
    "");
  roptions->setOptionExtraInfo("heuristic_dive_vectorLength", 63);
 }
开发者ID:tkelman,项目名称:Bonmin,代码行数:12,代码来源:BonHeuristicDiveVectorLength.cpp


示例10:

 void
 FixAndSolveHeuristic::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions){
  roptions->SetRegisteringCategory("Test Heuristics", RegisteredOptions::UndocumentedCategory);
  roptions->AddStringOption2(
    "fix_and_solve_heuristic",
    "if yes runs a heuristic at root where fixes all variables integer in the continuous solution",
    "no",
    "no", "don't run it",
    "yes", "runs the heuristic",
    "");
  roptions->setOptionExtraInfo("fix_and_solve_heuristic", 63);
 }
开发者ID:Flymir,项目名称:coin-all,代码行数:12,代码来源:BonFixAndSolveHeuristic.cpp


示例11: OsiChooseVariable

 BonNWayChoose::BonNWayChoose(BabSetupBase &b, const OsiSolverInterface* solver):
     OsiChooseVariable(solver),
     br_depth_(0),
     bounds_(),
     unit_changes_(),
     num_ps_costs_(),
     num_eval_(),
     geo_means_(0)
 {
   Ipopt::SmartPtr<Ipopt::OptionsList> options = b.options();
   options->GetNumericValue("time_limit", time_limit_, b.prefix());
   options->GetNumericValue("cutoff_multiplier", cutoff_multiplier_, b.prefix());
   options->GetNumericValue("pseudocost_trust_value", pseudocost_trust_value_, b.prefix());
   options->GetIntegerValue("strong_branch_depth", br_depth_, b.prefix());
   options->GetIntegerValue("nway_branch_log_level", log_, b.prefix());
   options->GetEnumValue("do_fixings", do_fixings_, b.prefix());
   options->GetEnumValue("use_geo_means", geo_means_, b.prefix());
   /** Set values of standard branching options.*/
   int numberObjects = solver_->numberObjects();
   std::cout<<"Number objects "<<numberObjects<<std::endl;
   start_time_ = CoinCpuTime();
   OsiObject ** object = solver->objects();
   for (int i=0;i<numberObjects;i++) {
      BonNWayObject * nway = dynamic_cast<BonNWayObject *>(object[i]);
     if(!nway) continue;
     start_nway_ = i;
     break;
   }
   numberObjects -= start_nway_;
 }
开发者ID:coin-or,项目名称:Bonmin,代码行数:30,代码来源:BonNWayChoose.cpp


示例12: discarded

  /** Register OA feasibility checker  options.*/
  void
  OaFeasibilityChecker::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions)
  {
    roptions->SetRegisteringCategory("Feasibility checker using OA cuts", RegisteredOptions::BonminCategory);
    roptions->AddStringOption2("feas_check_cut_types", "Choose the type of cuts generated when an integer feasible solution is found",
                               "outer-approx",
                               "outer-approx", "Generate a set of Outer Approximations cuts.",
                               "Benders", "Generate a single Benders cut.",
                               "If it seems too much memory is used should try Benders to use less");
    roptions->setOptionExtraInfo("feas_check_cut_types", 19);
    

    roptions->AddStringOption3("feas_check_discard_policy", "How cuts from feasibility checker are discarded",
                               "detect-cycles",
                               "detect-cycles", "Detect if a cycle occurs and only in this case force not to discard.",
                               "keep-all", "Force cuts from feasibility checker not to be discarded (memory hungry but sometimes better).",
                               "treated-as-normal", "Cuts from memory checker can be discarded as any other cuts (code may cycle then)",
                               "Normally to avoid cycle cuts from feasibility checker should not be discarded in the node where they are generated. "
                               "However Cbc sometimes does it if no care is taken which can lead to an infinite loop in Bonmin (usually on simple problems). "
                               "To avoid this one can instruct Cbc to never discard a cut but if we do that for all cuts it can lead to memory problems. "
                               "The default policy here is to detect cycles and only then impose to Cbc to keep the cut. "
                               "The two other alternative are to instruct Cbc to keep all cuts or to just ignore the problem and hope for the best");
    roptions->setOptionExtraInfo("feas_check_discard_policy", 19);

    roptions->AddLowerBoundedIntegerOption("generate_benders_after_so_many_oa", "Specify that after so many oa cuts have been generated Benders cuts should be generated instead.",
                                           0, 5000,
                                           "It seems that sometimes generating too many oa cuts slows down the optimization compared to Benders due to the size of the LP. "
                                           "With this option we specify that after so many OA cuts have been generated we should switch to Benders cuts.");
    roptions->setOptionExtraInfo("generate_benders_after_so_many_oa", 19);
  }
开发者ID:coin-or,项目名称:Bonmin,代码行数:31,代码来源:BonOaFeasChecker.cpp


示例13: setParameters

void setParameters(Ipopt::SmartPtr<Ipopt::OptionsList> options)
{
	const char *iptoptLinearSolver = getenv("IPOPT_LINEAR_SOLVER");
	if (!iptoptLinearSolver)
		iptoptLinearSolver = "ma57";
	options->SetStringValue("linear_solver", iptoptLinearSolver);
	if (!strcmp(iptoptLinearSolver, "ma27"))
	{
		/* This helps to improve performance from 0.6 to 0.5 sec */
		options->SetNumericValue("ma27_liw_init_factor", 100.);
		options->SetNumericValue("ma27_la_init_factor", 100.);
	}
	else if (!strcmp(iptoptLinearSolver, "ma57"))
	{
		/*
		 * Decreases performance from 0.04 to 0.13 sec:
		 * options->SetStringValue("ma57_automatic_scaling", "yes");
		 */

		/*
		 * Not evident, whether this helps to increase the performance,
		 * but it already helped to avoid memory reallocations.
		 */
		options->SetNumericValue("ma57_pre_alloc", 100.);
	}

	double ipoptTol = 0.;
	if (tryGetenvDouble("IPOPT_TOL", ipoptTol))
		options->SetNumericValue("tol", ipoptTol);

	double ipoptAcceptableTol = 0.;
	if (tryGetenvDouble("IPOPT_ACCEPTABLE_TOL", ipoptAcceptableTol))
		options->SetNumericValue("acceptable_tol", 1e-3);

	if (getenv("DERIVATIVE_TEST_FIRST"))
		options->SetStringValue("derivative_test", "first-order");
	else if (getenv("DERIVATIVE_TEST_SECOND"))
		options->SetStringValue("derivative_test", "second-order");
	else if (getenv("DERIVATIVE_TEST_ONLY_SECOND"))
		options->SetStringValue("derivative_test", "only-second-order");
	if (getenv("HESSIAN_APPROX"))
		options->SetStringValue("hessian_approximation",
				"limited-memory");

}
开发者ID:ilya-palachev,项目名称:polyhedra-correction-library,代码行数:45,代码来源:correct.cpp


示例14: registerAllOptions

  void RobotSetup::registerAllOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions)
  {
     BonminSetup::registerAllOptions(roptions);
     BonNWayChoose::registerOptions(roptions);


    roptions->AddLowerBoundedIntegerOption("branch_on_frac_only",
        "Starting at given depth branch on the subset of fractional variables (and set the last branch that one of them is 1)",
        0,INT_MAX,"");

    roptions->AddStringOption2("do_a_quick_one",
        "Do we try our luck?",
        "no",
        "no", "Don't (of course).",
        "yes", "Be crazy",
        "");

  }
开发者ID:tkelman,项目名称:Bonmin,代码行数:18,代码来源:RobotSetup.cpp


示例15: unsolved

  void
  BonCbcFullNodeInfo::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions)
  {


    roptions->SetRegisteringCategory("Nonconvex problems", RegisteredOptions::BonminCategory);
    roptions->AddLowerBoundedIntegerOption("max_consecutive_infeasible",
        "Number of consecutive infeasible subproblems before aborting a"
        " branch.",
        0,0,
        "Will continue exploring a branch of the tree until \"max_consecutive_infeasible\""
        "consecutive problems are locally infeasible by the NLP sub-solver.");
    roptions->setOptionExtraInfo("max_consecutive_infeasible",8);

    roptions->SetRegisteringCategory("NLP solution robustness", RegisteredOptions::BonminCategory);
    roptions->AddLowerBoundedIntegerOption
    ("max_consecutive_failures",
     "(temporarily removed) Number $n$ of consecutive unsolved problems before aborting a branch of the tree.",
     0,10,
     "When $n > 0$, continue exploring a branch of the tree until $n$ "
     "consecutive problems in the branch are unsolved (we call unsolved a problem for which Ipopt can not "
     "guarantee optimality within the specified tolerances).");
    roptions->setOptionExtraInfo("max_consecutive_failures",8);

  }
开发者ID:coin-or,项目名称:Bonmin,代码行数:25,代码来源:BonCbcNode.cpp


示例16: registerOptions

void HeuristicInnerApproximation::registerOptions(Ipopt::SmartPtr<
    Bonmin::RegisteredOptions> roptions) {
  roptions->SetRegisteringCategory("Initial Approximations descriptions",
      Bonmin::RegisteredOptions::UndocumentedCategory);
  roptions->AddStringOption2("heuristic_inner_approximation",
      "if yes runs the InnerApproximation heuristic", "yes", "no",
      "don't run it", "yes", "runs the heuristic", "");

 roptions->setOptionExtraInfo("heuristic_inner_approximation", 63);

 roptions->AddLowerBoundedIntegerOption("number_inner_approximation_points",
       "Set the number of points to use for linear inner approximation of nonlinear functions in heuristic",
       1, 20);
 roptions->setOptionExtraInfo("number_inner_approximation_points", 63);

 roptions->AddLowerBoundedNumberOption("inner_time_limit",
       "Time limit for inner approximation",
       0, true, 10, "");
 roptions->setOptionExtraInfo("number_inner_approximation_points", 63);
}
开发者ID:coin-or,项目名称:Bonmin,代码行数:20,代码来源:SepaHeuristicInnerApproximation.cpp


示例17:

  void
  BonNWayChoose::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions)
  {
    roptions->SetRegisteringCategory("NWay Strong branching setup", RegisteredOptions::BonminCategory);
    roptions->AddLowerBoundedIntegerOption("nway_branch_log_level",
                                           "Log level for the branching on nways",
                                           0,1,
                                           "");

    roptions->AddLowerBoundedIntegerOption("strong_branch_depth",
                                           "To which level do we perform strong-branching",
                                           0,0,
                                           "");

    roptions->AddLowerBoundedNumberOption("cutoff_multiplier",
                                           "multiplier applied to cutoff_ for computing pseudo-cost of infeasible sub-problems",
                                           1.,0,3.,
                                           "");

    roptions->AddLowerBoundedNumberOption("pseudocost_trust_value",
                                           "Trust pseudo cost of best nway object if it is above this value",
                                           0.,0,0,
                                           "");

    roptions->AddStringOption2("use_geo_means", "Use geometrical means to average pseudo-costs",
                               "yes", 
                               "no", "Use artihmetical means",
                               "yes", "Use geometrical means","");

    roptions->AddStringOption4("do_fixings",
        "Do we fix variables in strong branching?",
        "all",
        "none", "Don't do any.",
        "in-tree", "Fix only variables in the tree",
        "strong-branching", "Fix variable in strong branching only",
        "all", "Fix whenever possible",
        "");


  }
开发者ID:coin-or,项目名称:Bonmin,代码行数:40,代码来源:BonNWayChoose.cpp


示例18: IpBlasDcopy

  bool
  TNLPSolver::zeroDimension(const Ipopt::SmartPtr<Ipopt::TNLP>& tnlp, ReturnStatus &optimizationStatus)
  {

    int n,m,dum1, dum2;
    Ipopt::TNLP::IndexStyleEnum dum3;
    tnlp->get_nlp_info(n,m,dum1, dum2, dum3);
    double * x_l = new double[n];
    double * x_u = new double[n];
   
    double * g_l = (m>0) ? new double[m] : NULL;
    double * g_u = (m >0) ? new double[m] : NULL;
    
    tnlp->get_bounds_info(n, x_l, x_u, m, g_l , g_u);
    

    for(int i = 0 ; i < n ; i++) {
      if(x_u[i] - x_l[i] > 1e-5)
	{
	  delete [] x_l;
	  delete [] x_u;
          if(m > 0){
	    delete [] g_l;
	    delete [] g_u;
          }
	  return 0;
	}
    }

    //Problem has no variables just check if the unique solution given by the bounds is
    // feasible or not.
    double obj_value;

    tnlp->eval_f(n, x_l, true, obj_value);

    double * x_sol = new double[n];

      
    IpBlasDcopy(n, x_l, 1, x_sol, 1);

    delete [] x_l;
    delete [] x_u;

    double * g_sol = (m > 0) ? new double [m] : NULL;

    tnlp->eval_g(n, x_sol, true, m, g_sol);
    
    optimizationStatus = solvedOptimal;
    for(int i = 0 ; i < m ; i++) {
      if(g_sol[i] - g_l[i] <  - 1e-07 || g_sol[i] - g_u[i] > 1e-07) {
        optimizationStatus = provenInfeasible;
	
	delete [] g_l;
	delete [] g_u;
	double * lam = (m > 0) ? new double[m]: NULL;
	CoinFillN(lam,m,0.);
	double * z = new double[n];
	CoinFillN(z,n,0.);
	tnlp->finalize_solution(Ipopt::LOCAL_INFEASIBILITY,
			       n, x_sol, NULL, NULL, 
			       m, g_sol, NULL, obj_value, NULL, NULL);
	if (m > 0) delete [] lam;
	delete [] z;
	if (m > 0) delete [] g_sol;
	delete [] x_sol;

        return 1;
      }
    }
    if (m > 0) delete [] g_l;
    if (m > 0) delete [] g_u;

    double * lam = (m > 0) ? new double[m] : NULL;
    CoinFillN(lam,m,0.);
    double * z = new double[n];
    CoinFillN(z,n,0.);
    tnlp->finalize_solution(Ipopt::SUCCESS,
			   n, x_sol, z, z,
			   m, g_sol, lam, obj_value, NULL, NULL);
    if (m > 0) delete [] lam;
    delete [] z;
    if (m > 0) delete [] g_sol;
    delete [] x_sol;
    return 1;
  }
开发者ID:coin-or,项目名称:Bonmin,代码行数:85,代码来源:BonTNLPSolver.cpp


示例19: registerOptions

void CouenneAmplInterface::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions) {
	roptions->AddStringOption1("nlfile", "name of an ampl .nl file to get the problem from", "", "*", "name of .nl file");
}
开发者ID:imzye,项目名称:coin,代码行数:3,代码来源:CouenneAmplInterface.cpp


示例20: registerOptions

void CouenneOSInterface::registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions) {
	roptions->AddStringOption1("osilfile", "name of an osil file to read the problem instance from", "", "*", "name of osil file");
}
开发者ID:imzye,项目名称:coin,代码行数:3,代码来源:CouenneOSInterface.cpp



注:本文中的ipopt::SmartPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ irods::resource_plugin_context类代码示例发布时间:2022-05-31
下一篇:
C++ ipc::RequestBuilder类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap