I am working on the development of a simulation game of a taxi calling center. Agents (in population) include:
- Home
- Call
- Car
- Taxi Station
The following code is in a function (periodically triggered by an event) in the agent Taxi Station. Home is randomly chosen.
Call o = new Call();
o.home = main.home.random();
Car c = findCar();
if (t != null)
{
send(msg, c);
}
else
{
collectionCall.addFirst(msg);
}
It reports msg
cannot be resolved to a variable. Can somebody help me with this?
Vinz
2,9404 gold badges31 silver badges52 bronze badges
asked May 3, 2017 at 20:09
1
You should initialize msg
variable before it’s being used:
Call o = new Call();
o.home = main.home.random();
Car c = findCar();
String msg = "some message";
if (t != null) {
send(msg, c);
} else {
collectionCall.addFirst(msg);
}
answered May 3, 2017 at 20:17
Ivan ProninIvan Pronin
1,77016 silver badges14 bronze badges
3
0 / 0 / 1 Регистрация: 08.08.2012 Сообщений: 90 |
|
1 |
|
07.11.2015, 21:22. Показов 19220. Ответов 4
Одна единственная ошибка встречающаяся у меня в модели это entity cannot be resolved to a variable!!! подскажите пожалуйста что мне с ней делать?
0 |
1816 / 1030 / 285 Регистрация: 13.02.2012 Сообщений: 3,339 |
|
07.11.2015, 23:13 |
2 |
вы обращаетесь к заявке (entity) в модели, как к обычной переменной, однако заявка это сложный объект у которого куча своих переменных. Смотрите на какой контекст (строку кода) ссылается ошибка.
0 |
0 / 0 / 1 Регистрация: 08.08.2012 Сообщений: 90 |
|
09.11.2015, 15:30 [ТС] |
3 |
Все оказалось очень просто. Просто взял и поменял entity на agent в AnyLogic 7
0 |
0 / 0 / 0 Регистрация: 09.10.2015 Сообщений: 4 |
|
19.11.2018, 13:46 |
4 |
ZORRXXX, доброго времени суток. Столкнлуся с подобной промблемой при проектировании диаграммы действий, и по вашему решению возник ряд вопросов:
0 |
-68 / 4 / 1 Регистрация: 17.04.2020 Сообщений: 118 |
|
20.05.2021, 23:01 |
5 |
Vorla, 3 года прошло…
0 |
Problem Description:
I am working upon my thesis. For the first time I am working upon Any logic. I have only made a population agent named tasks and other agents which I require in my work. then I tried to build it but I get this error «Description: array cannot be resolved to a variable. Location: Thesis/Main/tasks – Tasks»
I have no idea what to do a snapshot of my work
Solution – 1
in a way writing array in there is like writing these other options:
- banana
- the sky is pretty because it’s blue
- alsjkdfasi348rsd
The special characteristics of all these 3 options, that are the same you have with the word «array» is that you have not defined what array is
YOu will not be able to progress with this model until you learn the very basics of java
I’m building an Anylogic model. I’ve built these models off and on for a few years, and I’ve never seen the program display this behavior.
Until this morning, it ran beautifully. I’ve made a single change in a single agent type—I’ve added an extra branch in the state space (with appropriate transitions into and out of it).
Anylogic now won’t compile, telling me instead, <branch name> cannot be resolved to a variable
. When I click on the java code to find the error, the line of code is:
enterState(<branch name>, true);
I’ve tried renaming the branch, tried copying and pasting from a different branch that had worked elsewhere in the state space. None of these work.
Перейти к контенту
I am working on the development of a simulation game of a taxi calling center. Agents (in population) include:
- Home
- Call
- Car
- Taxi Station
The following code is in a function (periodically triggered by an event) in the agent Taxi Station. Home is randomly chosen.
Call o = new Call();
o.home = main.home.random();
Car c = findCar();
if (t != null)
{
send(msg, c);
}
else
{
collectionCall.addFirst(msg);
}
It reports msg
cannot be resolved to a variable. Can somebody help me with this?
Vinz
2,9114 gold badges30 silver badges52 bronze badges
asked May 3, 2017 at 20:09
1
You should initialize msg
variable before it’s being used:
Call o = new Call();
o.home = main.home.random();
Car c = findCar();
String msg = "some message";
if (t != null) {
send(msg, c);
} else {
collectionCall.addFirst(msg);
}
answered May 3, 2017 at 20:17
Ivan ProninIvan Pronin
1,75215 silver badges14 bronze badges
3
0 / 0 / 1 Регистрация: 08.08.2012 Сообщений: 90 |
|
1 |
|
07.11.2015, 21:22. Показов 17472. Ответов 4
Одна единственная ошибка встречающаяся у меня в модели это entity cannot be resolved to a variable!!! подскажите пожалуйста что мне с ней делать?
__________________ 0 |
1816 / 1030 / 285 Регистрация: 13.02.2012 Сообщений: 3,339 |
|
07.11.2015, 23:13 |
2 |
вы обращаетесь к заявке (entity) в модели, как к обычной переменной, однако заявка это сложный объект у которого куча своих переменных. Смотрите на какой контекст (строку кода) ссылается ошибка. 0 |
0 / 0 / 1 Регистрация: 08.08.2012 Сообщений: 90 |
|
09.11.2015, 15:30 [ТС] |
3 |
Все оказалось очень просто. Просто взял и поменял entity на agent в AnyLogic 7 0 |
0 / 0 / 0 Регистрация: 09.10.2015 Сообщений: 4 |
|
19.11.2018, 13:46 |
4 |
ZORRXXX, доброго времени суток. Столкнлуся с подобной промблемой при проектировании диаграммы действий, и по вашему решению возник ряд вопросов: 0 |
-68 / 4 / 1 Регистрация: 17.04.2020 Сообщений: 118 |
|
20.05.2021, 23:01 |
5 |
Vorla, 3 года прошло… 0 |
У меня проблема с местонахождением агента в одной из моих симуляций Anylogic. Я хочу установить условие, определяющее путь, по которому агент будет визуализировать мою симуляцию.
В блоке задержки в основном агенте я написал
if (agent.previousStation==1){
path01;
}
else {
path21;
}
В поле местоположения агента.
При построении модели anylogic выдает мне следующие ошибки:
Description: Syntax error, insert «VariableDeclarators» to complete
LocalVariableDeclaration. Location: FVMMerkmale/shopfloor/wegzeit1 —
Delay
А также
Description: Syntax error on token(s), misplaced construct(s).
Location: FVMMerkmale/shopfloor — Agent Type
Написание «return» перед путем тоже не помогает и дает разные ошибки:
Description: Syntax error on token(s), misplaced construct(s).
Location: FVMMerkmale/shopfloor — Agent TypeDescription: path21 cannot be resolved to a variable. Location:
FVMMerkmale/shopfloor/wegzeit1 — DelayDescription: Void methods cannot return a value. Location:
FVMMerkmale/shopfloor/wegzeit1 — DelayDescription: agent cannot be resolved to a variable. Location:
FVMMerkmale/shopfloor/wegzeit1 — Delay
Элементы пути находятся в главном агенте. Использование редактора значений для выбора правильного пути будет работать.
Согласно справке anylogic, можно привязать местоположение агента к условию:
Otherwise, if you want to set different nodes for agents here, you can
write a Java expression that will return different nodes depending on
some conditions.
https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Fagentbased%2FContinuous_Layouts.html
Как мне написать условие, которое определяет путь или узел в качестве местоположения агента?