Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Assignment of part is not a symbol' topicStudent Support Forum > General > "Assignment of part is not a symbol"

Next Comment >Help
Author Comment/Response
Jim Youngman
09/24/02 9:47pm

I have created the module below. At run time I get the error message:

Set::"setps": "\!\(dataTerrit$55 \[LeftDoubleBracket] i$55 \
\[RightDoubleBracket]\) in assignment of part is not a symbol."

What have I done wrong?

Jim

fitness[regionData_, adjacencies_, partition_, maxResponse_, speed_,
timeServ_ , sdServ_] :=
Module[{reg, parts, i, j, territs, zones, numZones, dataTerrit, servers,
connection, outvalue},
data = regionData; (*
e.g. {{1, 3, 24}, {2, 6, 18}, {3, 4, 16} ...} *)
parts = partition; (* e.g. {{1, 3}, {2, 4, 5}, {6}} *)
territs = Length[partition]; (*
Number of territories or parts in partition *)
servers = 0; (*
Initialise counter for number of servers *)
dataTerrit = {} ; (*
Initialise vector to hold data for territories *)
For[i = 1, i <= territs, i++,
dataTerrit = Append[dataTerrit, {0, 0, 0}]];
linkedTerrits = True; (*
Initialise connection variable to True.
This will remain true if all territories are connected *)
For[i = 1, i <= territs, i++,
linkedTerrits =
linkedTerrits &&
ConnectedQ[
InduceSubgraph[FromAdjacencyLists[adjacencies], parts[[i]]]]
]; (* Completes check that all territories are connected. *)
If[linkedTerrits == True, (*
If all are connected then calculate total servers reqd. *)
For[i = 1, i <= territs, i++,
zone = parts[[i]]; (* ith zone or territory *)
numZone = Length[zone]; (* number of atoms in zone or territory *)
If[numZone == 0,

dataTerrit[[i]] = {i, 0, 0}, (* If territory is empty,
set area and demand both to 0 *)

dataTerrit[[i]] = {0, 0, 0}; (*
else Sum areas and demands for territory *)
For [j = 1, j <= numZone, j++,
dataTerrit[[i]] = dataTerrit[[i]] + data[[zone[[j]]]]
];

dataTerrit[[i]][[1]] = i; (*
Set first element of data vector to label of territory *)
];
servers =
servers +
numServers [dataTerrit[[i]], maxResponse, speed, timeServ,
sdServ];
];
outvalue = territs/servers,(* If all connected,
fitness is inverse of servers per territory *)
outvalue = 0 (* Otherwise zero fitness *)
];
outvalue (* Output the fitness of the partition *)
]

URL: ,

Thread 'Assignment of part is not a symbol' is now CLOSED
Author Date Posted
Assignment of part is not a symbol Jim Youngman 09/24/02 9:47pm
Re: Assignment of part is not a symbol Forum Modera... 09/30/02 8:58pm
Next Comment >Help