当前位置: 首页>>代码示例>>C++>>正文


C++ Objective::createFluxObjective方法代码示例

本文整理汇总了C++中Objective::createFluxObjective方法的典型用法代码示例。如果您正苦于以下问题:C++ Objective::createFluxObjective方法的具体用法?C++ Objective::createFluxObjective怎么用?C++ Objective::createFluxObjective使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Objective的用法示例。


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

示例1: document

END_TEST

START_TEST(test_FbcExtension_create_and_write_new_geneassociation
)
{
  FbcPkgNamespaces *sbmlns = new FbcPkgNamespaces(3, 1, 2);

  // create the document

  SBMLDocument document(sbmlns);
  document.setConsistencyChecks(LIBSBML_CAT_UNITS_CONSISTENCY, false);
  document.setConsistencyChecks(LIBSBML_CAT_MODELING_PRACTICE, false);

  // create the Model

  Model* model = document.createModel();

  // create the Compartment

  Compartment* compartment = model->createCompartment();
  compartment->setId("compartment");
  compartment->setConstant(true);
  compartment->setSize(1);

  // create the Species

  Species* species = model->createSpecies();
  species->setId("Node1");
  species->setCompartment("compartment");
  species->setBoundaryCondition(false);

  species = model->createSpecies();
  species->setId("Node2");
  species->setCompartment("compartment");
  species->setBoundaryCondition(false);

  Reaction* reaction = model->createReaction();
  reaction->setId("J0");
  reaction->setReversible(false);
  SpeciesReference* reactant = reaction->createReactant();
  reactant->setSpecies("Node0");
  reactant->setStoichiometry(1);
  SpeciesReference* product = reaction->createProduct();
  product->setSpecies("Node1");
  product->setStoichiometry(1);

  // use fbc

  FbcModelPlugin* mplugin = static_cast<FbcModelPlugin*>(model->getPlugin("fbc"));

  fail_unless(mplugin != NULL);

  FluxBound* bound = mplugin->createFluxBound();

  bound->setId("bound1");
  bound->setReaction("J0");
  bound->setOperation("equal");
  bound->setValue(10);

  Objective* objective = mplugin->createObjective();
  objective->setId("obj1");
  objective->setType("maximize");

  FluxObjective* fluxObjective = objective->createFluxObjective();
  fluxObjective->setReaction("J0");
  fluxObjective->setCoefficient(1);

  FbcReactionPlugin* rplug = dynamic_cast<FbcReactionPlugin*>(reaction->getPlugin("fbc"));
  fail_unless(rplug != NULL);

  GeneProductAssociation * ga = rplug->createGeneProductAssociation();
  ga->setId("ga1");
  ga->setAssociation("MG_077 AND MG_321 AND MG_080 AND MG_078 AND MG_079");
  fail_unless(ga->getAssociation() != NULL);

  fail_unless(mplugin->getNumGeneProducts() == 5);

  ga->setAssociation("MG_077 AND MG_321 AND MG_080 AND MG_078 AND MG_079");
  fail_unless(ga->getAssociation() != NULL);

  fail_unless(mplugin->getNumGeneProducts() == 5);


  delete sbmlns;

}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:86,代码来源:TestWriteFbcExtension.cpp

示例2: main


