[BangPypers] [Ncr-Python.in] [HELP] QUERIES RELATED TO PYTHON

Gora Mohanty gora at mimirtech.com
Sun Apr 21 19:38:47 CEST 2013

On 21 April 2013 16:54, saurabh chandra <fatboyslimchandra at gmail.com> wrote:
> I am trying to develop an algorithm for a combinatorial optimization. The
> problem consists of a graph network with nodes and connected arcs. In this
> algorithm I have to choose an optimal combination of nodes out of all the
> nodes in the graph. The successive nodes are selected as entries in the list
> using a random search technique. Successive nodes share a precedence
> relationship.

This description is not very clear, at least to me. What is an
"optimal combination"
in this case? Why does it make sense to use a random search?

> In each iteration of the algorithm I generate a combination of a subset of
> nodes chosen randomly from the whole node-set, as a list. In the same loop I
> carry out a modification of the generated list and calculate the objective
> value associated with this . A particular generated list in any loop will
> give rise to a single modified list.
> Now I do not want same list to be generated again and again, so I maintain a
> super-list of generated lists and check the membership of each new list in
> this super-list. I restart the loop if same list appears again in the
> algorithm. As I already said the original list gets modified within an
> iteration. The problem is that although I append the super-list with the
> original list before modification, as soon as I modify this original list
> the list added to the super-list also changes automatically. Thus the
> iteration goes on even if the same list is generated again and again.

Perhaps your best bet would be to show us some code, and describe
which parts are not working as you expect them to. You might want
to use pastebin.com for that. See if you can distil your code down to
a small example that demonstrates the issue that you are facing.


More information about the BangPypers mailing list