Esempio n. 1
0
	def compute_matrices(self): #change to compute_matrixes
		#self.TDMA_MODE = 0;
		#eps_vec = .5*np.ones(self.N)
		self.eps_vec = 0*np.ones(self.N)
		#self.i = 1
		#while np.any(np.isnan(self.final_messages)):
		Kprime = len(self.map);
		if self.verbose:
			print 'Remaining ', Kprime, ' nodes are: '
			print self.map
			## special case for one remaining node
		if Kprime == 1:
			self.TOTAL_TRANSMISSIONS += 1
			while not transmit_messages(1, self.eps_vec[self.map]):
				self.TOTAL_TRANSMISSIONS += 1
			self.final_messages[self.map] = self.W[self.map]
		else:
			## Generate next m transmissions
			(self.V, U) = alignment('mixed', self.J, 1e-4, 100, False)
			#try changing it here??
			self.V = np.asarray(self.V)
			print 'new V is '
			print self.V
			#print 'type of new V is ', type(self.V)
			#print 'type of an element of new V is ', type(self.V[0,0])
			self.m = np.shape(self.V)[0]
			if self.verbose:
				print 'Minimum rank is ', self.m
			# generate next symbol based on current V
			L = len(self.tx_symbols);
			if self.i == 1:
				L = 0
			self.unsolved = np.ones(Kprime) > 0
Esempio n. 2
0
    def main_loop(self):
        eps_vec = .5 * np.ones(self.N)
        i = 1
        while np.any(np.isnan(self.final_messages)):
            Kprime = len(self.map)
            if self.verbose:
                print 'Remaining ', Kprime, ' nodes are: '
                print self.map

            ## special case for one remaining node
            if Kprime == 1:
                self.TOTAL_TRANSMISSIONS += 1
                while not transmit_messages(1, eps_vec[self.map]):
                    self.TOTAL_TRANSMISSIONS += 1
                self.final_messages[self.map] = self.W[self.map]
            else:
                ## Generate next m transmissions
                (V, U) = alignment('mixed', self.J, 1e-4, 100, False)
                m = np.shape(V)[0]
                if self.verbose:
                    print 'Minimum rank is ', m

                # generate next symbol based on current V
                L = len(self.tx_symbols)
                if i == 1:
                    L = 0

                unsolved = np.ones(Kprime) > 0
                m_i = 0
                while np.all(unsolved) and m_i < m:
                    self.tx_symbols = np.append(
                        self.tx_symbols, Symbol(V[m_i, :], self.W, self.map))
                    R = transmit_messages(1, eps_vec[self.map])
                    if i == 1:
                        self.rx_symbols = R
                    else:
                        self.rx_symbols = np.bmat([self.rx_symbols, R])
                    if self.verbose:
                        print 'Transmission ', m_i + 1, '/', m
                        print self.rx_symbols.astype(int)
                    self.TOTAL_TRANSMISSIONS += 1
                    # solve for messages if possible
                    #SEND TO TARGET HERE
                    (unsolved, final_messages) = bs_decode_messages(
                        self.dest, Kprime, self.map, self.rx_symbols,
                        self.tx_symbols, self.A, self.I, self.J, self.W,
                        self.final_messages, self.verbose)
                    #RECEIVE FROM TARGET HERE
                    #INTERPRET ACKS HERE
                    m_i += 1
                    i += 1
                    self.final_messages = final_messages
                # update data structures
                self.map = np.nonzero(np.isnan(
                    self.final_messages.reshape(-1)))[0]
                self.rx_symbols = self.rx_symbols[unsolved, :]
                self.J = self.J[unsolved, :]
                self.I = self.I[unsolved, :]
                self.A = self.A[unsolved, :]
        if self.verbose:
            print 'Total number of transmissions: ', self.TOTAL_TRANSMISSIONS
        return self.TOTAL_TRANSMISSIONS
