int main(void){ for(int a, b, v, A, s; scanf("%d %d %d %d %d", &a, &b, &v, &A, &s) == 5; ){ if(!(a | b | v | A | s)) break; printf("%d %d\n", bnc(a, v, A, s, cos), bnc(b, v, A, s, sin)); } return 0; }
int main( int argc, char** argv ){ char* model; int time_limit; int primal_heuristic; char* input_file; int nc; //number of cuts int md; //maxdeep int odd_hole; tms buf1, buf2;; times(&buf1); model = argv[1]; sscanf( argv[2], "%d", &time_limit ); sscanf( argv[3], "%d", &primal_heuristic ); input_file = argv[4]; //sscanf( argv[5], "%d", &nc); //sscanf( argv[6], "%d", &md); //sscanf( argv[7], "%d", &odd_hole); BNC bnc( model, time_limit, primal_heuristic, input_file); bnc.n_cortes = 5; bnc.max_deep = 10; bnc.solve(); times(&buf2); printf("USER_TIME %lf\n",(intmax_t) (buf2.tms_utime - buf1.tms_utime)/100.0); return (0); }
int main(int argc, char** argv) { // Dimension int n = 2; // Box size int d = 3; // Accuracy double eps = 0.1; // Cut analysis depth int ldepth = 1; // Use or not boxed cut bool boxedcut = true; if (argc != 7) BNB_ERROR_REPORT("Usage runpolymi.exe dimension box_size polynom cut_depth use_boxed_cut (0/1) record"); n = atoi(argv[1]); d = atoi(argv[2]); ldepth = atoi(argv[4]); boxedcut = (atoi(argv[5]) == 0) ? false : true; double record = atof(argv[6]); PolyMIFactory polymifact(n, d, argv[3]); NlpProblem<double>* nlp = polymifact.getProb(); /* Setup cut generators */ /* Cut generator for objective*/ NlpRecStore<double> ors(record, nlp); PointCutFactory<double> pfact(&ors); PolyObjective<double>* obj = dynamic_cast<PolyObjective<double>*> (nlp->mObj); PolyEigenSupp objEigenSupp(obj); EigenCutFactory<double> objEigenCutFact(&ors, &objEigenSupp, obj, eps); /* Setup composite cut factory */ CompCutFactory <double> fact; fact.push(&pfact); fact.push(&objEigenCutFact); /* Setup cut applicator */ SmartCutApplicator<double> sca(nlp->mVariables); if (boxedcut == 0) sca.getOptions() = SmartCutApplicator<double>::Options::CUT_BALL_SIMPLE; if (boxedcut == 1) sca.getOptions() = SmartCutApplicator<double>::Options::CUT_BALL_BOXED; if (boxedcut == 2) sca.getOptions() = (SmartCutApplicator<double>::Options::CUT_BALL_SIMPLE | SmartCutApplicator<double>::Options::CUT_BALL_BOXED); /* Setup splitter */ //StdBoxSplitter<double> splt; MIBoxSplitter<double> splt(nlp->mVariables); /* Setup solver */ BNCSolver<double> bnc(&fact, &sca, &splt, ldepth); BNBTree tree(makeRootNode(*nlp)); BNBNode* root = tree.getRoot(); WFSDFSManager manager; manager.setOptions(WFSDFSManager::Options::DFS); manager.reg(root); BNCState<double> state(&manager, &ors); state.mForest.push_back(&tree); /* Solving problem */ bool ru; long long int iters = 10000000; bnc.solve(iters, state, ru); /* Printing results*/ std::cout << iters << " iterations\n"; std::cout << "Record = " << state.mRecord->getValue() << "\n"; VecUtils::vecPrint(n, (double*) ors.getX()); return 0; }