本文整理汇总了C++中model类的典型用法代码示例。如果您正苦于以下问题:C++ model类的具体用法?C++ model怎么用?C++ model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: require_not_has_merged
void merger::add(const model& m) {
require_not_has_merged();
if (m.is_target())
add_target(m);
BOOST_LOG_SEV(lg, debug) << "adding model: "
<< m.name().qualified();
BOOST_LOG_SEV(lg, debug) << "contents: " << m;
models_.insert(std::make_pair(m.name(), m));
}
开发者ID:Niam99,项目名称:dogen,代码行数:11,代码来源:merger.cpp
示例2: write_all_output
void write_all_output(model& m, const output_container& out, sz how_many,
const std::string& output_name,
const std::vector<std::string>& remarks) {
if(out.size() < how_many)
how_many = out.size();
VINA_CHECK(how_many <= remarks.size());
ofile f(make_path(output_name));
VINA_FOR(i, how_many) {
m.set(out[i].c);
m.write_model(f, i+1, remarks[i]); // so that model numbers start with 1
}
开发者ID:jandom,项目名称:autodock-vina,代码行数:11,代码来源:main.cpp
示例3: chain3DOF
void chain3DOF( model &M)
{
cout << "Creating a chain3DOF model" << endl;
// make a chain model
double m = 0.0; // mass of links
double L = 1.0; // length of each chain link
int N = 3;
// define N, parent, pitch, Xtree, I
M.setN(N);
// deifne size
M.setParent( linspace<irowvec>( 0, N-1, N) );
// define vector (3D pos) argument for xtree
M.setXtree(0, xlt( zeros<vec>(3) ) );
M.setXtree(1, rotx( -math::pi()/2 ) );
M.setXtree(2, roty( math::pi()/2 ) );
// cdefine center of mass 3D pos vector
vec com = zeros<vec>(3);
vec inertia = zeros<vec>(3);
M.setI(0, mcI( m, com, diagmat(inertia)) );
M.setI(1, mcI( m, com, diagmat(inertia)) );
com(0) = L/2.0;
m = 1.0;
// define inertia
inertia = m*pow(L,2)/12.0 * ones<vec>(3);
inertia(0) = 0.01; // no thickness in this direction
M.setI(2, mcI( m, com, diagmat(inertia)) );
// RIGID BODY
RBbox* box1 = new RBbox( m, L, L/5, L/5);
RBnull* null1 = new RBnull();
M.setRB( 0, null1);
M.setRB( 1, null1);
M.setRB( 2, box1);
// define pitch
M.setPitch( 2*ones<rowvec>(N) );
/*
M.setXtree(0, xlt(zeros<vec>(3)));
M.setXtree(1, rotx( math::pi()/2) );
M.setXtree(2, roty( math::pi()/2) );
*/
}
开发者ID:chrisdembia,项目名称:feather,代码行数:57,代码来源:main.cpp
示例4: index_objects
void concept_indexer::index_objects(model& m) {
BOOST_LOG_SEV(lg, debug) << "Indexing objects: " << m.objects().size();
std::unordered_set<qname> processed_qnames;
for (auto& pair : m.objects()) {
auto& o(pair.second);
if (o.generation_type() == generation_types::no_generation)
continue;
index_object(o, m, processed_qnames);
}
}
开发者ID:pgannon,项目名称:dogen,代码行数:13,代码来源:concept_indexer.cpp
示例5: index_concepts
void property_indexer::index_concepts(model& m) {
BOOST_LOG_SEV(lg, debug) << "Indexing concepts: " << m.concepts().size();
std::unordered_set<sml::qname> processed_qnames;
for (auto& pair : m.concepts()) {
auto& c(pair.second);
if (c.generation_type() == generation_types::no_generation)
continue;
index_concept(c, m, processed_qnames);
}
}
开发者ID:pgannon,项目名称:dogen,代码行数:13,代码来源:property_indexer.cpp
示例6: Mstep
void parameters::Mstep(datafile dat, model mod){
const MatrixXi & omega=mod.Get_model(),mat=dat.Get_mat_datafile();
const VectorXd & eff=dat.Get_eff_datafile();
for (int k=0;k<m_proba.cols();k++){
m_propor(k)= (eff.array()*(m_proba.col(k)).array()/m_proba.rowwise().sum().array()).sum() / eff.sum();
for (int b=0;b<mat.cols();b++){
if ((omega.row(k).array()==b).any()){
const VectorXi & who=mod.Get_var_block(k,b);
m_param[k][b].Mstep(who,mat,m_proba_block[k].col(b),m_proba.col(k).array()/m_proba.rowwise().sum().array(),eff);
}
}
}
}
开发者ID:rforge,项目名称:clustericat,代码行数:13,代码来源:parameters.cpp
示例7: read_notify_list
void read_notify_list(model& aModel, std::function<bool()> aErrorFunction)
{
notify& theNotifyList = aModel.notify_list();
neolib::xml xmlNotifyList(true);
std::ifstream input((aModel.root_path() + "notify_list.xml").c_str());
xmlNotifyList.read(input);
if (xmlNotifyList.error() && aErrorFunction && aErrorFunction())
{
theNotifyList.entries().clear();
write_notify_list(aModel);
return;
}
theNotifyList.loading(true);
for (neolib::xml::element::const_iterator i = xmlNotifyList.root().begin(); i != xmlNotifyList.root().end(); ++i)
{
if (i->name() == "entry")
{
notify_entry_ptr e(new notify_entry);
for (neolib::xml::element::const_iterator j = i->begin(); j != i->end(); ++j)
{
if (j->name() == "user")
e->user() = user(j->attribute_value("value"), casemapping::rfc1459, false, true);
if (j->name() == "server_network" || j->name() == "server_group")
e->server().first = j->attribute_value("value");
if (j->name() == "server_name")
e->server().second = j->attribute_value("value");
if (j->name() == "channel")
e->channel() = j->attribute_value("value");
if (j->name() == "action")
e->action() = static_cast<notify_entry::action_e>(neolib::string_to_integer<char>(j->attribute_value("value")));
if (j->name() == "event")
e->event() = static_cast<notify_entry::event_e>(neolib::string_to_integer<char>(j->attribute_value("value")));
if (j->name() == "data")
e->data() = j->attribute_value("value");
}
if (e->user().nick_name().empty())
e->user().nick_name() = "*";
if (e->channel().empty())
e->channel() = "*";
theNotifyList.entries().push_back(e);
}
}
theNotifyList.loading(false);
}
开发者ID:FlibbleMr,项目名称:neoirc,代码行数:49,代码来源:notify.cpp
示例8: EvaluateModel
void EvaluateModel(
const Config& config, const model& nn, propagator& prop_validation,
const shared_ptr<Corpus>& test_corpus, const shared_ptr<Vocabulary>& vocab,
double& current_learning_rate, double& current_validation_ll) {
if (test_corpus->size() > 0) {
double log_likelihood = 0.0;
Matrix<double,Dynamic,Dynamic> scores(vocab->size(), config.minibatch_size);
Matrix<double,Dynamic,Dynamic> output_probs(vocab->size(), config.minibatch_size);
MinibatchExtractor extractor(test_corpus, vocab, config);
cerr << endl;
cerr << "Validation minibatches: " << endl;
int num_batches = (test_corpus->size() - 1) / config.minibatch_size + 1;
for (int batch = 0; batch < num_batches; batch++) {
if (batch % 50 == 0) {
cerr << batch << "... ";
}
data_size_t start_index = config.minibatch_size * batch;
MatrixInt minibatch = extractor.extract(start_index);
prop_validation.fProp(minibatch.topRows(config.ngram_size - 1));
// Do full forward prop through output word embedding layer
start_timer(4);
prop_validation.output_layer_node.param->fProp(prop_validation.second_hidden_activation_node.fProp_matrix, scores);
stop_timer(4);
// And softmax and loss. Be careful of short minibatch
double minibatch_log_likelihood;
start_timer(5);
SoftmaxLogLoss().fProp(
scores.leftCols(minibatch.cols()),
minibatch.row(config.ngram_size - 1),
output_probs,
minibatch_log_likelihood);
stop_timer(5);
log_likelihood += minibatch_log_likelihood;
}
cerr << endl;
cerr << "Validation log-likelihood: " << log_likelihood << endl;
cerr << " perplexity: " << exp(-log_likelihood / test_corpus->size()) << endl;
// If the validation perplexity decreases, halve the learning rate.
if (current_validation_ll != 0 && log_likelihood < current_validation_ll) {
current_learning_rate /= 2;
} else {
current_validation_ll = log_likelihood;
if (config.model_output_file != "") {
cerr << "Writing model to " << config.model_output_file << endl;
ofstream fout(config.model_output_file);
nn.write(fout);
vocab->write(fout);
cerr << "Done writing model" << endl;
}
}
}
}
开发者ID:pauldb89,项目名称:nplm,代码行数:60,代码来源:trainNeuralNetwork.cpp
示例9: fg
void helper_expander::expand(
const variability::meta_model::feature_model& feature_model,
const formatters::repository& frp, model& fm) const {
const auto fg(make_feature_group(feature_model));
const auto cfg(make_configuration(fg, fm));
populate_helper_properties(cfg, frp, fm.formattables());
}
开发者ID:DomainDrivenConsulting,项目名称:dogen,代码行数:7,代码来源:helper_expander.cpp
示例10: render
//--Implementations
void render(){
//--Render the scene
//clear the screen
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Enable Shader
glUseProgram(program);
sunMVP = projection * view * sunModel;
glUniformMatrix4fv(loc_mvpmat, 1, GL_FALSE, glm::value_ptr(sunMVP));
sun.renderModel(program);
for(int i = 0; i < numModels; i++){
mvp[i] = projection * view * model[i];
}
//upload the matrix to the shader
for(int i = 0; i < numModels; i++){
glUniformMatrix4fv(loc_mvpmat, 1, GL_FALSE, glm::value_ptr(mvp[i]));
models[i].renderModel(program);
}
//swap the buffers
glutSwapBuffers();
}
开发者ID:connorkirby32,项目名称:CS480Kirby,代码行数:36,代码来源:main.cpp
示例11: parseModel
/*
parse a give model, to fill in a map
We use map to sort assignments
*/
void parseModel(solver *sv, model m, std::map<std::string, VARIBLE_VALUE> *res)
{
for (unsigned j = 0; j < m.size(); j++)
{
Z3_ast a, av;
VARIBLE_VALUE vv;
context *ctx = &(sv->ctx());
Z3_func_decl constant = Z3_get_model_constant(*ctx, m, j);
std::string var = m[j].name().str();//get variable's name
vv.name = var;
Z3_sort var_sort = Z3_get_range(*ctx, m[j]);
std::string var_type = Z3_sort_to_string(*ctx, var_sort);
if (var_type == "Bool")
{
vv.type = "bool";
Z3_eval_func_decl(*ctx, m, constant, &av);
std::stringstream ss;
ss << to_expr(*ctx, av);
vv.value = ss.str();
vv.size = 1;
}
else if (var_type.find("(_ BitVec", 0) == 0) //bitvector
{
vv.type = "bitvector";
vv.size = Z3_get_bv_sort_size(*ctx, var_sort);
a = Z3_mk_app(*ctx, Z3_get_model_constant(*ctx, m, j), 0, 0);
av = a;
Z3_eval(*ctx, m, a, &av);//get variable's value
vv.value = Z3_get_numeral_string(*ctx, av);
}
res->erase(vv.name);
res->insert(std::make_pair(vv.name, vv));
}
}
开发者ID:brokendragon,项目名称:All-SMT-Solver,代码行数:38,代码来源:dynamicAsChild.cpp
示例12: recurse_generalization
std::list<name> generalization_indexer::
recurse_generalization(const model& m, const name& leaf,
const object& o, generalization_details& d) const {
if (!o.is_child())
return std::list<name> { o.name() };
const auto i(o.relationships().find(relationship_types::parents));
if (i == o.relationships().end() || i->second.empty()) {
const auto qn(o.name().qualified());
BOOST_LOG_SEV(lg, error) << child_with_no_parents << qn;
BOOST_THROW_EXCEPTION(indexing_error(child_with_no_parents + qn));
}
std::list<name> original_parents;
for (const auto& parent : i->second) {
auto j(m.objects().find(parent));
if (j == m.objects().end()) {
const auto qn(parent.qualified());
BOOST_LOG_SEV(lg, error) << parent_not_found << qn;
BOOST_THROW_EXCEPTION(indexing_error(parent_not_found + qn));
}
const auto op(recurse_generalization(m, leaf, j->second, d));
if (op.empty()) {
const auto qn(parent.qualified());
BOOST_LOG_SEV(lg, error) << child_with_no_original_parent << qn;
BOOST_THROW_EXCEPTION(
indexing_error(child_with_no_original_parent + qn));
}
for (const auto qn : op)
original_parents.push_back(qn);
d.original_parents[parent] = op;
BOOST_LOG_SEV(lg, debug) << "Type: "
<< parent.qualified()
<< " has original parents: " << op;
d.leaves[parent].push_back(leaf);
BOOST_LOG_SEV(lg, debug) << "Type is a leaf of: "
<< parent.qualified();
}
d.original_parents[o.name()] = original_parents;
return original_parents;
}
开发者ID:Niam99,项目名称:dogen,代码行数:46,代码来源:generalization_indexer.cpp
示例13: _scm
bool sls_engine::full_eval(model & mdl) {
model::scoped_model_completion _scm(mdl, true);
for (expr* a : m_assertions) {
checkpoint();
if (!mdl.is_true(a)) {
TRACE("sls", tout << "Evaluation: false\n";);
return false;
}
开发者ID:bishoksan,项目名称:z3,代码行数:8,代码来源:sls_engine.cpp
示例14:
parameters::parameters(datafile dat, model nv_mod, model ref_mod,parameters ref_param,int compo,int iter){
const MatrixXi & omega=nv_mod.Get_model(),ref_omega=ref_mod.Get_model(),mat=dat.Get_mat_datafile();
const int g=omega.rows(),unique=mat.rows();
m_proba=ref_param.m_proba;
m_proba_block.resize(g);
m_param.resize(g);
for (int k=0;k<g;k++){
if (k!=compo){
m_param[k].resize(omega.rowwise().maxCoeff()(k)+1);
m_param[k]=ref_param.m_param[k];
m_proba_block[k].resize(unique,omega.rowwise().maxCoeff()(k)+1);
m_proba_block[k]=ref_param.m_proba_block[k];
for (int b=0;b<(omega.rowwise().maxCoeff()(k)+1) ;b++){
if ((omega.row(k).array()==b).any()){
m_param[k][b]=ref_param.m_param[k][b];
}
}
}else{
m_param[k].resize(omega.rowwise().maxCoeff()(k)+1);
m_proba_block[k].resize(unique,omega.rowwise().maxCoeff()(k)+1);
for (int b=0;b<(omega.rowwise().maxCoeff()(k)+1) ;b++){
if ((omega.row(k).array()==b).any()){
if ((((omega.row(k).array()==b)==(ref_omega.row(k).array()==b)).prod())==1){
m_param[k][b]=ref_param.m_param[k][b];
}else{
m_param[k][b]=param_block(k,b,dat,nv_mod,m_proba.col(k).array()/m_proba.rowwise().sum().array(),1);
if ((omega.row(k).array()==b).count()>1){
int prem=0;
while(omega(k,prem)!=b){prem++;}
if (mat.col(prem).maxCoeff()>5){
m_param[k][b]=m_param[k][b].Optimise_gamma(k,b,dat,nv_mod,5,m_proba.col(k).array()/m_proba.rowwise().sum().array(),dat.Get_eff_datafile());
}
}
}
}
}
}
}
m_propor=uniforme(g);
Probapost( nv_mod , mat );
Compte_nbparam(dat,nv_mod);
Likelihood(dat.Get_eff_datafile());
Estimation(1,0,iter,dat,nv_mod);
}
开发者ID:rforge,项目名称:clustericat,代码行数:45,代码来源:parameters.cpp
示例15: read_element
void json_hydrator::
read_element(const boost::property_tree::ptree& pt, model& m) const {
qname qn;
qn.model_name(model_name(m));
read_module_path(pt, m, qn);
const auto simple_name_value(pt.get<std::string>(simple_name_key));
qn.simple_name(simple_name_value);
const auto documentation(pt.get_optional<std::string>(documentation_key));
const auto lambda([&](type& t) {
BOOST_LOG_SEV(lg, debug) << "Processing type: "
<< sml::string_converter::convert(qn);
t.name(qn);
t.origin_type(m.origin_type());
t.generation_type(m.generation_type());
if (documentation)
t.documentation(*documentation);
const auto scope(dynamic::scope_types::entity);
t.extensions(create_dynamic_extensions(pt, scope));
});
const auto meta_type_value(pt.get<std::string>(meta_type_key));
if (meta_type_value == meta_type_object_value) {
object o;
lambda(o);
const auto ot(pt.get_optional<std::string>(object_type_key));
o.object_type(to_object_type(ot));
m.objects().insert(std::make_pair(qn, o));
} else if (meta_type_value == meta_type_primitive_value) {
primitive p;
lambda(p);
m.primitives().insert(std::make_pair(qn, p));
}
else {
BOOST_LOG_SEV(lg, error) << invalid_meta_type << meta_type_value;
BOOST_THROW_EXCEPTION(
hydration_error(invalid_meta_type + meta_type_value));
}
}
开发者ID:pgannon,项目名称:dogen,代码行数:44,代码来源:json_hydrator.cpp
示例16: populate
void generalization_indexer::
populate(const generalization_details& d, model& m) const {
for (const auto& pair : d.leaves) {
const auto& n(pair.first);
auto i(m.objects().find(n));
if (i == m.objects().end()) {
const auto qn(n.qualified());
BOOST_LOG_SEV(lg, error) << object_not_found << qn;
BOOST_THROW_EXCEPTION(indexing_error(object_not_found + qn));
}
const auto rt(relationship_types::leaves);
i->second.relationships()[rt] = pair.second;
i->second.relationships()[rt].sort();
const auto omn(m.name().location().original_model_name());
for (const auto& l : pair.second) {
if (l.location().original_model_name() == omn)
m.leaves().insert(l);
}
}
for (const auto& pair : d.original_parents) {
const auto& n(pair.first);
auto i(m.objects().find(n));
if (i == m.objects().end()) {
const auto qn(n.qualified());
BOOST_LOG_SEV(lg, error) << object_not_found << qn;
BOOST_THROW_EXCEPTION(indexing_error(object_not_found + qn));
}
auto& o(i->second);
if (!o.is_child()) {
// a bit of a hack, top-level types have themselves as the
// original parent of the container just to make our life easier
BOOST_LOG_SEV(lg, debug) << "Type has parents but is not a child: "
<< n.qualified();
continue;
}
const auto rt(relationship_types::original_parents);
o.relationships()[rt] = pair.second;
for (const auto& opn : pair.second) {
const auto j(m.objects().find(opn));
if (j == m.objects().end()) {
const auto qn(opn.qualified());
BOOST_LOG_SEV(lg, error) << object_not_found << qn;
BOOST_THROW_EXCEPTION(indexing_error(object_not_found + qn));
}
o.is_original_parent_visitable(j->second.is_visitable());
}
}
}
开发者ID:Niam99,项目名称:dogen,代码行数:54,代码来源:generalization_indexer.cpp
示例17: Probapost
void parameters::Probapost(model mod, const MatrixXi & mat){
const MatrixXi & omega=mod.Get_model();
m_proba=MatrixXd::Ones(mat.rows(),omega.rows());
for (int k = 0; k < omega.rows(); ++k) {
m_proba_block[k]=m_proba_block[k].Ones(mat.rows(),(omega.rowwise().maxCoeff()(k)+1));
for (int b = 0; b < (omega.rowwise().maxCoeff()(k)+1); ++b){
if ((omega.row(k).array()==b).any()){
const VectorXi & who=mod.Get_var_block(k,b);
if (who.rows()>1){
m_proba_block[k].col(b)=m_param[k][b].proba_indpt(who,mat)+m_param[k][b].proba_dpt(who,mat);
}else{
m_proba_block[k].col(b)=m_param[k][b].proba_indpt(who,mat);
}
}
}
m_proba.col(k)=m_propor(k)* (m_proba_block[k].rowwise().prod()).array();
}
}
开发者ID:rforge,项目名称:clustericat,代码行数:19,代码来源:parameters.cpp
示例18: operator
// clean up
void ssd::operator()(model& m, const precalculate& p, const igrid& ig, output_type& out, change& g, const vec& v) const { // g must have correct size
out.e = m.eval_deriv(p, ig, v, out.c, g);
fl factor = initial_factor;
VINA_U_FOR(i, evals) {
if(factor < min_factor) break;
output_type candidate(out);
candidate.c.increment(g, -factor);
change candidate_g(g);
candidate.e = m.eval_deriv(p, ig, v, candidate.c, candidate_g);
if(candidate.e <= out.e) {
out = candidate;
g = candidate_g;
factor *= up;
}
else {
factor *= down;
}
}
out.coords = m.get_heavy_atom_movable_coords();
}
开发者ID:Ashod,项目名称:vina,代码行数:21,代码来源:ssd.cpp
示例19: Estimation_discrete
void parameters::Estimation_discrete(int nbtent, datafile dat, model mod){
const MatrixXi & omega=mod.Get_model();
const int g=omega.rows();
for (int k=0;k<g;k++){
for (int b=0;b<(omega.row(k).maxCoeff()+1);b++){
if ((omega.row(k).array()==b).count()>1){
m_param[k][b]=m_param[k][b].Optimise_gamma(k,b,dat,mod,nbtent, m_proba.col(k).array()/m_proba.rowwise().sum().array(),dat.Get_eff_datafile());
}
}
}
}
开发者ID:rforge,项目名称:clustericat,代码行数:12,代码来源:parameters.cpp
示例20: update_containing_module
inline void update_containing_module(model& m,
AssociativeContainerOfContainable& c) {
for (auto& pair : c) {
auto& s(pair.second);
s.containing_module(containing_module(m, s.name()));
if (!s.containing_module())
continue;
auto i(m.modules().find(*s.containing_module()));
if (i == m.modules().end()) {
const auto sn(s.containing_module()->simple());
BOOST_LOG_SEV(lg, error) << missing_module << sn;
BOOST_THROW_EXCEPTION(expansion_error(missing_module + sn));
}
BOOST_LOG_SEV(lg, debug) << "Adding type to module. Type: '"
<< s.name().qualified()
<< "' Module: '" << i->first.qualified();
i->second.members().push_back(s.name());
}
}
开发者ID:Niam99,项目名称:dogen,代码行数:22,代码来源:modules_expander.cpp
注:本文中的model类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论