I'm trying to send a plan from Agent1 to Agent2 via:
#c2[atomic]
+giveRule[source(A)]: planGiven(B) <-
-+planGiven(B+1);
.send(A, tellHow, "#s1 +sum(num1(X, Y), num2(A, B))[source(S)] :logic(L) & attentiveness(T)<- if ((L + T) > 2){ -+res(num1(X, Y), num2(A, B), res(X*10 + A*10 + Y + B)); .send(S, tell, result(X*10 + A*10 + Y + B)); } else { -+res(num1(X, Y), num2(A, B), res(X + A + Y + B)); .send(S, tell, result(X + A + Y + B)); }.");
-+stopGivingPlan.
Then, i'm trying to make this plan work by sending a message from Agent1 to Agent2:
#c3[atomic]
+giveProbs[source(A)]: probsGiven(B) & stud(A,X)<-
-+probsGiven(B+1);
.send(A, tell, sum(num1(3,3), num2(4,9))).
It doesn't work.
Why?
And important addition:
If I don't send plan, and just copy it in Agent2, it works fine. so Syntax is ok.
Also, i'm using jason plugin in eclipse, if that's worth to be mentioned.
It is not quite clear what is being performed, it is better if you can show the whole code. I simplified the case just to try to show a general idea, as bellow:
Agent1 code:
!start.
+!start: true <-
.send(agent2, tellHow, "#s1 +!sum(num1(X, Y), num2(A, B))[source(S)] :true <- -+res(num1(X, Y), num2(A, B), res(X + A + Y + B)); ?res(Z1,Z2,Z3); .print(Z1,\"+\",Z2,\"=\",Z3).");
.send(agent2, achieve, sum(num1(1,2), num2(3,4))).
Agent2 code:
/* No previous code - agent1 will send a plan*/
The response should be:
[agent2] num1(1,2)+num2(3,4)=res(10)
In this case, agent2 has nothing to do until agent1 sends a plan. Agent1 is also sending a triggering plan to achieve a sum.
Related
I indeed got a relatively big dataset and my mixed effects logistic regression is like below. Is that normal to take that long to run? or I made some mistakes?
library(lme4)
glmer_EBRD_undersample_1 <- glmer(leave_happened ~
performance_rating_2016 + performance_rating_2017 + performance_rating_2018 + performance_rating_2019 + performance_rating_2020
+ gender
+ target_group
+ target_pmf_band
+ target_hq_or_ro
+ target_office_location_country_distilled
+ target_org_unit_cost_centre_code_distilled
+ target_ebrd_region_distilled
+ target_contract_group_distilled
+ target_position_tenure_group
+ target_length_of_service_group_distilled
+ leaves_to_date
+ moves_to_date
+ joins_to_date
+ applied_count_to_date
+ line_reviewed_to_date
+ interviewed_to_date
+ offered_to_date
+ hired_to_date
+ (1 | person_id)
,
data = train_undersample_1,
family = binomial,
control = glmerControl(optimizer = "bobyqa"),
nAGQ = 10
)
summary(glmer_EBRD_undersample_1)
Also gave a warning like this: Warning in commonArgs(par, fn, control, environment()) :
maxfun < 10 * length(par)^2 is not recommended.
I am running a logistic generalized linear mixed model and would like to plot my effects together with confidence intervals.
I use the lme4 package to fit my model:
glmer (cbind(positive, negative) ~ F1 * F2 * F3 + V1 + F1 * I(V1^2) + V2 + F1 * I(V2^2) + V3 + I(V3^2) + V4 + I(V4^2) + F4 + (1|OLRE) + (1|ind), family = binomial, data = try, na.action = na.omit, control=glmerControl(optimizer = "optimx", calc.derivs = FALSE, optCtrl = list(method = "nlminb", starttests = FALSE, kkt = FALSE)))
OLRE means that I use an observational level random effect in order to overcome overdispersion.
If you wonder because of convergence warnings, I went through the lme4 troubleshooting protocol, and it should be fine.
In order to get effect plots with confidence intervals, I tried to use ggpredict:
sjPlot, e.g.:
plot_model(mod, type = "pred", terms = c("F1", "F2", "F3"), ci.lvl = 0.95)
I also tried to go through this protocol:
https://rpubs.com/hughes/84484
intdata <- expand.grid(
positive = c(0,1),
negative = c(0,1),
F1 = as.factor(c(0,1)),
F2 = as.factor(c(1,2,3)),
F3= as.factor(c(1,2,3,4)),
V1= as.numeric(median(try$V1)),
F4= as.factor(c(30, 31)),
ind= as.factor(c(68)),
OLRE = as.factor(c(2450)),
V2= as.numeric(median(try$V2)),
V3= as.numeric(median(try$V3)),
V4= as.numeric(median(try$V4))
)
#conditional variances
cV <- ranef(mod, condVar = TRUE)
ranvar <- attr(cV[[1]], "postVar")
sqrt(diag(ranvar[,,1]))
mm <- model.matrix(terms( mod), data=intdata,
contrasts.arg = lapply(intdata[,c(3:5, 7:9)], contrasts, contrasts=FALSE))
predFun<-function(.) mm%*%fixef(.)
bb<-bootMer(mod,FUN=predFun,nsim=3)
with some problems and warnings regarding contrasts and
Error in mm %*% fixef(.) : non-conformable arguments
Therefore, I am wondering if anyone might help me but so far I am not able to Nothing worked so far, so I would really appreciate some help.
Here the link to the data https://drive.google.com/file/d/1qZaJBbM1ggxwPnZ9bsTCXL7_BnXlvfkW/view?usp=sharing
The problem seems to be simple, but I don't know how to get the solution
Entered in wxMaxima
xt:xm-w/2;
z:w/(xmax-xmin+2*ma);
xa:xt/z;
x:xa+xmax/2+xmin/2;
expand(x);
-(xm*xmin)/w + xmin + (xm*xmax)/w + (2*ma*xm)/w - ma
This is OK, but we can simplify a bit deeper.
Simplified by myself
x = -(xm*xmin)/w + xmin + (xm*xmax)/w + (2*ma*xm)/w - ma
x = xm/w * (xmax-xmin + 2*ma) + xmin - ma
or
z = w/(xmax-xmin+2*ma)
So
x = xm/z + xmin - ma
Question:
Is there a possibility in wxMaxima to get this result ?
x = xm/z + xmin - ma
Thanks in advance
Christian
You can try using equations instead of variables:
(%i) remvalue(all)$
(%i) EQ1:xt=xm-w/2$
(%i) EQ2:z=w/(xmax-xmin+2*ma)$
(%i) EQ3:xa=xt/z,[EQ1,EQ2]$
(%i) EQ4:x=xa+xmax/2+xmin/2,[EQ3]$
(%i) EQ5:solve([EQ2],w)$
(%i) EQ4,[EQ5]$
(%i) expand(%);
(%o) x=xm/z+xmin-ma
for better understanding:
xa=xt/z,[EQ1,EQ2];
is the short form of:
ev(xa=xt/z,[xt=xm-w/2,z=w/(xmax-xmin+2*ma)]);
Meantime I found the other solution. Thanks :-)
xt:xm-w/2;
z:w/(xmax-xmin+2*ma);
xa:xt/z;
x:xa+xmax/2+xmin/2;
w:solve('z=z,w)[1];
x:subst(w,x);
expand(x);
I would like to create a loop for changing interactions name in PyMol. But after one selection loop it crashes and doesn't work.
def get_dists(interactions): # interactions=([1,2], [3,4])
for i in interactions:
a = "////" + str(i[0]) + "/C2'"
b = "////" + str(i[1]) + "/C2'"
cmd.distance("(" + a + ")", "(" + b + ")")
for j in range(1, 599):
x = "dist" + "0" + str(j)
y = str(i[0]) + " " + str(i[1])
cmd.set_name(str(x), str(y))
In Pymol the default name of interactions is dist01, 02 , 03.
I want to change these to 1_3, 5_59, 4_8, (interaction between residue).
Your code is totally fine except for one thing: If PyMol doesn't succeed with set_name the whole script is aborted. When you change it to, it should work:
try:
cmd.set_name(str(x), str(y))
except:
print('failed to rename')
Some additional comments:
y = str(i[0]) + " " + str(i[1]) should be y = str(i[0]) + "_" + str(i[1])
this line is probably for padding zeros x = "dist" + "0" + str(j). This is only needed when j is a single digit, otherwise the name of the distance objects is dist20 or dist123
cmd.set_name(str(x), str(y)) can be simplified to cmd.set_name(x, y) since x and y are already strings.
I am using Jason language to communicate between two agents. But I am unable to use send action, it gives an error.
These are my two agents,
Agent1 :-
// Agent Agent1 in project factorial3.mas2j
/* Initial goals */
!start.
/* Plans */
+!start : true
<- .print("starting..");
!query_factorial(2).
+!query_factorial(X) : true <-
.send(agent2,tell,giveme(X)).
/*+fact(X,Y) : true <-
.print("factorial ", X, " is ", Y, " thank you expert").*/
Agent2:-
// Agent agent2 in project IdEx.mas2j
/* Initial beliefs and rules */
/* Initial goals */
!begin.
/* Plans */
+!begin : true
<- .print("expert starting.......");
!giveme(X).
+!giveme(X):true
<- !fact(X,Y);
.print("Factorial of ", X, " is ", Y).
//.send(agent1,achive,fact(X,Y)).
+!fact(X,1) : X == 0.
+!fact(X,Y) : X > 0
<- !fact(X-1,Y1);
Y = Y1 * X.
So, I am getting an error when I am trying to call send action in agent1 and agent2 gives an receive error.
UPDATED
I am getting this error,
[agent2] *** Error adding var into renamed vars. var=X, value=(_229-1).
java.lang.ClassCastException: jason.asSyntax.ArithExpr cannot be cast to jason.asSyntax.VarTerm
at jason.asSemantics.TransitionSystem.prepareBodyForEvent(TransitionSystem.java:877)
at jason.asSemantics.TransitionSystem.applyExecInt(TransitionSystem.java:728)
at jason.asSemantics.TransitionSystem.applySemanticRule(TransitionSystem.java:222)
at jason.asSemantics.TransitionSystem.reasoningCycle(TransitionSystem.java:1429)
at jason.infra.centralised.CentralisedAgArch.run(CentralisedAgArch.java:205)
at java.lang.Thread.run(Thread.java:745)
If you want to ask for an agent to perform a plan (in case of agent1 when you say "+!query_factorial(X)...") it should be an achieve message. Uncommenting the "plan" "+fact(X,Y) : true <- .print("factorial ", X, " is ", Y, " thank you expert")." you should use the operator "!" at the begining to make it a plan. So, if I undertood the general idea of your test project, it can be rewrite as follows:
Agent1 code:
!start.
+!start : true
<- .print("starting..");
!query_factorial(2).
+!query_factorial(X) : true <-
.send(agent2,achieve,giveme(X)).
Agent2 code:
+!giveme(X):true
<- !fact(X,Y);
.print("Factorial of ", X, " is ", Y).
+!fact(X,1) : X == 0.
+!fact(X,Y) : X > 0
<- !fact(X-1,Y1);
Y = Y1 * X.
You can see, I am not using the "begin plan" of your original code since the Agent1 is doing the job, making Agent2 work when asked.