[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Python algorithm
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 18
Thread images: 1
File: Capture.jpg (85 KB, 560x669) Image search: [Google]
Capture.jpg
85 KB, 560x669
Can anyone help me ? i know it's french but maybe.. :'( i really need help, i don't know how to start..
>>
>python
>algorithm
Shit nigga, algorithms aren't code.
>>
Well i know, but i need to create an algorithm and write it in python..
>>
Not only do you not have the decency to just Google this shit but you can't even translate it to English when asking for help.

Shame on you you lazy French bum.
>>
Here's an algorithm:
1. take a number as input and store it in a.
2. add one a, and store it in b.
3. print b.

Now write that in python code.
>>
i did googled it, but didn't find shit :/ Sorry for not translating it ..
>>
Start with something really simple. The basics. The basic steps should be:

> read from the file, and put the graph's data into a structure
> find all possible paths with a given starting point
> while iterating to find the paths, reject paths that are invalid
> return the first path that you find, that happens to be valid
>>
Thank you, i'll try that.
>>
>>53598766
I don't speak frog, but this all looks very much like Dijkstra's Algorithm.
https://en.wikipedia.org/wiki/Dijkstra's_algorithm

There's a LOT of resources to help you understand and implement this algorithm (it's pretty simple)
>>
Thank you, well i guess, but i'm starting to learn how to make basic algorithm, and i don't really now where to learn, any advice ?
>>
>>53598998
https://en.wikipedia.org/wiki/Algorithm
In mathematics and computer science, an algorithm is a self-contained step-by-step set of operations to be performed.

For example:
1. Delete this thread.
2. Go to http://boards.4chan.org/g/catalog#s=Stupid%20Questions%20Thread
3. Click on the latest thread.
4. Ask your stupid question there.

Is an algorithm.
>>
At least translate it for us, you lazy fuck
>>
>>53598998

Going to a French board would be your best bet. You won't get much help on English boards, for a problem that's stated in French. Especially here, since a lot of people aren't fond of beginners.
>>
>>53598766
I can give it a whirl if you have an english copy
>>
Guys don't be so hard on me, it's my first post on 4chan, i don't know how everything works yet
>>
>>53599193
I can translate in 5 minutes
>>
The road network includes n clients ( from 0 to n-1 ) n deposits ( from n to 2n - 1 ) and a bunch of crossroads whose
the truck starting point ( 2n ). Clients, deposits and crossroads are called places ( m in total ).
The client's (i) deposit is i+n. The travel times between the differents places of this network are placed in the matrix "time"
where time[i][j]={ necessary time to go from i to j, if i and j are neigbhors -1, if not i,j€{o,.....,m-1}

The truck starts every day at 8am which is time 0. A list "deliveryTime" contains the maximal time of delivery
in minutes from time 0. deliveryTime[i] represents the maximal hour of delivery of the client i. If deliveryTime[0] = 150
than, client 0 will have to be delivered at the latest at 10:30am. The datas n,m,deliveryTime,time will be contained in a file.

The algorithm of resolution has to be contained in a class "Planning" and use a backtracking method "solve()".
Use methods from branch and bound to reduce the number of iterations.

The class Planning has to contain as attributes:
-informations of an instance n,m,deliveryTime, time
-an integer totalTime, initialized at 0 which will contain the total time of the optimal path.
-a list parcours which contains the numbers of the visited places of the optimal path ( like in the screeshot)
-a list actions which will contain for every entry of parcours the informations of the actions made at this place
-an integer count, initialized at zero, which will contain the total number of calls to the methode solve() during
the resolution.
>>
>>53599486

Do you not know what a backtracking algorithm is, or something?
Thread replies: 18
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.