Esempio n. 3
0
    def receive(
        self, src, msg
    ):  #make this main_loop and have it call tdma_stage and index_stage?, or set different modes in the other functions
        #tdma tx, index tx, or completed depending on mode
        if self.TDMA_MODE == 1:
            #print 'ileft is ', self.ileft, ', size if tdleft is  ', np.size(self.TDleft)
            if self.ileft == np.size(self.TDleft):
                self.ileft = 0
                #only update acklist here?
                #not completely correct?? what if size changes inbetween?
                #only update tdleft here?
                self.TDleft = np.nonzero(np.isnan(self.ackList.reshape(-1)))[0]
            print 'RECEIVE FUNCTION (TDMA)'
            rmsg = T2HMsg(msg.dataGet())
            #check for acks, remove nodes with ack type 1 from TDMAleft, record transmissions?
            newAck = rmsg.get_ACKs()
            print 'Acks for transmission number ', rmsg.get_transmission(
            ), ': ', newAck  #first one is 8? 2? garbage value
            #print 'Element equal to 1: ', np.array(newAck)==1 #want this to be an array of logicals
            self.ackList[np.array(newAck) == 1] = 1
            #self.TDleft = np.nonzero(np.isnan(self.ackList.reshape(-1)))[0]
            #call tdma_stage(self) at end if np.any(np.isnan(self.ackList))
            if np.any(np.isnan(self.ackList)):
                #self.tm = self.tm + 1
                #for i in self.TDleft:
                Transmitter.tdma_stage(self)
                self.ileft += 1

            else:
                print 'Finished TDMA after ', self.TDMA_TRANSMISSIONS, ' transmissions.'  #use get_transmission from receive function? will it make a difference?
                #COMPUTE ATTEMPTS PER NODE??
                self.TDMA_MODE = 0
                #initialize and proceed to index coding mode
                self.m_i = 0
                self.i = 1
                self.m = 0
                self.unsolved = self.map > -50
                #array of true the size of self.map
                self.rx_symbols = 0
                self.eps_vec = 0 * np.ones(self.N)
                R = transmit_messages(1, self.eps_vec[self.map])
                self.rx_symbols = R
                #send the first index message here? call compute_matrices for the first time here?
                #handle first case here?

        elif self.TDMA_MODE == 0:
            print 'RECEIVE FUNCTION (INDEX CODING)'
            #get next set of messages
            #if self.m_i == m or self.i == 0:
            #update data structures and map (next unsolved vector) once the round has been completed
            #if self.m_i == self.m or np.any(~self.unsolved):
            #self.m_i = 0;
            if self.TOTAL_TRANSMISSIONS == 0:
                self.map = np.nonzero(np.isnan(
                    self.final_messages.reshape(-1)))[0]
                self.rx_symbols = self.rx_symbols[self.unsolved, :]
                self.J = self.J[self.unsolved, :]
                self.I = self.I[self.unsolved, :]
                self.A = self.A[self.unsolved, :]
                Transmitter.compute_matrices(self)
                #time.sleep(3)
                #case for first transmission, must compute matrices first?
                self.TOTAL_TRANSMISSIONS = 1
                Transmitter.index_stage(self)
                #self.m_i += 1
                #self.i += 1
                return

            #if self.m_i == self.m or np.any(~self.unsolved):
            ##Transmitter.compute_matrices(self)
            #self.map = np.nonzero(np.isnan(self.final_messages.reshape(-1)))[0]
            #self.rx_symbols = self.rx_symbols[self.unsolved, :]
            #self.J = self.J[self.unsolved, :]
            #self.I = self.I[self.unsolved, :]
            #self.A = self.A[self.unsolved, :]
            #Transmitter.compute_matrices(self)
            ##case for first transmission, must compute matrices first?
            #if self.TOTAL_TRANSMISSIONS == 0:
            #self.TOTAL_TRANSMISSIONS = 1
            #Transmitter.index_stage(self)
            #self.m_i += 1
            #self.i += 1
            #return


