void RegisteredOptions::fillAmplOptionList(ExtraCategoriesInfo which, Ipopt::AmplOptionsList * amplOptList){ std::list<int> test; std::list< Ipopt::RegisteredOption * > options; chooseOptions(which, options); for(std::list< Ipopt::RegisteredOption * >::iterator i = options.begin(); i != options.end() ; i++) { std::string name = "bonmin."; name += (*i)->Name(); Ipopt::RegisteredOptionType T = (*i)->Type(); Ipopt::AmplOptionsList::AmplOptionType type; switch(T){ case Ipopt::OT_Number: type = Ipopt::AmplOptionsList::Number_Option; break; case Ipopt::OT_Integer: type = Ipopt::AmplOptionsList::Integer_Option; break; case Ipopt::OT_String: type = Ipopt::AmplOptionsList::String_Option; break; case Ipopt::OT_Unknown: default: throw CoinError("RegisteredOptions","fillAmplOptionList","Unknown option type"); } amplOptList->AddAmplOption(name, name, type, (*i)->ShortDescription()); } }
bool menu( game_t ** game ) { options_t options; char str[MAX_COM_LEN]; modeOption_t modeOption; clearError(); modeOption = chooseMode(); raiseErrorIf( errorCode() == NOERROR, errorCode(), true ); switch( modeOption ){ case MODE0: case MODE1: case MODE2: options = chooseOptions( (modus_t)modeOption ); raiseErrorIf( errorCode() == NOERROR, errorCode(), true ); *game = newGame( &options ); return true; case READFROMFILE: drawText("Enter the name of the file:\n"); *game = readGame( askString( str ) ); return true; case QUIT: default: return false; } }
/** Output Latex/Html options documentation.*/ void RegisteredOptions::writeLatexHtmlDoc(std::ostream &os, ExtraCategoriesInfo which){ std::list< Ipopt::RegisteredOption * > options; chooseOptions(which, options); os<<"\\latexhtml{}{"<<std::endl; os<<"\\HCode{"<<std::endl; writeHtmlOptionsTable(os, options); os<<"}\n}"<<std::endl; //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<<"\\subsection{"<<registeringCategory<<"}"<<std::endl; os<<"\\label{sec:"<<makeSpaceLess(registeringCategory)<<"}"<<std::endl; os<<"\\htmlanchor{sec:"<<makeSpaceLess(registeringCategory)<<"}"<<std::endl; } (*i)->OutputLatexDescription(jnlst); } }
/** 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; } }
/** Output html table of options.*/ void RegisteredOptions::writeHtmlOptionsTable(std::ostream &of, ExtraCategoriesInfo which){ //Print table header of<<"<table border=\"1\">"<<std::endl; //sort options by categories and alphabetical order std::list< Ipopt::RegisteredOption * > sortedOptions; chooseOptions(which, sortedOptions); writeHtmlOptionsTable(of, sortedOptions); }