经典的8拼图属于滑块系列.我的书(人工智能Stuart Russell和peter Norwig的现代方法)说8-puzzle有9个/ 2个可能的状态.但为什么/ 2?你怎么得到这个?
我无法理解命题逻辑中的解析规则是什么.解决方案是否只是简单地说明了一个句子可以扩展和以另一种形式书写的规则?
以下是命题逻辑的简单分辨率算法.该函数返回通过解析它的2输入获得的所有可能子句的集合.我无法理解算法的工作原理,有人可以向我解释一下吗?
function PL-RESOLUTION(KB,?) returns true or false
inputs: KB, the knowledge base, a sentence ? in propositional logic, the query, a
sentence in propositional logic
clauses <--- the set of clauses in the CNF representation of KB ? ¬?
new <--- {}
loop do
for each Ci, Cj in clauses do
resolvents <----- PL-RESOLVE(Ci, Cj)
if resolvents contains the empty clause then return true
new <--- new ? resolvents
if new ? clauses then return false
clauses <---- clauses …Run Code Online (Sandbox Code Playgroud) 该算法取自人工智能现代方法.我发现这很多功能递归真的很混乱.特别是,EXTEND()函数做了什么,递归调用的目的是DPLL()什么?
可能重复:
C中的"CALLBACK"声明有什么作用?
WindowProc()函数的原型就是这个
LRESULT CALLBACK WindowProc(HWND hWnd,UINT message , WPARAM wParan, LPARAM lParam);
Run Code Online (Sandbox Code Playgroud)
但是我从来没有遇到过CALLBACK关键字,我只知道回调函数是你将指针传递给另一个函数的函数,那么这个CALLBACK到底是什么?它做了什么?
我无法理解以下关于命题逻辑和蕴涵的算法,取自人工智能现代方法一书.
一种用于确定命题蕴涵的真值表枚举算法.TT代表真值表.PL-TRUE?如果句子在模型中保存,则返回true.变量模型仅代表某些变量的部分模型分配.函数调用EXTEND(P,true,model)返回一个新的部分模型,其中P的值为true.
function TT-ENTAILS? (KB,?) returns true or false
inputs: KB, the knowledge base, a sentence in propositional logic
?, the query, a sentence in propositional logic
symbols <--- a list of the propositional symbols in KB and ?
return TT-CHECK-ALL(KB,?,symbols,[])
Run Code Online (Sandbox Code Playgroud)
function TT-CHECK-ALL(KB,?,symbols,model ) returns true or false
if EMPTY?(symbols) then
if PL-TRUE?(KB, model) then return PL-TRUE?(?,model)
else return true
else do
P <---FIRST(symbols); rest <--- REST(symbols)
return TT-CHECK-ALL(KB,?,rest,EXTEND(P,true,model) and
TT-CHECK-ALL(KB, ?, rest, EXTEND(P,false,model)
Run Code Online (Sandbox Code Playgroud) 
我可以得到for each循环的解释,因为它对我没有多大意义.特别是,STANDARDIZE-APART()和第二个最后一行做什么?
是的 FOL_BC_ASK(KB,[p1...,pn|REST(goals)],COMPOSE(@',@)) U ans
这有什么不对:
我收到所有5个定义的错误:
error C3698: 'System::String ^' : cannot use this type as argument of 'gcnew'
error C2512: 'System::String::String' : no appropriate default constructor available
array<String^>^ arr = gcnew array<String^>
{
gcnew String^ "Madam I'm Adam.",
gcnew String^ "Don't cry for me,Marge and Tina.", //error C2143: syntax error : missing '}' before 'string' AND error C2143: syntax error : missing ';' before 'string'
gcnew String^ "Lid off a daffodil.",
gcnew String^ "Red lost Soldier.",
gcnew String^ "Cigar? Toss it in a …Run Code Online (Sandbox Code Playgroud) 使用函数指针而不是函数本身的真正好处是什么?它会使执行更快吗?或者当它传递给另一个函数时它是否提供了便利?
我的mfc程序在客户区域中绘制了以下形状 - 现在我想在其旁边放置一个按钮以重新排列形状.
我知道我可以使用工具栏或菜单按钮,但有没有办法可以在框旁边放置一个按钮?这样的事情:

// inheritence experiment
#include"stdafx.h"
#include<iostream>
using namespace std;
class base
{
private:
int i;
};
class derived: public base
{
private:
int j;
};
int main()
{
cout << endl << sizeof(derived) << endl << sizeof(base);
derived o1;
base o2;
cout << endl << sizeof(o1) << endl << sizeof(o2);
}
Run Code Online (Sandbox Code Playgroud)
我得到这个输出:
8
4
8
4
为什么会这样?基类的私有数据成员不会继承到派生类中,那么为什么我得到8个字节,派生的大小和o1?
我有一个CPolygon 派生自班级的班级CElement.[我在这里利用多态].
class CElement : public CObject
{
public:
virtual ~CElement();
virtual void Draw(CDC* pDC){};
CPoint vertices[11];
protected:
CElement();
};
Run Code Online (Sandbox Code Playgroud)
class CPolygon : public CElement
{
public:
CPolygon(CPoint mFirstPoint,CPoint mSecondPoint);
~CPolygon(void);
virtual void Draw(CDC* pDC);
protected:
CPoint mStartPoint;
CPoint mEndPoint;
CPolygon(void);
};
Run Code Online (Sandbox Code Playgroud)
当我尝试将数组分配给verticesCElement对象的成员时,我收到错误:expression must be a modifiable Lvalue
CElement* a = new CPolygon(mFirstPoint,mSecondPoint);
a->vertices=vertices; //here!!
Run Code Online (Sandbox Code Playgroud)
为什么不工作?
algorithm ×5
logic ×4
c++ ×3
visual-c++ ×2
ascii ×1
button ×1
c++-cli ×1
inheritance ×1
mfc ×1
polymorphism ×1
unicode ×1
winapi ×1
windows ×1