#

            rmsgx = T2HMsg(msg.dataGet())
            #check for acks, remove nodes with ack type 1 from TDMAleft, record transmissions?
            newAck = np.array(rmsgx.get_ACKs())
            #print 'Acks for transmission number ', rmsgx.get_transmission(), ': ', newAck
            print 'RX ACKS: ', newAck
            print 'Remaining nodes: ', self.map
            self.unsolved = newAck[self.map] != 1
            #self.final_messages2 = self.final_messages
            self.final_messages[newAck == 1] = 1
            #CALCULATE ERASURES FROM THE NUMBER OF 2S
            #self.unsolved = self.final_messages != 1
            #print 'Rx DEST ', self.dest
            #print 'Rx NEW UNSOLVED: ', self.unsolved
            #print 'Rx NEW finalmessages: '
            #print self.final_messages

            if self.m_i == self.m or np.any(~self.unsolved):
                #Transmitter.compute_matrices(self)
                self.m_i = 0
                self.map = np.nonzero(np.isnan(
                    self.final_messages.reshape(-1)))[0]
                self.rx_symbols = self.rx_symbols[self.unsolved, :]
                self.J = self.J[self.unsolved, :]
                self.I = self.I[self.unsolved, :]
                self.A = self.A[self.unsolved, :]
                Transmitter.compute_matrices(self)
                #time.sleep(3)

            #send to all motes at end if np.any(np.isnan(self.final_messages)) ??
            if np.any(np.isnan(self.final_messages)):
                #print 'm_i' ,self.m_i
                self.tx_symbols = np.append(
                    self.tx_symbols,
                    Symbol(self.V[self.m_i, :], self.W, self.map))
                R = transmit_messages(1, self.eps_vec[self.map])
                if self.i == 1:
                    self.rx_symbols = R
                else:
                    self.rx_symbols = np.bmat([self.rx_symbols, R])
                #if self.verbose:
                #print 'Transmission ', self.m_i+1, '/', self.m  #m_i+1 or now just m_i ???
                #print self.rx_symbols.astype(int)
                self.TOTAL_TRANSMISSIONS += 1
                Transmitter.index_stage(self)
                #self.m_i += 1
                #self.i += 1
                #Transmitter.compute_matrices(self)
                #print 'late unsolved is ', self.unsolved
            else:
                if self.verbose:
                    print 'ITERATION', self.it, ', INDEX CODING TRANSMISSIONS:', self.TOTAL_TRANSMISSIONS
                #COMPUTE ATTEMPTS PER NODE?
                #self.TDMA_MODE = -1
                #call cleanup and reset functions!!!!!
                Transmitter.cleanup(self)
                if (self.it < self.itMax):
                    Transmitter.reset(self)
                else:
                    self.TDMA_MODE = -1
                return self.TOTAL_TRANSMISSIONS  #also exit program?
        else:
            #completed, print this indefinitely
            #print 'INDEX CODING COMPLETE: Total number of transmissions: ', self.TOTAL_TRANSMISSIONS
            print self.it, 'ITERATIONS COMPLETE'
            return self.TOTAL_TRANSMISSIONS
	def receive(self,src,msg):  #make this main_loop and have it call tdma_stage and index_stage?, or set different modes in the other functions
		#tdma tx, index tx, or completed depending on mode
		if self.TDMA_MODE==1:
			#print 'ileft is ', self.ileft, ', size if tdleft is  ', np.size(self.TDleft)
			if self.ileft == np.size(self.TDleft):
				self.ileft = 0; #only update acklist here?
				#not completely correct?? what if size changes inbetween?
				#only update tdleft here?
				self.TDleft = np.nonzero(np.isnan(self.ackList.reshape(-1)))[0] 				
			print 'RECEIVE FUNCTION (TDMA)'
			rmsg = T2HMsg(msg.dataGet())
			#check for acks, remove nodes with ack type 1 from TDMAleft, record transmissions?
			newAck = rmsg.get_ACKs()
			print 'Acks for transmission number ', rmsg.get_transmission(), ': ', newAck #first one is 8? 2? garbage value
			#print 'Element equal to 1: ', np.array(newAck)==1 #want this to be an array of logicals
			self.ackList[np.array(newAck)==1] = 1
			#self.TDleft = np.nonzero(np.isnan(self.ackList.reshape(-1)))[0]
			#call tdma_stage(self) at end if np.any(np.isnan(self.ackList))
			if np.any(np.isnan(self.ackList)):
				#self.tm = self.tm + 1
				#for i in self.TDleft:
				Transmitter.tdma_stage(self)
				self.ileft += 1
				
			else:
				print 'Finished TDMA after ', self.TDMA_TRANSMISSIONS, ' transmissions.' #use get_transmission from receive function? will it make a difference?
				#COMPUTE ATTEMPTS PER NODE??
				self.TDMA_MODE = 0; #initialize and proceed to index coding mode
				self.m_i = 0;
				self.i = 1;
				self.m = 0;
				self.unsolved = self.map > -50; #array of true the size of self.map 
				self.rx_symbols = 0;
				self.eps_vec = 0*np.ones(self.N)
				R = transmit_messages(1, self.eps_vec[self.map])
				self.rx_symbols = R
				#send the first index message here? call compute_matrices for the first time here?
				#handle first case here?
	
		elif self.TDMA_MODE == 0:
			print 'RECEIVE FUNCTION (INDEX CODING)'
			#get next set of messages
			#if self.m_i == m or self.i == 0:
			#update data structures and map (next unsolved vector) once the round has been completed
			#if self.m_i == self.m or np.any(~self.unsolved):
				#self.m_i = 0;
			if self.TOTAL_TRANSMISSIONS == 0:
				self.map = np.nonzero(np.isnan(self.final_messages.reshape(-1)))[0]
				self.rx_symbols = self.rx_symbols[self.unsolved, :]
				self.J = self.J[self.unsolved, :]
				self.I = self.I[self.unsolved, :]
				self.A = self.A[self.unsolved, :]
				Transmitter.compute_matrices(self)
				#time.sleep(3)
				#case for first transmission, must compute matrices first?
				self.TOTAL_TRANSMISSIONS = 1
				Transmitter.index_stage(self)
				#self.m_i += 1
				#self.i += 1
				return
			
			
			#if self.m_i == self.m or np.any(~self.unsolved):
				##Transmitter.compute_matrices(self)
				#self.map = np.nonzero(np.isnan(self.final_messages.reshape(-1)))[0]
				#self.rx_symbols = self.rx_symbols[self.unsolved, :]
				#self.J = self.J[self.unsolved, :]
				#self.I = self.I[self.unsolved, :]
				#self.A = self.A[self.unsolved, :]
				#Transmitter.compute_matrices(self)			
			##case for first transmission, must compute matrices first?
			#if self.TOTAL_TRANSMISSIONS == 0:
				#self.TOTAL_TRANSMISSIONS = 1
				#Transmitter.index_stage(self)
				#self.m_i += 1
				#self.i += 1
				#return
