Categories

## Network Trip Assignment with igraph

My problem: I have a street network (df.net) and a list containing the Origins and Destinations of trips (df.trips). I need to find the flow on all links? library(dplyr) df.net = tribble(~from, ~to, ~weight,1,2,1,2,1,1,1,9,3,9,1,2,2,10,1,10,2,2,9,10,8,10,9,15,9,8,1,8,9,2,7,8,2,12,7,3,9,12,10,12,9,9,12,6,2,6,12,5,11,12,3,12,11,3,5,6,1,11,5,4,5,11,3,11,4,3,4,3,5,3,10,4,10,11,10) df.trips = tribble(~from, ~to, ~N,1,2,45,1,4,24,1,5,66,1,9,12,1,11,54,2,3,63,2,4,22,2,7,88,2,12,44,3,2,6,3,8,43,3,10,20,3,11,4,4,1,9,4,5,7,4,6,35,4,9,1,5,7,55,5,8,21,5,1,23,5,7,12,5,2,18,6,2,31,6,3,6,6,5,15,6,8,19,7,1,78,7,2,48,7,3,92,7,6,6,8,2,77,8,4,5,8,5,35,8,6,63,8,7,22) This is my solution: library(igraph) # I construct a directed igraph network: graph = igraph::graph_from_data_frame(d=df.net, directed=T) […]

Categories

## Why my wtmp/utmp don’t reset users count?

On a normal working linux machine the command w report 2 users(because 2 users are connected) w 19:23:19 up 1:53, 2 users, load average: 0,44, 0,63, 0,81 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT after reboot report correctly 1 user w 19:26:44 up 1:03, 1 users, load average: 0,44, 0,73, 0,90 USER TTY FROM […]

Categories

## Cox proportional hazard model

I am trying to run Cox proportional hazard model on a data of 4 groups. Here’s the data: I am using this code: time_Allo_NHL<- c(28,32,49,84,357,933,1078,1183,1560,2114,2144) censor_Allo_NHL<- c(rep(1,5), rep(0,6)) time_Auto_NHL<- c(42,53,57,63,81,140,176,210,252,476,524,1037) censor_Auto_NHL<- c(rep(1,7), rep(0,1), rep(1,1), rep(0,1), rep(1,1), rep(0,1)) time_Allo_HOD<- c(2,4,72,77,79) censor_Allo_HOD<- c(rep(1,5)) time_Auto_HOD<- c(30,36,41,52,62,108,132,180,307,406,446,484,748,1290,1345) censor_Auto_HOD<- c(rep(1,7), rep(0,8)) myData <- data.frame(time=c(time_Allo_NHL, time_Auto_NHL, time_Allo_HOD, time_Auto_HOD), censor=c(censor_Allo_NHL, censor_Auto_NHL, censor_Allo_HOD, […]

Categories

## Average of function defined on cantor set

Suppose we have $P: A\cap[0,1]\to\mathbb{R}$, where $A$ is the Cantor set. I want to define and find the average of $P$ to give a result between the infimum and supremum of $P$‘s range. Obviously we cannot use the Lebesgue measure, as the average would be zero. Instead, we need a new definition. My intuition is, […]

Categories

## Flatten the curve or End the Pandemic Early? : best way to make a decision?

I am trying to solve this reward/risk problem which would depend on an individual preference. I have two countries with 2 different hospitalization capabilities. Both of them wants to flatten the curve of a pandemic so they do not want to saturate their hospitals and at the same time they want to end the pandemic […]

Categories

## Mongo DB collecting properties as a an array

I am a novice in Mongo database: I have a document in a collection, let’s say with 5 properties(A,B,C,D,E). And, I have documents in the collection that contains all or some of the above properties. I want to write a query that will append the property values from all of the documents. Document 1 = […]

Categories

## Matplotlib | Change in plot representation when applying logarithmic scale

Given a set of points to be represented on a 3D plot (as scatter plot) I thought it would be interesting to plot the same data in 2D instead of 3D thanks to hist2d and using weights. This data has low and high values (some orders of magnitud apart) so when represented as a hist2d […]

Categories

## check consecutive numbers in a multidimensional array JavaScript

I have an array containing data that is supposed to be consecutive numbers, But I would like to be able to divide the lines where the consecutive sequence is [14,38],[39,55,61],[62],[63],[64] to [14,38],[39,55,61] and [39,55,61],[62],[63],[64] I made a code allowing to verify that there is no break in the sequence of consecutive numbers but I can’t […]

Categories

## “Could not receive Stock Item data” Line Appear Instead of Admin Product Grid – Magento 2

“Could not receive Stock Item data” line appear instead of product grid in admin side. I have recently imported other db to my Cloud local setup. When I am doing indexing,I am getting error like this. SQLSTATE[HY000]: General error: 1449 The user specified as a definer (”@’%’) do es not exist, query was: DELETE price_index […]

Categories

## Efficient way to merge two dimensional array

I want to merge two lists which contain same number. Each list contains unique number and never matches more than one row of the other list. ([2, 1, 3, 4, 5] of listA only match a single row [1, 4, 3, 10] of listB) I wrote my code below in Python. Is there more efficient […]