close

Вход

Забыли?

вход по аккаунту

?

Отчет — копия

код для вставкиСкачать
??????????? ??????
??????????? ??????????????? ????????? ??????????????? ?????????? ??????? ????????????????? ???????????.
"?????????? ??????????????? ??????????? ??????????? ????????????, ??????????? ? ??????????"
(???? ?????)
????????? ?????????????? ?????????? (??)
??????? ?????????????? ??????? (??)
?????????? "??????? ?????????????? ??????????"
???????????? ?????? ?1
????: "?????????? ????????????? ??????? ? ????? Jason"
?????????????: ??????? ?.?.
??????? ?????? ???-1-08
?????? ?.?.
2012
??????????
?????????? ??????3
?????????????? ??????3
??????? ????????????? ???????5
???????????? ????????????? ???????14
?????????? ??????
?????????? ??????????? ????????????? ???????, ??????????? ?????? ?????????? ? ????????????. ????????? ?????? ?????? ??????? ???? ???????, ?????????? ???? ??????? ?????? ????????? ?????? ?? ??????. ????? ????, ??? ?????????? ?????????????, ????????? ???? ????? ??????. ?????????? ??????????? ?? ????????????: ??????, ??????? ? ???????. ????????? ?? ????? ????????? ?????? ?? ?????? ?????. ????? ?????????? ?????? ??????? ?? ????????? ??????? ? ?? ???????????? ??????????. ???????????? ??????????? ????, ??? ????????? ????? ?? ?????????? ? ???????.
?????????????? ??????
??? ????, ????? ???????????? ?????????????? ??????????, ??????????? ? ???????, ?????????? ?????????? ??? ?????????? ???? ?????. ? ???? ????? ?????????? ???????, ??????? ???????? ???????????. ?????????? ????????????? ???? ???? (????????? ??? ??????? ??????) ? ????? ?????? ??????. ???? ?????? ?????????? ??????????? ?? ???????????? ?????????? ????? ? ????? ? ??????? 5 ??? ??????? ??????. ????? ???????, ?????? ????? ?????? ? ????? ????? ??????????? ????????? ??????:
???? ?????? ??????? ?????? ?? ??? ???, ???? ? ????? ?? ???????? 5 ?????. ???????????, ??? ????????, ????????? ????. ????? ? ??? ?????????? ????? ??????, ???? ?? ??????????? ?????? ????? ?? ?? ???? ? ????????? ?? ???? ??????????. ??? ??? ???????? ?? ?????:
????? ????????? ?????????? ? ?????????? ??????. ?? ????? ?? ????????? ??????? ??? ?? ?????????? ? ???. ????? ??? ???? ???????? ???????????? ????.
? ????? ?????????? ?????????? ?????? ????? "?????????" ??????? ????????? ? ???.
??????? ????????????? ???????
????? "?????????" ???????? ????????? ???????:
+type1StackHavePlaces(X) : X > 0 <- placeType1Eat.
+type2StackHavePlaces(X) : X > 0 <- placeType2Eat.
+type3StackHavePlaces(X) : X > 0 <- placeType3Eat.
??? ??????????? ????, ??? ? ????? ????? ??????? ?????? ???? ?????, ?? ????????? ???? ??? ???? ??????.
?????? ???? "?????????" ???????? ?????????. ?????????? ???? ????? ?????????? ?????? ? ??????????? ?? ???????????? ? ??, ?? ?????? ????? ????? ?????? ?????????.
????? "??????????????????? ????????? ?????? 1":
@l[atomic]
+type1StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*20 + 2000);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????????? ????????? ?????? 1":
@l[atomic]
+type1StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*15 + 1500);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????????? ????????? ?????? 1":
@l[atomic]
+type1StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*10 + 1000);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????? ????????? ?????? 2":
@l[atomic]
+type2StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*20 + 2000);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????????? ????????? ?????? 2":
@l[atomic]
+type2StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*15 + 1500);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????????? ????????? ?????? 2":
@l[atomic]
+type2StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*10 + 1000);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????? ????????? ?????? 3":
@l[atomic]
+type3StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*20 + 2000);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????????? ????????? ?????? 3":
@l[atomic]
+type3StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*15 + 1500);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
????? "??????????????????????? ????????? ?????? 3":
@l[atomic]
+type3StackHaveEats(X) : X > 0 <-
prepare;
?distance(D);
-distance(D);
.print("Distance: ", D);
.wait(D*10 + 1000);
if(math.random(100) < 85) {
deliverEat;
} else {
.print("Sorry, work failed");
}.
??????? ?????? ??? ?? ??????? ?? ????????? ???????????????? ?????? ????? ?????. ???? ? ??? ??????? ??????, ????????? ????? ?? ?? ????. ?????, ? ??????????? ?? ????????? ? ????? ????????????, ?? ???????????? ????? ????????? ?????? ??????? ??? ? ????????.
?????????????? ??????? ? ????????? ????????? ????????? ???????????? ????? ?????. ???????? ??? ?????:
import jason.asSyntax.*;
import jason.environment.*;
import java.util.LinkedList;
import java.util.Random;
public class DeliverymansEnvironment extends Environment {
LinkedList type1Eats = new LinkedList<Integer>();
LinkedList type2Eats = new LinkedList<Integer>();
LinkedList type3Eats = new LinkedList<Integer>();
Random random = new Random();
final int MAX_TYPE1_EATS = 5;
final int MAX_TYPE2_EATS = 5;
final int MAX_TYPE3_EATS = 5;
@Override
public void init(String[] args) {
Literal emptyType1Stack = Literal.parseLiteral("type1StackHavePlaces(" + MAX_TYPE1_EATS + ")");
Literal type1EatCount = Literal.parseLiteral("type1StackHaveEats(0)");
Literal emptyType2Stack = Literal.parseLiteral("type2StackHavePlaces(" + MAX_TYPE2_EATS + ")");
Literal type2EatCount = Literal.parseLiteral("type2StackHaveEats(0)");
Literal emptyType3Stack = Literal.parseLiteral("type3StackHavePlaces(" + MAX_TYPE3_EATS + ")");
Literal type3EatCount = Literal.parseLiteral("type3StackHaveEats(0)");
addPercept(emptyType1Stack);
addPercept(type1EatCount);
addPercept(emptyType2Stack);
addPercept(type2EatCount);
addPercept(emptyType3Stack);
addPercept(type3EatCount);
}
@Override
public boolean executeAction(String ag, Structure act) {
clearPercepts();
if (act.getFunctor().equals("prepare")) {
System.out.println("????? " + ag + " ??????? ??????");
if (ag.contains("Type1")) {
Literal type1EatDistance = Literal.parseLiteral("distance(" + type1Eats.getLast() + ")");
addPercept(ag, type1EatDistance);
type1Eats.removeLast();
}
if (ag.contains("Type2")) {
Literal type2EatDistance = Literal.parseLiteral("distance(" + type1Eats.getLast() + ")");
addPercept(ag, type2EatDistance);
type2Eats.removeLast();
}
if (ag.contains("Type3")) {
Literal type3EatDistance = Literal.parseLiteral("distance(" + type1Eats.getLast() + ")");
addPercept(ag, type3EatDistance);
type3Eats.removeLast();
}
}
if (act.getFunctor().equals("placeType1Eat")) {
System.out.println("???? ???????? ?????? ? ????? 1");
type1Eats.add(1 + random.nextInt(99));
}
if (act.getFunctor().equals("placeType2Eat")) {
System.out.println("???? ???????? ?????? ? ????? 2");
type2Eats.add(1 + random.nextInt(99));
}
if (act.getFunctor().equals("placeType3Eat")) {
System.out.println("???? ???????? ?????? ? ????? 3");
type3Eats.add(1 + random.nextInt(99));
}
if (act.getFunctor().equals("makeEat")) {
System.out.println("????? " + ag + " ???????? ??????");
}
Literal type1StackStatus = Literal.parseLiteral("type1StackHavePlaces(" + (MAX_TYPE1_EATS - type1Eats.size()) + ")");
Literal type1EatCount = Literal.parseLiteral("type1StackHaveEats(" + type1Eats + ")");
Literal type2StackStatus = Literal.parseLiteral("type2StackHavePlaces(" + (MAX_TYPE2_EATS - type2Eats.size()) + ")");
Literal type2EatCount = Literal.parseLiteral("type2StackHaveEats(" + type2Eats + ")");
Literal type3StackStatus = Literal.parseLiteral("type3StackHavePlaces(" + (MAX_TYPE3_EATS - type3Eats.size()) + ")");
Literal type3EatCount = Literal.parseLiteral("type3StackHaveEats(" + type3Eats + ")");
addPercept(type1StackStatus);
addPercept(type1EatCount);
addPercept(type2StackStatus);
addPercept(type2EatCount);
addPercept(type3StackStatus);
addPercept(type3EatCount);
return true;
}
}
??????????? ???? ???? ????????? ??????? ? ?????? ????? ??????? ? ????? ???????. ???????? ??? ????? ???????:
MAS workers {
infrastructure: Centralised
environment: DeliverymansEnvironment
agents:
boss;
stupidType1Worker;
stupidType2Worker;
stupidType3Worker;
normalType1Worker;
normalType2Worker;
normalType3Worker;
smartType1Worker;
smartType2Worker;
smartType3Worker;
}
???????????? ????????????? ???????
???????? ????????????? ??????? ? ????????? ???:
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
????? normalType1Worker ??????? ??????
????? normalType3Worker ??????? ??????
????? stupidType1Worker ??????? ??????
????? stupidType2Worker ??????? ??????
????? smartType2Worker ??????? ??????
[stupidType2Worker] Distance: 26
????? smartType1Worker ??????? ??????
[stupidType1Worker] Distance: 8
[normalType3Worker] Distance: 8
????? stupidType3Worker ??????? ??????
[normalType1Worker] Distance: 86
[stupidType3Worker] Distance: 31
????? normalType2Worker ??????? ??????
[smartType1Worker] Distance: 26
[smartType2Worker] Distance: 26
[normalType2Worker] Distance: 31
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 2
????? smartType3Worker ??????? ??????
[smartType3Worker] Distance: 76
???? ???????? ?????? ? ????? 3
????? smartType2Worker ???????? ??????
????? smartType1Worker ???????? ??????
????? smartType2Worker ??????? ??????
????? smartType1Worker ??????? ??????
[smartType2Worker] Distance: 76
[smartType1Worker] Distance: 76
[normalType3Worker] Sorry, work failed
????? normalType3Worker ??????? ??????
[normalType3Worker] Distance: 30
????? normalType2Worker ???????? ??????
????? normalType2Worker ??????? ??????
[normalType2Worker] Distance: 30
???? ???????? ?????? ? ????? 3
????? stupidType1Worker ???????? ??????
????? stupidType1Worker ??????? ??????
[stupidType1Worker] Distance: 30
????? smartType3Worker ???????? ??????
????? smartType3Worker ??????? ??????
[smartType3Worker] Distance: 1
????? stupidType2Worker ???????? ??????
????? stupidType2Worker ??????? ??????
[stupidType2Worker] Distance: 1
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 2
????? stupidType3Worker ???????? ??????
????? stupidType3Worker ??????? ??????
[stupidType3Worker] Distance: 55
????? normalType1Worker ???????? ??????
????? normalType1Worker ??????? ??????
[normalType1Worker] Distance: 55
????? smartType2Worker ???????? ??????
????? smartType2Worker ??????? ??????
????? smartType1Worker ???????? ??????
????? smartType1Worker ??????? ??????
[smartType2Worker] Distance: 1
[smartType1Worker] Distance: 1
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 1
????? smartType3Worker ???????? ??????
????? smartType3Worker ??????? ??????
[smartType3Worker] Distance: 17
????? normalType3Worker ???????? ??????
????? normalType3Worker ??????? ??????
[normalType3Worker] Distance: 17
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 3
????? normalType2Worker ???????? ??????
????? normalType2Worker ??????? ??????
[normalType2Worker] Distance: 17
????? smartType2Worker ???????? ??????
[smartType1Worker] Sorry, work failed
????? smartType2Worker ??????? ??????
????? smartType1Worker ??????? ??????
[smartType2Worker] Distance: 17
[smartType1Worker] Distance: 17
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 1
????? smartType3Worker ???????? ??????
????? smartType3Worker ??????? ??????
[smartType3Worker] Distance: 69
????? stupidType2Worker ???????? ??????
????? stupidType2Worker ??????? ??????
[stupidType2Worker] Distance: 69
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 3
????? stupidType1Worker ???????? ??????
????? stupidType1Worker ??????? ??????
[stupidType1Worker] Distance: 69
????? normalType1Worker ???????? ??????
????? normalType1Worker ??????? ??????
[normalType1Worker] Distance: 11
????? smartType2Worker ???????? ??????
????? smartType1Worker ???????? ??????
????? smartType2Worker ??????? ??????
????? smartType1Worker ??????? ??????
[smartType2Worker] Distance: 58
[smartType1Worker] Distance: 58
????? normalType3Worker ???????? ??????
????? normalType3Worker ??????? ??????
[normalType3Worker] Distance: 31
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 1
???? ???????? ?????? ? ????? 1
????? normalType2Worker ???????? ??????
????? normalType2Worker ??????? ??????
[normalType2Worker] Distance: 7
????? stupidType3Worker ???????? ??????
????? stupidType3Worker ??????? ??????
[stupidType3Worker] Distance: 7
????? smartType3Worker ???????? ??????
????? smartType3Worker ??????? ??????
[smartType3Worker] Distance: 7
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 3
????? normalType1Worker ???????? ??????
????? normalType1Worker ??????? ??????
[normalType1Worker] Distance: 7
????? smartType2Worker ???????? ??????
????? smartType1Worker ???????? ??????
????? smartType2Worker ??????? ??????
????? smartType1Worker ??????? ??????
[smartType2Worker] Distance: 47
[smartType1Worker] Distance: 47
???? ???????? ?????? ? ????? 2
????? smartType3Worker ???????? ??????
????? smartType3Worker ??????? ??????
[smartType3Worker] Distance: 72
[normalType2Worker] Sorry, work failed
????? normalType2Worker ??????? ??????
[normalType2Worker] Distance: 72
????? normalType3Worker ???????? ??????
????? normalType3Worker ??????? ??????
[normalType3Worker] Distance: 72
???? ???????? ?????? ? ????? 2
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 3
???? ???????? ?????? ? ????? 3
????? stupidType3Worker ???????? ??????
????? stupidType3Worker ??????? ??????
[stupidType3Worker] Distance: 72
????? stupidType2Worker ???????? ??????
????? stupidType2Worker ??????? ??????
[stupidType2Worker] Distance: 72
???? ???????? ?????? ? ????? 2
?? ?????, ??? ??? ?????? ??????? ???? ???????? ????????? ??? ??? ??????. ?????????? ?? ???????????? ????? ????????? ???????? ??????. ??? ?? ???????????? ? ????????? ??????? ????????? ??????. ????? ????, ??? ????????? ???? ?????? ?? ????, ???? ????? ????????? ?????? ??????. ??????? ???????? ?????????.
2
Документ
Категория
Без категории
Просмотров
6
Размер файла
332 Кб
Теги
отчет
1/--страниц
Пожаловаться на содержимое документа