Categories

## How to count all paths from a point to another point in 3d grid with conditions

Given the input xm, ym,h I have to find all paths from point (1,0,1) to (xm, ym, 1) in a 3d grid such as: possible moves from (x,y,z) are (x+1, y, z), (x+1, y+1, z), (x+1, y-1, z) if z < h more possible moves are (x+1, y, z+1), (x+1, y+1, z+1), (x+1, y-1, z+1) […]

## How to feed key-value features (aggregated data) to LSTM?

I have the following time-series aggregated input for an LSTM-based model: x(0): {y(0,0): {a(0,0), b(0,0)}, y(0,1): {a(0,1), b(0,1)}, …, y(0,n): {a(0,n), b(0,n)}} x(1): {y(1,0): {a(1,0), b(1,0)}, y(1,1): {a(1,1), b(1,1)}, …, y(1,n): {a(1,n), b(1,n)}} … x(m): {y(m,0): {a(m,0), b(m,0)}, y(m,1): {a(m,1), b(m,1)}, …, y(m,n): {a(m,n), b(m,n)}} where x(m) is a timestep, a(m,n) and b(m,n) are features […]

Categories

## How to divide the string depending on length in seqeunce in python?

>>>mymedicinesarerighthere You need to break this word down in the following way: >>>[m, ym ,edi ,cine ,sarer ,ighthe, re]

Categories

## Python read column with string inside ” “

I have a text file which contains the columns as below – 1 a “x y” 2 b “p q” 3 c “m n” … Now I want to read each column. So far I have written the simple program f = open(file,’r’) for line in f: columns = line.split() name = column[2:4] print name […]

Categories

## Exclude variants/rotations of lists in solutions SWI-Prolog

I want to exclude multiple rotations/mirrors of a list in my solutions of the predicate. I’ll give an example of what I understand are rotations/mirrors of a list: [1,2,3,4,5] [2,3,4,5,1] [3,4,5,1,2] [5,4,3,2,1] I have to find a predicate that delivers unique sequence of numbers from 1 to N, according to some constraints. I already figured […]

Categories

## Using modulo to loop array ends up in current element being the same with the next one

I have tried to create an algorithm that tells you if a point is inside a simple polygon.I do that by finding whether the point crossed an odd number of borders.If it crossed an even number of borders we are outside the polygon and if the point doesn’t cross a border,it just walks on it […]