JOIN
Get Time
forums   
Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings
View: Flat (newest first)  | Threaded  | Tree
Previous Thread  |  Next Thread
ambiguous variable | Reply
Hi,

I actually try to implement the algorithm to my problem but although it is very well explained/depicted I'm not that much into that algorithm (relatively the programming example). I would like to dive into it by applying it but when I copy the code and compile it I receive the error, that "prev" is ambigous (in several lines).
Before I change it to my purposes I would like to run it in its origin so I can understand how it works in details but I already stuck at the beginning :(
Can someone help me, please ?

Thank you very much in advance!
Ben
Re: ambiguous variable (response to post by SkullCrossbone) | Reply
Hi,
was busy with some other projects but just returned to the still open problem. Meanwhile I figured out that what my compiler complains is obviously less a previously declared variable but refers to a template "prev". I didn't know that this exists so I cracked my brain with a lot of ideas what might be wrong..
Can you please tell me if prev[N] is here only a variable name or shall it indeed represent a template (I'm using g++ and c++) ?
Re: ambiguous variable (response to post by SkullCrossbone) | Reply
You are struggling from the new C++11 feature.
There is a function called prev in
<iterator>
header, which might be included by other headers you are using. So, either rename all occurrences of prev to something else, or do no
using namespace std;
Re: ambiguous variable (response to post by gorbunov) | Reply
Hi, yes, thank you! I already corrected it but to be sure is good!

I'm changing the code to c++ completely and also that the amount of workers/jobs will not be given before runtime. The latter cost me some nerves, too but I also succeeded that now :) When I'm finish (in a few weeks..) I'll post the code for public, maybe someone is interested (sooner or later :).

Anyhow: At the moment I stuck at initializing the labels in
" lx[x] = max(lx[x], cost[x][y]); "

In the tutorial they say lx shall be max(w(x,y)) and ly e.g. be zero respectively:

"Vertex labeling

This is simply a function (for each vertex we assign some number called a label). Let's call this labeling feasible if it satisfies the following condition: . In other words, the sum of the labels of the vertices on both sides of a given edge are greater than or equal to the weight of that edge"

What is meant by "for each vertex we assign some number called a label" ? In my case I conern the distance of two positions, so will this be a label ? But how can each vertex get a label ? Shouldn't it be "a label between two vertices" ? Like the distance between each a position to each other position ?
Sorry for my stupid questions, I'm learning the algorithm (in detail) parallel to the programming what makes it a bit difficult than usual.

Thank you very much in advance!

P.S.: Or is labeling somewhat like:

Assume several devices and a label would be like "parameter of device1 = 18 V" and "parameter of device2 = 7V" ? So getting two labels "18V" and "7V" ?
RSS