//.........这里部分代码省略.........
  product->setSpecies("Node5");
  product->setStoichiometry(1);
  product->setConstant(true);

  reaction = model->createReaction();
  reaction->setId("J6");
  reaction->setReversible(false);
  reaction->setFast(false);
  reactant = reaction->createReactant();
  reactant->setSpecies("Node5");
  reactant->setStoichiometry(1);
  reactant->setConstant(true);
  product = reaction->createProduct();
  product->setSpecies("Node6");
  product->setStoichiometry(1);
  product->setConstant(true);

  reaction = model->createReaction();
  reaction->setId("J7");
  reaction->setReversible(false);
  reaction->setFast(false);
  reactant = reaction->createReactant();
  reactant->setSpecies("Node6");
  reactant->setStoichiometry(1);
  reactant->setConstant(true);
  product = reaction->createProduct();
  product->setSpecies("Node7");
  product->setStoichiometry(1);
  product->setConstant(true);

  reaction = model->createReaction();
  reaction->setId("J8");
  reaction->setReversible(false);
  reaction->setFast(false);
  reactant = reaction->createReactant();
  reactant->setSpecies("Node5");
  reactant->setStoichiometry(1);
  reactant->setConstant(true);
  product = reaction->createProduct();
  product->setSpecies("Node8");
  product->setStoichiometry(1);
  product->setConstant(true);

  reaction = model->createReaction();
  reaction->setId("J9");
  reaction->setReversible(false);
  reaction->setFast(false);
  reactant = reaction->createReactant();
  reactant->setSpecies("Node8");
  reactant->setStoichiometry(1);
  reactant->setConstant(true);
  product = reaction->createProduct();
  product->setSpecies("Node7");
  product->setStoichiometry(1);
  product->setConstant(true);

  reaction = model->createReaction();
  reaction->setId("J10");
  reaction->setReversible(false);
  reaction->setFast(false);
  reactant = reaction->createReactant();
  reactant->setSpecies("Node7");
  reactant->setStoichiometry(1);
  reactant->setConstant(true);
  product = reaction->createProduct();
  product->setSpecies("Node9");
  product->setStoichiometry(1);
  product->setConstant(true);

  //
  // Get a FbcModelPlugin object plugged in the model object.
  //
  // The type of the returned value of SBase::getPlugin() function is
  // SBasePlugin*, and thus the value needs to be casted for the
  // corresponding derived class.
  //
  FbcModelPlugin* mplugin
      = static_cast<FbcModelPlugin*>(model->getPlugin("fbc"));

  FluxBound* bound= mplugin->createFluxBound();

  bound->setId("bound1");
  bound->setReaction("J0");
  bound->setOperation("equal");
  bound->setValue(10);

  Objective* objective = mplugin->createObjective();
  objective->setId("obj1");
  objective->setType("maximize");

  // mark obj1 as active objective
  mplugin->setActiveObjectiveId("obj1");

  FluxObjective* fluxObjective = objective->createFluxObjective();
  fluxObjective->setReaction("J8");
  fluxObjective->setCoefficient(1);

  writeSBML(document,"fbc_example1.xml");
  delete document;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:101,代码来源:fbc_example1.cpp

示例3: FbcPkgNamespaces

END_TEST

START_TEST(test_FbcExtension_create_and_write_L3V1V1)
{
  FbcPkgNamespaces *sbmlns = new FbcPkgNamespaces(3, 1, 1);

  // create the document

  SBMLDocument *document = new SBMLDocument(sbmlns);
  delete sbmlns;

  // create the Model

  Model* model = document->createModel();

  // create the Compartment

  Compartment* compartment = model->createCompartment();
  compartment->setId("compartment");
  compartment->setConstant(true);
  compartment->setSize(1);

  // create the Species

  Species* species = model->createSpecies();
  species->setId("Node1");
  species->setCompartment("compartment");
  species->setBoundaryCondition(false);

  species = model->createSpecies();
  species->setId("Node2");
  species->setCompartment("compartment");
  species->setBoundaryCondition(false);

  Reaction* reaction = model->createReaction();
  reaction->setId("J0");
  reaction->setReversible(false);
  SpeciesReference* reactant = reaction->createReactant();
  reactant->setSpecies("Node0");
  reactant->setStoichiometry(1);
  SpeciesReference* product = reaction->createProduct();
  product->setSpecies("Node1");
  product->setStoichiometry(1);

  // use fbc

  FbcModelPlugin* mplugin = static_cast<FbcModelPlugin*>(model->getPlugin("fbc"));

  fail_unless(mplugin != NULL);

  FluxBound* bound = mplugin->createFluxBound();

  bound->setId("bound1");
  bound->setReaction("J0");
  bound->setOperation("equal");
  bound->setValue(10);

  Objective* objective = mplugin->createObjective();
  objective->setId("obj1");
  objective->setType("maximize");

  FluxObjective* fluxObjective = objective->createFluxObjective();
  fluxObjective->setReaction("J0");
  fluxObjective->setCoefficient(1);

  string s1 = writeSBMLToStdString(document);

  // check clone()

  SBMLDocument* document2 = document->clone();
  string s2 = writeSBMLToStdString(document2);
  fail_unless(s1 == s2);

  // check operator=

  Model m = *(document->getModel());
  document2->setModel(&m);
  s2 = writeSBMLToStdString(document2);

  fail_unless(s1 == s2);
  delete document2;

  delete document;
}
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:84,代码来源:TestWriteFbcExtension.cpp


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