#	
			
			rmsgx = T2HMsg(msg.dataGet())
			#check for acks, remove nodes with ack type 1 from TDMAleft, record transmissions?
			newAck = np.array(rmsgx.get_ACKs())
			#print 'Acks for transmission number ', rmsgx.get_transmission(), ': ', newAck
			print 'RX ACKS: ' , newAck
			print 'Remaining nodes: ', self.map
			self.unsolved = newAck[self.map] != 1
			#self.final_messages2 = self.final_messages
			self.final_messages[newAck==1] = 1
			#CALCULATE ERASURES FROM THE NUMBER OF 2S
			#self.unsolved = self.final_messages != 1
			#print 'Rx DEST ', self.dest
			#print 'Rx NEW UNSOLVED: ', self.unsolved
			#print 'Rx NEW finalmessages: '
			#print self.final_messages
			
			if self.m_i == self.m or np.any(~self.unsolved):
				#Transmitter.compute_matrices(self)
				self.m_i = 0;
				self.map = np.nonzero(np.isnan(self.final_messages.reshape(-1)))[0]
				self.rx_symbols = self.rx_symbols[self.unsolved, :]
				self.J = self.J[self.unsolved, :]
				self.I = self.I[self.unsolved, :]
				self.A = self.A[self.unsolved, :]
				Transmitter.compute_matrices(self)
				#time.sleep(3)

			
			#send to all motes at end if np.any(np.isnan(self.final_messages)) ?? 
			if np.any(np.isnan(self.final_messages)):
				#print 'm_i' ,self.m_i
				self.tx_symbols = np.append(self.tx_symbols, Symbol(self.V[self.m_i,:], self.W, self.map))
				R = transmit_messages(1, self.eps_vec[self.map])
				if self.i == 1:
					self.rx_symbols = R
				else:
					self.rx_symbols = np.bmat([self.rx_symbols, R])
				#if self.verbose:
					#print 'Transmission ', self.m_i+1, '/', self.m  #m_i+1 or now just m_i ???
					#print self.rx_symbols.astype(int)
				self.TOTAL_TRANSMISSIONS += 1
				Transmitter.index_stage(self)
				#self.m_i += 1
				#self.i += 1
				#Transmitter.compute_matrices(self)
				#print 'late unsolved is ', self.unsolved
			else:
				if self.verbose:
					print 'ITERATION', self.it, ', INDEX CODING TRANSMISSIONS:', self.TOTAL_TRANSMISSIONS
				#COMPUTE ATTEMPTS PER NODE?
				#self.TDMA_MODE = -1
				#call cleanup and reset functions!!!!!
				Transmitter.cleanup(self)
				if (self.it < self.itMax):
					Transmitter.reset(self)
				else:
					self.TDMA_MODE = -1
				return self.TOTAL_TRANSMISSIONS #also exit program?
		else:
			#completed, print this indefinitely
			#print 'INDEX CODING COMPLETE: Total number of transmissions: ', self.TOTAL_TRANSMISSIONS
			print self.it, 'ITERATIONS COMPLETE'
			return self.TOTAL_TRANSMISSIONS
	def main_loop(self): #change to compute_matrixes
		smsgx = TxSerialMsg()
		self.TDMA_MODE = 0;
		eps_vec = .5*np.ones(self.N)
		i = 1
		while np.any(np.isnan(self.final_messages)):
			Kprime = len(self.map);
			if self.verbose:
				print 'Remaining ', Kprime, ' nodes are: '
				print self.map

			## special case for one remaining node
			if Kprime == 1:
				self.TOTAL_TRANSMISSIONS += 1
				while not transmit_messages(1, eps_vec[self.map]):
					self.TOTAL_TRANSMISSIONS += 1
				self.final_messages[self.map] = self.W[self.map]
			else:
				## Generate next m transmissions
				(V, U) = alignment('mixed', self.J, 1e-4, 100, False)
				m = np.shape(V)[0]
				if self.verbose:
					print 'Minimum rank is ', m

				# generate next symbol based on current V
				L = len(self.tx_symbols);
				if i == 1:
					L = 0

				self.unsolved = np.ones(Kprime) > 0
				m_i = 0
				while np.all(self.unsolved) and m_i < m:
					self.tx_symbols = np.append(self.tx_symbols, Symbol(V[m_i,:], self.W, self.map))
					R = transmit_messages(1, eps_vec[self.map])
					if i == 1:
						self.rx_symbols = R
					else:
						self.rx_symbols = np.bmat([self.rx_symbols, R])
					if self.verbose:
						print 'Transmission ', m_i+1, '/', m
						print self.rx_symbols.astype(int)
					self.TOTAL_TRANSMISSIONS += 1
					# solve for messages if possible
					(self.unsolved, final_messages) = bs_decode_messages(self.dest, Kprime, self.map,
							self.rx_symbols, self.tx_symbols, self.A, self.I, self.J, self.W, self.final_messages, self.verbose)
					time.sleep(.2)
					print 'UNSOLVED: ', self.unsolved
					print 'MAP: ' , self.map
					#SEND TO TARGET HERE, rewrite these lines
					#smsg.set_crow
					print 'tx map ', self.map
					smsgx.set_messageid(255)  #now something to represent index coding, 255?
					smsgx.set_data(np.dot(V[m_i],self.W,))					
					##also send own message w[i] for comparison????
					smsgx.set_V_row(V[m_i]) 
					smsgx.set_current_transmission(self.TOTAL_TRANSMISSIONS)
					self.mif.sendMsg(self.source, 0xFFFF, smsgx.get_amType(), 0, smsgx)
					#time.sleep(1) #.125 too fast?
	
					#INTERPRET ACKS IN RECEIVE FUNCTION
					m_i += 1
					i += 1
					self.final_messages = final_messages #still need final messages??
				# update data structures
				self.map = np.nonzero(np.isnan(self.final_messages.reshape(-1)))[0]
				self.rx_symbols = self.rx_symbols[self.unsolved, :]
				self.J = self.J[self.unsolved, :]
				self.I = self.I[self.unsolved, :]
				self.A = self.A[self.unsolved, :]
		if self.verbose:
			print 'Total number of transmissions: ', self.TOTAL_TRANSMISSIONS
		return self.TOTAL_TRANSMISSIONS
    def main_loop(self):
        eps_vec = 0.5 * np.ones(self.N)
        i = 1
        while np.any(np.isnan(self.final_messages)):
            Kprime = len(self.map)
            if self.verbose:
                print "Remaining ", Kprime, " nodes are: "
                print self.map

                ## special case for one remaining node
            if Kprime == 1:
                self.TOTAL_TRANSMISSIONS += 1
                while not transmit_messages(1, eps_vec[self.map]):
                    self.TOTAL_TRANSMISSIONS += 1
                self.final_messages[self.map] = self.W[self.map]
            else:
                ## Generate next m transmissions
                (V, U) = alignment("mixed", self.J, 1e-4, 100, False)
                m = np.shape(V)[0]
                if self.verbose:
                    print "Minimum rank is ", m

                    # generate next symbol based on current V
                L = len(self.tx_symbols)
                if i == 1:
                    L = 0

                unsolved = np.ones(Kprime) > 0
                m_i = 0
                while np.all(unsolved) and m_i < m:
                    self.tx_symbols = np.append(self.tx_symbols, Symbol(V[m_i, :], self.W, self.map))
                    R = transmit_messages(1, eps_vec[self.map])
                    if i == 1:
                        self.rx_symbols = R
                    else:
                        self.rx_symbols = np.bmat([self.rx_symbols, R])
                    if self.verbose:
                        print "Transmission ", m_i + 1, "/", m
                        print self.rx_symbols.astype(int)
                    self.TOTAL_TRANSMISSIONS += 1
                    # solve for messages if possible
                    # SEND TO TARGET HERE
                    (unsolved, final_messages) = bs_decode_messages(
                        self.dest,
                        Kprime,
                        self.map,
                        self.rx_symbols,
                        self.tx_symbols,
                        self.A,
                        self.I,
                        self.J,
                        self.W,
                        self.final_messages,
                        self.verbose,
                    )
                    # RECEIVE FROM TARGET HERE
                    # INTERPRET ACKS HERE
                    m_i += 1
                    i += 1
                    self.final_messages = final_messages
                    # update data structures
                self.map = np.nonzero(np.isnan(self.final_messages.reshape(-1)))[0]
                self.rx_symbols = self.rx_symbols[unsolved, :]
                self.J = self.J[unsolved, :]
                self.I = self.I[unsolved, :]
                self.A = self.A[unsolved, :]
        if self.verbose:
            print "Total number of transmissions: ", self.TOTAL_TRANSMISSIONS
        return self.TOTAL_TRANSMISSIONS
    def main_loop(self):  #change to compute_matrixes
        smsgx = TxSerialMsg()
        self.TDMA_MODE = 0
        eps_vec = .5 * np.ones(self.N)
        i = 1
        while np.any(np.isnan(self.final_messages)):
            Kprime = len(self.map)
            if self.verbose:
                print 'Remaining ', Kprime, ' nodes are: '
                print self.map

            ## special case for one remaining node
            if Kprime == 1:
                self.TOTAL_TRANSMISSIONS += 1
                while not transmit_messages(1, eps_vec[self.map]):
                    self.TOTAL_TRANSMISSIONS += 1
                self.final_messages[self.map] = self.W[self.map]
            else:
                ## Generate next m transmissions
                (V, U) = alignment('mixed', self.J, 1e-4, 100, False)
                m = np.shape(V)[0]
                if self.verbose:
                    print 'Minimum rank is ', m

                # generate next symbol based on current V
                L = len(self.tx_symbols)
                if i == 1:
                    L = 0

                self.unsolved = np.ones(Kprime) > 0
                m_i = 0
                while np.all(self.unsolved) and m_i < m:
                    self.tx_symbols = np.append(
                        self.tx_symbols, Symbol(V[m_i, :], self.W, self.map))
                    R = transmit_messages(1, eps_vec[self.map])
                    if i == 1:
                        self.rx_symbols = R
                    else:
                        self.rx_symbols = np.bmat([self.rx_symbols, R])
                    if self.verbose:
                        print 'Transmission ', m_i + 1, '/', m
                        print self.rx_symbols.astype(int)
                    self.TOTAL_TRANSMISSIONS += 1
                    # solve for messages if possible
                    (self.unsolved, final_messages) = bs_decode_messages(
                        self.dest, Kprime, self.map, self.rx_symbols,
                        self.tx_symbols, self.A, self.I, self.J, self.W,
                        self.final_messages, self.verbose)
                    time.sleep(.2)
                    print 'UNSOLVED: ', self.unsolved
                    print 'MAP: ', self.map
                    #SEND TO TARGET HERE, rewrite these lines
                    #smsg.set_crow
                    print 'tx map ', self.map
                    smsgx.set_messageid(
                        255)  #now something to represent index coding, 255?
                    smsgx.set_data(np.dot(
                        V[m_i],
                        self.W,
                    ))
                    ##also send own message w[i] for comparison????
                    smsgx.set_V_row(V[m_i])
                    smsgx.set_current_transmission(self.TOTAL_TRANSMISSIONS)
                    self.mif.sendMsg(self.source, 0xFFFF, smsgx.get_amType(),
                                     0, smsgx)
                    #time.sleep(1) #.125 too fast?

                    #INTERPRET ACKS IN RECEIVE FUNCTION
                    m_i += 1
                    i += 1
                    self.final_messages = final_messages  #still need final messages??
                # update data structures
                self.map = np.nonzero(np.isnan(
                    self.final_messages.reshape(-1)))[0]
                self.rx_symbols = self.rx_symbols[self.unsolved, :]
                self.J = self.J[self.unsolved, :]
                self.I = self.I[self.unsolved, :]
                self.A = self.A[self.unsolved, :]
        if self.verbose:
            print 'Total number of transmissions: ', self.TOTAL_TRANSMISSIONS
        return self.TOTAL_TRANSMISSIONS