⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlefgnash.cc

📁 Gambit 是一个游戏库理论软件
💻 CC
📖 第 1 页 / 共 4 页
字号:
						 gnull, status);            if (newSupport == support) {	break;      }      else {	support = newSupport;      }    }    SubgameSolver algorithm;    p_support.GetGame().MarkSubgames();    if (p_support.GetGame().NumPlayers() == 2) {      nfgEnumMixed<double> *subAlgorithm = new nfgEnumMixed<double>;      subAlgorithm->SetStopAfter(2);      algorithm.SetAlgorithm(subAlgorithm);    }    else {      efgPolEnum *subAlgorithm = new efgPolEnum;      subAlgorithm->SetStopAfter(2);      algorithm.SetAlgorithm(subAlgorithm);    }    return algorithm.Solve(p_support, p_status);  }  catch (...) {    return gList<BehavSolution>();  }}//========================================================================//                       class panelEfgTwoPerfect//========================================================================class panelEfgTwoPerfect : public panelEfgNashAlgorithm {public:  panelEfgTwoPerfect(wxWindow *);  efgNashAlgorithm *GetAlgorithm(void) const;};panelEfgTwoPerfect::panelEfgTwoPerfect(wxWindow *p_parent)  : panelEfgNashAlgorithm(p_parent){  SetAutoLayout(true);  wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);  wxStaticBox *centerBox = new wxStaticBox(this, wxID_STATIC,					   "TwoPerfectSolve");  wxStaticBoxSizer *centerSizer = new wxStaticBoxSizer(centerBox, wxVERTICAL);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "Find two subgame perfect "				    "Nash equilibria"),		   0, wxALL | wxCENTER, 5);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "This algorithm requires no parameters"),		   0, wxALL | wxCENTER, 5);  topSizer->Add(centerSizer, 1, wxALL | wxCENTER, 5);  SetSizer(topSizer);  topSizer->Fit(this);  topSizer->SetSizeHints(this);  Layout();  Show(false);}efgNashAlgorithm *panelEfgTwoPerfect::GetAlgorithm(void) const{  return new efgTwoPerfect;}//========================================================================//                         class efgAllPerfect//========================================================================class efgAllPerfect : public efgNashAlgorithm {public:  gText GetAlgorithm(void) const { return "AllPerfect"; }  gList<BehavSolution> Solve(const EFSupport &, gStatus &);};gList<BehavSolution> efgAllPerfect::Solve(const EFSupport &p_support,					  gStatus &p_status){  gArray<int> players(p_support.GetGame().NumPlayers());  for (int pl = 1; pl <= players.Length(); pl++) {    players[pl] = pl;  }  try {    EFSupport support(p_support);    while (true) {      gNullStatus status;      gNullOutput gnull;      EFSupport newSupport = support.Undominated(true, true, players,						 gnull, status);            if (newSupport == support) {	break;      }      else {	support = newSupport;      }    }    SubgameSolver algorithm;    p_support.GetGame().MarkSubgames();    if (p_support.GetGame().NumPlayers() == 2) {      nfgEnumMixed<double> *subAlgorithm = new nfgEnumMixed<double>;      subAlgorithm->SetStopAfter(0);      algorithm.SetAlgorithm(subAlgorithm);    }    else {      efgPolEnum *subAlgorithm = new efgPolEnum;      subAlgorithm->SetStopAfter(0);      algorithm.SetAlgorithm(subAlgorithm);    }    return algorithm.Solve(p_support, p_status);  }  catch (...) {    return gList<BehavSolution>();  }}//========================================================================//                       class panelEfgAllPerfect//========================================================================class panelEfgAllPerfect : public panelEfgNashAlgorithm {public:  panelEfgAllPerfect(wxWindow *);  efgNashAlgorithm *GetAlgorithm(void) const;};panelEfgAllPerfect::panelEfgAllPerfect(wxWindow *p_parent)  : panelEfgNashAlgorithm(p_parent){  SetAutoLayout(true);  wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);  wxStaticBox *centerBox = new wxStaticBox(this, wxID_STATIC,					   "AllPerfectSolve");  wxStaticBoxSizer *centerSizer = new wxStaticBoxSizer(centerBox, wxVERTICAL);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "Find all subgame perfect "				    "Nash equilibria"),		   0, wxALL | wxCENTER, 5);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "This algorithm requires no parameters"),		   0, wxALL | wxCENTER, 5);  topSizer->Add(centerSizer, 1, wxALL | wxCENTER, 5);  SetSizer(topSizer);  topSizer->Fit(this);  topSizer->SetSizeHints(this);  Layout();  Show(false);}efgNashAlgorithm *panelEfgAllPerfect::GetAlgorithm(void) const{  return new efgAllPerfect;}//========================================================================//                       class efgOneSequential//========================================================================class efgOneSequential : public efgNashAlgorithm {public:  gText GetAlgorithm(void) const { return "OneSequential"; }  gList<BehavSolution> Solve(const EFSupport &, gStatus &);};gList<BehavSolution> efgOneSequential::Solve(const EFSupport &p_support,					     gStatus &p_status){  try {    efgQre algorithm;    return algorithm.Solve(p_support, p_status);  }  catch (...) {    return gList<BehavSolution>();  }}//========================================================================//                     class panelEfgOneSequential//========================================================================class panelEfgOneSequential : public panelEfgNashAlgorithm {public:  panelEfgOneSequential(wxWindow *);  efgNashAlgorithm *GetAlgorithm(void) const;};panelEfgOneSequential::panelEfgOneSequential(wxWindow *p_parent)  : panelEfgNashAlgorithm(p_parent){  SetAutoLayout(true);  wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);  wxStaticBox *centerBox = new wxStaticBox(this, wxID_STATIC,					   "OneSequentialSolve");  wxStaticBoxSizer *centerSizer = new wxStaticBoxSizer(centerBox, wxVERTICAL);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "Find one sequential Nash equilibrium"),		   0, wxALL | wxCENTER, 5);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "This algorithm requires no parameters"),		   0, wxALL | wxCENTER, 5);  topSizer->Add(centerSizer, 1, wxALL | wxCENTER, 5);  SetSizer(topSizer);  topSizer->Fit(this);  topSizer->SetSizeHints(this);  Layout();  Show(false);}efgNashAlgorithm *panelEfgOneSequential::GetAlgorithm(void) const{  return new efgOneSequential;}//========================================================================//                       class efgTwoSequential//========================================================================class efgTwoSequential : public efgNashAlgorithm {public:  gText GetAlgorithm(void) const { return "TwoSequential"; }  gList<BehavSolution> Solve(const EFSupport &, gStatus &);};gList<BehavSolution> efgTwoSequential::Solve(const EFSupport &p_support,					     gStatus &p_status){  try {    p_support.GetGame().MarkSubgames();    SubgameSolver algorithm;    efgLiap *subAlgorithm = new efgLiap;    subAlgorithm->SetStopAfter(2);    algorithm.SetAlgorithm(subAlgorithm);    return algorithm.Solve(p_support, p_status);  }  catch (...) {    return gList<BehavSolution>();  }}//========================================================================//                     class panelEfgTwoSequential//========================================================================class panelEfgTwoSequential : public panelEfgNashAlgorithm {public:  panelEfgTwoSequential(wxWindow *);  efgNashAlgorithm *GetAlgorithm(void) const;};panelEfgTwoSequential::panelEfgTwoSequential(wxWindow *p_parent)  : panelEfgNashAlgorithm(p_parent){  SetAutoLayout(true);  wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);  wxStaticBox *centerBox = new wxStaticBox(this, wxID_STATIC,					   "TwoSequentialSolve");  wxStaticBoxSizer *centerSizer = new wxStaticBoxSizer(centerBox, wxVERTICAL);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "Find two sequential Nash equilibria"),		   0, wxALL | wxCENTER, 5);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "This algorithm requires no parameters"),		   0, wxALL | wxCENTER, 5);  topSizer->Add(centerSizer, 1, wxALL | wxCENTER, 5);  SetSizer(topSizer);  topSizer->Fit(this);  topSizer->SetSizeHints(this);  Layout();  Show(false);}efgNashAlgorithm *panelEfgTwoSequential::GetAlgorithm(void) const{  return new efgTwoSequential;}//========================================================================//                       class efgAllSequential//========================================================================class efgAllSequential : public efgNashAlgorithm {public:  gText GetAlgorithm(void) const { return "AllSequential"; }  gList<BehavSolution> Solve(const EFSupport &, gStatus &);};gList<BehavSolution> efgAllSequential::Solve(const EFSupport &p_support,					     gStatus &p_status){  try {    p_support.GetGame().MarkSubgames();    SubgameSolver algorithm;    efgLiap *subAlgorithm = new efgLiap;    subAlgorithm->SetStopAfter(0);    algorithm.SetAlgorithm(subAlgorithm);    return algorithm.Solve(p_support, p_status);  }  catch (...) {    return gList<BehavSolution>();  }}//========================================================================//                     class panelEfgAllSequential//========================================================================class panelEfgAllSequential : public panelEfgNashAlgorithm {public:  panelEfgAllSequential(wxWindow *);  efgNashAlgorithm *GetAlgorithm(void) const;};panelEfgAllSequential::panelEfgAllSequential(wxWindow *p_parent)  : panelEfgNashAlgorithm(p_parent){  SetAutoLayout(true);  wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL);  wxStaticBox *centerBox = new wxStaticBox(this, wxID_STATIC,					   "AllSequentialSolve");  wxStaticBoxSizer *centerSizer = new wxStaticBoxSizer(centerBox, wxVERTICAL);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "Find all sequential Nash equilibria"),		   0, wxALL | wxCENTER, 5);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "This algorithm requires no parameters"),		   0, wxALL | wxCENTER, 5);  topSizer->Add(centerSizer, 1, wxALL | wxCENTER, 5);  SetSizer(topSizer);  topSizer->Fit(this);  topSizer->SetSizeHints(this);  Layout();  Show(false);}efgNashAlgorithm *panelEfgAllSequential::GetAlgorithm(void) const{  return new efgAllSequential;}//========================================================================//                      class panelEfgEnumPure//========================================================================class panelEfgEnumPure : public panelEfgNashAlgorithm {private:  wxRadioBox *m_solveUsing;  wxCheckBox *m_findAll;  wxSpinCtrl *m_stopAfter;  // Private event handlers  void OnFindAll(wxCommandEvent &);public:  panelEfgEnumPure(wxWindow *);  efgNashAlgorithm *GetAlgorithm(void) const;  DECLARE_EVENT_TABLE()};BEGIN_EVENT_TABLE(panelEfgEnumPure, panelEfgNashAlgorithm)  EVT_CHECKBOX(idCHECKBOX_FINDALL, panelEfgEnumPure::OnFindAll)END_EVENT_TABLE()panelEfgEnumPure::panelEfgEnumPure(wxWindow *p_parent)  : panelEfgNashAlgorithm(p_parent){  SetAutoLayout(true);  wxBoxSizer *topSizer = new wxBoxSizer(wxHORIZONTAL);  wxStaticBox *centerBox = new wxStaticBox(this, wxID_STATIC, "EnumPureSolve");  wxStaticBoxSizer *centerSizer = new wxStaticBoxSizer(centerBox, wxVERTICAL);  centerSizer->Add(new wxStaticText(this, wxID_STATIC,				    "Find Nash equilibria by enumerating "				    "pure strategies"),		   0, wxALL | wxCENTER, 5);  wxString solveChoices[] = { "Extensive form", "Normal form" };  m_solveUsing = new wxRadioBox(this, -1, "Find equilibria using",				wxDefaultPosition, wxDefaultSize,				2, solveChoices, 1, wxRA_SPECIFY_ROWS);  centerSizer->Add(m_solveUsing, 0, wxALL | wxCENTER, 5);  wxStaticBox *stopAfterBox = new wxStaticBox(this, wxID_STATIC,					      "Number to find");  wxStaticBoxSizer *stopAfterSizer = new wxStaticBoxSizer(stopAfterBox,							  wxHORIZONTAL);  m_findAll = new wxCheckBox(this, idCHECKBOX_FINDALL, "Find all");  m_findAll->SetValue(false);  stopAfterSizer->Add(m_findAll, 0, wxALL | wxCENTER, 5);  stopAfterSizer->Add(new wxStaticText(this, wxID_STATIC, "Stop after"),		      0, wxALL | wxCENTER, 5);  m_stopAfter = new wxSpinCtrl(this, -1, "1",			       wxDefaultPosition, wxDefaultSize,			       wxSP_ARROW_KEYS, 1, 10000);  stopAfterSizer->Add(m_stopAfter, 0, wxALL | wxCENTER, 5);  centerSizer->Add(stopAfterSizer, 0, wxALL | wxCENTER, 5);  topSizer->Add(centerSizer, 1, wxALL | wxCENTER, 0);  SetSizer(topSizer);  topSizer->Fit(this);  topSizer->SetSizeHints(this);  Layout();  Show(false);}void panelEfgEnumPure::OnFindAll(wxCommandEvent &){  m_stopAfter->Enable(!m_findAll->GetValue());}efgNashAlgorithm *panelEfgEnumPure::GetAlgorithm(void) const{  SubgameSolver *algorithm = new SubgameSolver;    if (m_solveUsing->GetSelection() == 0) {    efgEnumPure *subAlgorithm = new efgEnumPure;    subAlgorithm->SetStopAfter((m_findAll->GetValue()) ?			       0 : m_stopAfter->GetValue());    algorithm->SetAlgorithm(subAlgorithm);  }  else {    nfgEnumPure *subAlgorithm = new nfgEnumPure;    subAlgorithm->SetStopAfter((m_findAll->GetValue()) ?			       0 : m_stopAfter->GetValue());    algorithm->SetAlgorithm(subAlgorithm);  }  return algorithm;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -