• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang caes.ArgGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/carneades/carneades-4/internal/engine/caes.ArgGraph的典型用法代码示例。如果您正苦于以下问题:Golang ArgGraph类的具体用法?Golang ArgGraph怎么用?Golang ArgGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ArgGraph类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: TestOddLoop2

func TestOddLoop2(t *testing.T) {
	var a1, a2, a3 caes.Argument
	var P = caes.Statement{Text: "P"}
	var Q = caes.Statement{Text: "Q"}
	var R = caes.Statement{Text: "R"}
	a1 = caes.Argument{
		Conclusion: &Q,
		Premises:   []caes.Premise{caes.Premise{Stmt: &P}}}
	a2 = caes.Argument{
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &R}}}
	a3 = caes.Argument{
		Conclusion: &R,
		Premises:   []caes.Premise{caes.Premise{Stmt: &Q}}}
	var ag = caes.ArgGraph{
		Statements: []*caes.Statement{&P, &Q, &R},
		Arguments:  []*caes.Argument{&a1, &a2, &a3}}
	l := ag.GroundedLabelling()
	expected := l[&P] == caes.Out && l[&Q] == caes.Out && l[&R] == caes.Out
	if !expected {
		t.Errorf("TestOddLoop2 failed\n")
		fmt.Printf("label(P)=%v\n", l[&P])
		fmt.Printf("label(Q)=%v\n", l[&Q])
		fmt.Printf("label(R)=%v\n", l[&R])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:26,代码来源:caes_test.go


示例2: TestIndependentSupportLoop

func TestIndependentSupportLoop(t *testing.T) {
	var a1, a2, a3 caes.Argument
	var P = caes.Statement{Text: "P", Args: []*caes.Argument{&a1, &a3}}
	var Q = caes.Statement{Text: "Q", Args: []*caes.Argument{&a2}}
	var R = caes.Statement{Text: "R", Assumed: true}
	a1 = caes.Argument{
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &Q}}}
	a2 = caes.Argument{
		Conclusion: &Q,
		Premises:   []caes.Premise{caes.Premise{Stmt: &P}}}
	a3 = caes.Argument{
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &R}}}
	var ag = caes.ArgGraph{
		Statements: []*caes.Statement{&P, &Q, &R},
		Arguments:  []*caes.Argument{&a1, &a2, &a3}}
	l := ag.GroundedLabelling()
	expected := l[&P] == caes.In && l[&Q] == caes.In && l[&R] == caes.In
	if !expected {
		t.Errorf("TestIndependentSupportLoop failed\n")
		fmt.Printf("label(P)=%v\n", l[&P])
		fmt.Printf("label(Q)=%v\n", l[&Q])
		fmt.Printf("label(R)=%v\n", l[&R])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:26,代码来源:caes_test.go


示例3: TestTandem

func TestTandem(t *testing.T) {
	var jw = caes.Statement{
		Text:    "John wants to ride on the tandem.",
		Assumed: true}
	var mw = caes.Statement{
		Text:    "Mary wants to ride on the tandem.",
		Assumed: true}
	var sw = caes.Statement{
		Text:    "Suzy wants to ride on the tandem.",
		Assumed: true}
	var a1, a2, a3, a4, a5, a6 caes.Argument
	var jt = caes.Statement{
		Text: "John is riding on the tandem.",
		Args: []*caes.Argument{&a1}}
	var mt = caes.Statement{
		Text: "Mary is riding on the tandem.",
		Args: []*caes.Argument{&a2}}
	var st = caes.Statement{
		Text: "Suzy is riding on the tandem.",
		Args: []*caes.Argument{&a3}}
	var i1 caes.Issue
	var jmt = caes.Statement{
		Text:  "John and Mary are riding on the tandem.",
		Issue: &i1,
		Args:  []*caes.Argument{&a4}}
	var jst = caes.Statement{
		Text:  "John and Suzy are riding on the tandem.",
		Issue: &i1,
		Args:  []*caes.Argument{&a5}}
	var mst = caes.Statement{
		Text:  "Mary and Suzy are riding on the tandem.",
		Issue: &i1,
		Args:  []*caes.Argument{&a6}}
	i1 = caes.Issue{
		Standard:  caes.PE,
		Positions: []*caes.Statement{&jmt, &jst, &mst}}
	a1 = caes.Argument{Conclusion: &jt, Premises: []caes.Premise{caes.Premise{Stmt: &jw}}}
	a2 = caes.Argument{Conclusion: &mt, Premises: []caes.Premise{caes.Premise{Stmt: &mw}}}
	a3 = caes.Argument{Conclusion: &st, Premises: []caes.Premise{caes.Premise{Stmt: &sw}}}
	a4 = caes.Argument{
		Conclusion: &jmt,
		Premises:   []caes.Premise{caes.Premise{Stmt: &jt}, caes.Premise{Stmt: &mt}}}
	a5 = caes.Argument{
		Conclusion: &jst,
		Premises:   []caes.Premise{caes.Premise{Stmt: &jt}, caes.Premise{Stmt: &st}}}
	a6 = caes.Argument{
		Conclusion: &mst,
		Premises:   []caes.Premise{caes.Premise{Stmt: &mt}, caes.Premise{Stmt: &st}}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&jw, &mw, &sw, &jt, &mt, &st, &jmt, &jst, &mst},
		Arguments:  []*caes.Argument{&a1, &a2, &a3, &a4, &a5, &a6}}
	l := ag.GroundedLabelling()
	expected := l[&jmt] == caes.Out &&
		l[&jst] == caes.Out &&
		l[&mst] == caes.Out
	if !expected {
		t.Errorf("TestTandem failed\n")
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:60,代码来源:caes_test.go


示例4: TestFrisian

func TestFrisian(t *testing.T) {
	var a1, a2 caes.Argument
	var dutch = caes.Statement{
		Text: "Wiebe is Dutch.",
		Args: []*caes.Argument{&a1}}
	var tall = caes.Statement{
		Text: "Wiebe is tall.",
		Args: []*caes.Argument{&a2}}
	var frisian = caes.Statement{Text: "Wiebe is Frisian.", Assumed: true}
	a1 = caes.Argument{
		Conclusion: &dutch,
		Premises:   []caes.Premise{caes.Premise{Stmt: &frisian}}}
	a2 = caes.Argument{
		Conclusion: &tall,
		Premises:   []caes.Premise{caes.Premise{Stmt: &dutch}}}
	var ag = caes.ArgGraph{
		Statements: []*caes.Statement{&frisian, &dutch, &tall},
		Arguments:  []*caes.Argument{&a1, &a2}}
	l := ag.GroundedLabelling()
	expected := l[&tall] == caes.In && l[&dutch] == caes.In
	if !expected {
		t.Errorf("TestFrisian failed\n")
		fmt.Printf("label(dutch)=%v\n", l[&dutch])
		fmt.Printf("label(tall)=%v\n", l[&tall])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:26,代码来源:caes_test.go


示例5: TestReinstatement2

func TestReinstatement2(t *testing.T) {
	var a1, a2, a3 caes.Argument
	var i1 caes.Issue
	var P = caes.Statement{
		Text:  "P",
		Issue: &i1,
		Args:  []*caes.Argument{&a1, &a3}}
	var notP = caes.Statement{
		Text:  "not P",
		Issue: &i1,
		Args:  []*caes.Argument{&a2}}
	var Q = caes.Statement{
		Text:    "Q",
		Assumed: true}
	var R = caes.Statement{
		Text:    "R",
		Assumed: true}
	var S = caes.Statement{
		Text:    "S",
		Assumed: true}
	i1 = caes.Issue{
		Standard:  caes.PE,
		Positions: []*caes.Statement{&P, &notP}}
	a1 = caes.Argument{
		Scheme: &caes.Scheme{
			Eval: func(arg *caes.Argument, l caes.Labelling) float64 {
				return 0.4
			}},
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &Q}}}
	a2 = caes.Argument{
		Scheme: &caes.Scheme{
			Eval: func(arg *caes.Argument, l caes.Labelling) float64 {
				return 0.5
			}},
		Conclusion: &notP,
		Premises:   []caes.Premise{caes.Premise{Stmt: &R}}}
	a3 = caes.Argument{
		Scheme: &caes.Scheme{
			Eval: func(arg *caes.Argument, l caes.Labelling) float64 {
				return 0.6
			}},
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &S}}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&P, &notP, &Q, &R, &S},
		Arguments:  []*caes.Argument{&a1, &a2, &a3}}
	l := ag.GroundedLabelling()
	expected := l[&P] == caes.In && l[&notP] == caes.Out
	if !expected {
		t.Errorf("TestReinstatement2 failed\n")
		fmt.Printf("label(P)=%v\n", l[&P])
		fmt.Printf("label(not P)=%v\n", l[&notP])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:56,代码来源:caes_test.go


示例6: TestLibrary

func TestLibrary(t *testing.T) {
	var a1, a2, a3 caes.Argument
	var i1 caes.Issue
	var snores = caes.Statement{
		Text:    "The person is snooring in the library.",
		Assumed: true}
	var professor = caes.Statement{
		Text:    "The person is a professor.",
		Assumed: true}
	var misbehaves = caes.Statement{
		Text: "The person is misbehaving.",
		Args: []*caes.Argument{&a1}}
	var accessDenied = caes.Statement{
		Text:  "The person is denied access to the library.",
		Issue: &i1,
		Args:  []*caes.Argument{&a2}}
	var accessNotDenied = caes.Statement{
		Text:  "The person is not denied access to the library.",
		Issue: &i1,
		Args:  []*caes.Argument{&a3}}
	i1 = caes.Issue{
		Standard:  caes.PE,
		Positions: []*caes.Statement{&accessDenied, &accessNotDenied}}
	a1 = caes.Argument{
		Conclusion: &misbehaves,
		Premises:   []caes.Premise{caes.Premise{Stmt: &snores}}}
	a2 = caes.Argument{
		Scheme: &caes.Scheme{
			Eval: func(arg *caes.Argument, l caes.Labelling) float64 {
				return 0.5
			}},
		Conclusion: &accessDenied,
		Premises:   []caes.Premise{caes.Premise{Stmt: &misbehaves}}}
	a3 = caes.Argument{
		Scheme: &caes.Scheme{
			Eval: func(arg *caes.Argument, l caes.Labelling) float64 {
				return 0.6
			}},
		Conclusion: &accessNotDenied,
		Premises:   []caes.Premise{caes.Premise{Stmt: &professor}}}
	var ag = caes.ArgGraph{
		Issues: []*caes.Issue{&i1},
		Statements: []*caes.Statement{&snores, &professor, &misbehaves,
			&accessDenied, &accessNotDenied},
		Arguments: []*caes.Argument{&a1, &a2, &a3}}
	l := ag.GroundedLabelling()
	expected := l[&accessDenied] == caes.Out && l[&accessNotDenied] == caes.In
	if !expected {
		t.Errorf("TestLibrary failed\n")
		fmt.Printf("label(accessDenied)=%v\n", l[&accessDenied])
		fmt.Printf("label(accessNotDenied)=%v\n", l[&accessNotDenied])
		fmt.Printf("label(misbehaves)=%v\n", l[&misbehaves])
		fmt.Printf("label(snores)=%v\n", l[&snores])
		fmt.Printf("label(professor)=%v\n", l[&professor])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:56,代码来源:caes_test.go


示例7: TestSelfDefeat3

// The arguments in TestSelfDefeat2 are irrelevant. We get the
// same labelling without them.
func TestSelfDefeat3(t *testing.T) {
	var i1 caes.Issue
	var P = caes.Statement{Text: "P", Issue: &i1}
	var notP = caes.Statement{Text: "not P", Issue: &i1}
	i1 = caes.Issue{Positions: []*caes.Statement{&P, &notP}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&P, &notP},
		Arguments:  []*caes.Argument{}}
	l := ag.GroundedLabelling()
	expected := l[&P] == caes.Out && l[&notP] == caes.Out
	if !expected {
		t.Errorf("TestSelfDefeat3 failed\n")
		fmt.Printf("label(P)=%v\n", l[&P])
		fmt.Printf("label(not P)=%v\n", l[&notP])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:19,代码来源:caes_test.go


示例8: TestSupportLoop

func TestSupportLoop(t *testing.T) {
	var a1, a2 caes.Argument
	var P = caes.Statement{Text: "P", Args: []*caes.Argument{&a1}}
	var Q = caes.Statement{Text: "Q", Args: []*caes.Argument{&a2}}
	a1 = caes.Argument{
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &Q}}}
	a2 = caes.Argument{
		Conclusion: &Q,
		Premises:   []caes.Premise{caes.Premise{Stmt: &P}}}
	var ag = caes.ArgGraph{
		Statements: []*caes.Statement{&P, &Q},
		Arguments:  []*caes.Argument{&a1, &a2}}
	l := ag.GroundedLabelling()
	expected := l[&P] == caes.Out && l[&Q] == caes.Out
	if !expected {
		t.Errorf("TestSupportLoop failed\n")
		fmt.Printf("label(P)=%v\n", l[&P])
		fmt.Printf("label(Q)=%v\n", l[&Q])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:21,代码来源:caes_test.go


示例9: TestSelfDefeat

// Serial self defeat example, ibid., page 18
func TestSelfDefeat(t *testing.T) {
	var a1, a2 caes.Argument
	var i1 caes.Issue
	var P = caes.Statement{
		Text:    "Witness John says he is unreliable.",
		Assumed: true}
	var Q = caes.Statement{
		Text:  "Witness John is unreliable.",
		Issue: &i1,
		Args:  []*caes.Argument{&a1}}
	var R = caes.Statement{
		Text:  "Witness John is reliable.",
		Issue: &i1}
	var a1Invalid = caes.Statement{
		Text: "Argument a1 is invalid.",
		Args: []*caes.Argument{&a2}}
	a1 = caes.Argument{
		Conclusion:  &Q,
		Premises:    []caes.Premise{caes.Premise{Stmt: &P}},
		Undercutter: &a1Invalid}
	i1 = caes.Issue{
		Standard:  caes.PE,
		Positions: []*caes.Statement{&Q, &R}}
	a2 = caes.Argument{
		Conclusion: &a1Invalid,
		Premises:   []caes.Premise{caes.Premise{Stmt: &Q}}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&P, &Q, &R, &a1Invalid},
		Arguments:  []*caes.Argument{&a1, &a2}}
	l := ag.GroundedLabelling()
	expected := l[&Q] == caes.Out && l[&R] == caes.Out && l[&a1Invalid] == caes.Out
	if !expected {
		t.Errorf("TestSelfDefeat failed\n")
		fmt.Printf("label(unreliable(John))=%v\n", l[&Q])
		fmt.Printf("label(reliable(John))=%v\n", l[&R])
		fmt.Printf("label(invalid(a1))=%v\n", l[&a1Invalid])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:40,代码来源:caes_test.go


示例10: TestVacation

func TestVacation(t *testing.T) {
	var i1 caes.Issue
	var italy = caes.Statement{
		Text:  "Let's go to Italy.",
		Issue: &i1}
	var greece = caes.Statement{
		Text:  "Let's go to Greece.",
		Issue: &i1}
	i1 = caes.Issue{
		Standard:  caes.PE,
		Positions: []*caes.Statement{&greece, &italy}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&greece, &italy}}
	l := ag.GroundedLabelling()
	expected := l[&greece] == caes.Out && l[&italy] == caes.Out
	if !expected {
		t.Errorf("TestVacation failed\n")
		fmt.Printf("label(greece)=%v\n", l[&greece])
		fmt.Printf("label(italy)=%v\n", l[&italy])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:22,代码来源:caes_test.go


示例11: ioGmlTest

func ioGmlTest(t *testing.T, filename1 string, filename2 string) {

	var ag *caes.ArgGraph
	var err error

	file, err := os.Open(filename1)
	gmlcheck(t, err)
	ag, err = yaml.Import(file)
	file.Close()
	gmlcheck(t, err)
	//	fmt.Printf("---------- WriteArgGraph %s ----------\n", filename1)
	//	yaml.ExportWithReferences(os.Stdout, ag)
	//	fmt.Printf("---------- End: WriteArgGraph %s ----------\n", filename1)
	l := ag.GroundedLabelling()
	ag.ApplyLabelling(l)
	//	fmt.Printf("---------- printLabeling %s ----------\n", filename1)
	//	printLabeling(l)
	//	fmt.Printf("---------- End: printLabeling %s ----------\n", filename1)
	file, err = os.Create(filename2)
	gmlcheck(t, err)
	graphml.Export(file, *ag)

}
开发者ID:th0br0,项目名称:carneades-4,代码行数:23,代码来源:graphml_test.go


示例12: TestBachelor

func TestBachelor(t *testing.T) {
	var i1 caes.Issue
	var a1, a2 caes.Argument
	var bachelor = caes.Statement{
		Text:  "Fred is a bachelor.",
		Issue: &i1,
		Args:  []*caes.Argument{&a1}}
	var married = caes.Statement{
		Text:  "Fred is married.",
		Issue: &i1,
		Args:  []*caes.Argument{&a2}}
	var wearsRing = caes.Statement{Text: "Fred wears a ring.", Assumed: true}
	var partyAnimal = caes.Statement{Text: "Fred is a pary animal.", Assumed: true}
	i1 = caes.Issue{
		Standard:  caes.PE,
		Positions: []*caes.Statement{&married, &bachelor}}
	a1 = caes.Argument{
		Conclusion: &bachelor,
		Premises:   []caes.Premise{caes.Premise{Stmt: &partyAnimal}}}
	a2 = caes.Argument{
		Conclusion: &married,
		Premises:   []caes.Premise{caes.Premise{Stmt: &wearsRing}}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&bachelor, &married, &wearsRing, &partyAnimal},
		Arguments:  []*caes.Argument{&a1, &a2}}
	l := ag.GroundedLabelling()
	expected := l[&married] == caes.Out && l[&bachelor] == caes.Out
	if !expected {
		t.Errorf("TestBachelor failed\n")
		fmt.Printf("label(married)=%v\n", l[&married])
		fmt.Printf("label(bachelor)=%v\n", l[&bachelor])
		fmt.Printf("label(partyAnimal)=%v\n", l[&partyAnimal])
		fmt.Printf("label(wearsRing)=%v\n", l[&wearsRing])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:36,代码来源:caes_test.go


示例13: TestSelfDefeat2

func TestSelfDefeat2(t *testing.T) {
	var a1, a2 caes.Argument
	var i1 caes.Issue
	var P = caes.Statement{Text: "P", Issue: &i1, Args: []*caes.Argument{&a2}}
	var notP = caes.Statement{Text: "not P", Issue: &i1, Args: []*caes.Argument{&a1}}
	a1 = caes.Argument{
		Conclusion: &notP,
		Premises:   []caes.Premise{caes.Premise{Stmt: &P}}}
	a2 = caes.Argument{
		Conclusion: &P,
		Premises:   []caes.Premise{caes.Premise{Stmt: &notP}}}
	i1 = caes.Issue{Positions: []*caes.Statement{&P, &notP}}
	var ag = caes.ArgGraph{
		Issues:     []*caes.Issue{&i1},
		Statements: []*caes.Statement{&P, &notP},
		Arguments:  []*caes.Argument{&a1, &a2}}
	l := ag.GroundedLabelling()
	expected := l[&P] == caes.Out && l[&notP] == caes.Out
	if !expected {
		t.Errorf("TestSelfDefeat2 failed\n")
		fmt.Printf("label(P)=%v\n", l[&P])
		fmt.Printf("label(not P)=%v\n", l[&notP])
	}
}
开发者ID:th0br0,项目名称:carneades-4,代码行数:24,代码来源:caes_test.go



注:本文中的github.com/carneades/carneades-4/internal/engine/caes.ArgGraph类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang utils.AssertError函数代码示例发布时间:2022-05-23
下一篇:
Golang interpose.New函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap