- 论坛徽章:
- 0
|
1,人工神经网络(ANN)
应该还做不到能够“理解”,只是模拟神经计算过程。
可以用于图像识别。
2,遗传算法(GA)
这个求近似解,在某些情况下很合适,和智能没多少关系。
例如,《可计算性和计算复杂性》里面的旅行家问题:
共n个城市,已知任意2个城市之间的距离,从一个城市出发每个城市到过并且只到过一次,最后回到出发城市。使路程最短。
当n = 100的时候。首先是可以求解的;其次,复杂度很高。np难解
GA 就可以给出解,但可能不是最优解。
3,人工智能
定义、公理是已有的,无法证明的,只能记忆(存储?);定理可以证明的。
外国已经有能把一本书的定理证明的了。
有兴趣可以看一下w3c的owl问题。
4,一定是分工的
当作了人工智能,对下层实现绝对只是提出需求了。
一定分工的,不会是一个人从头到脚都会,可能某块东西做一辈子时间都不够。
好比http之于网卡。
顺便贴一下最近写的份推理源码。
是我向朋友解释,C++可能可以这么干用来推理。
这里,male和female这两个概念,不能同时具有。
对这个xml,自己写的c++类源码。
可能一些处理不当,比如:一致性检查对象释放问题;这里只是说明可能可以用C++这样来做来检查male和female不能同时是这两个概念的方法。
#ifndef OWL_H_
#define OWL_H_
#include <stdio.h>
class Knowledge;
class Consistent;
class disjointWithException;
// 如果 disjointWith 导致不一致,抛出这个异常。
class disjointWithException
{
private:
char msg[128];
public:
const char * getMessage() const
{
return msg;
}
disjointWithException(const char *obj, const char *from, const char *to)
{
sprintf(msg, "Object of '%s', '%s' disjointWith '%s'", obj, from, to);
}
virtual ~disjointWithException()
{
}
};
// Knowledge 一致性检查接口
class Consistent
{
public:
virtual void check(Knowledge *nlg) = 0;
Consistent()
{
}
virtual ~Consistent()
{
}
};
// 知识
class Knowledge
{
// 需要被检查n个一致性,假设最多100个。
Consistent *Consistents[100];
int count;
protected:
void addConsistent(Consistent *c)
{
Consistents[count++] = c;
}
public:
Knowledge()
{
count = 0;
}
void checkConsistent()
{
int total = count;
while (total)
Consistents[--total]->check(this);
}
void check()
{
// 检查一致性,
checkConsistent();
}
virtual ~Knowledge()
{
while(count)
delete Consistents[--count];
}
};
// Knowledge一致性检查的一个实现
template<typename _TypeOne, typename _TypeOther> class disjointWith : public Consistent
{
public:
// 用 C++ RTTI 特性检查不能同时是 _TypeOne 和 _TypeOther 这两种类型。
virtual void check(Knowledge *nlg)
{
_TypeOne *from = dynamic_cast<_TypeOne *>(nlg);
if (0 == from)
return;
_TypeOther *to = dynamic_cast<_TypeOther *>(nlg);
if (0 == from)
return;
throw disjointWithException(typeid(*nlg).name(), typeid(_TypeOne).name(), typeid(_TypeOther).name());
}
disjointWith()
{
}
virtual ~disjointWith()
{
}
};
#endif /*OWL_H_*/
|
#ifndef FAMILY_H_
#define FAMILY_H_
#include "owl.h"
class people;
class female;
class male;
class father;
class mother;
class Marry;
class impossible;
class fufu;
// people ÊÇÒ»ÖÖ Knowledge
class people : public virtual Knowledge
{
public:
people()
{
}
virtual ~people()
{
}
};
// male ÊÇÒ»ÖÖ Knowledge
class male : public virtual Knowledge
{
public:
male()
{
addConsistent(new disjointWith<female, male>);
}
virtual ~male()
{
}
};
// female ÊÇÒ»ÖÖ Knowledge
class female : public virtual Knowledge
{
public:
female()
{
addConsistent(new disjointWith<male, female>);
}
virtual ~female()
{
}
};
class father : public male, public people
{
public:
father()
{
}
virtual ~father()
{
}
};
class mother : public people, public female
{
public:
mother()
{
}
virtual ~mother()
{
}
};
class impossible : public father, public mother
{
public:
impossible()
{
}
virtual ~impossible()
{
}
};
class fufu : public impossible
{
public:
fufu()
{
check();
}
virtual ~fufu()
{
}
};
class Marry : public father
{
public:
Marry()
{
check();
}
virtual ~Marry()
{
}
};
#endif /*FAMILY_H_*/
|
#include <iostream>
#include "family.h"
using namespace std;
int main()
{
try
{
Marry objMarry;
fufu objFufu;
}
catch (const disjointWithException &e)
{
cout << e.getMessage() << endl;
}
return 0;
}
|
[ 本帖最后由 yuanchengjun 于 2008-4-27 15:19 编辑 ] |
|