Wednesday, February 10, 2010

Using GLPK in Python through pulp 1.4.7 in Windows Seven (32 bits)

There are several steps before we can use GLPK (GNU Linear Programming Kits) in Python
1. For those who are not familiar with python, you have to learn some of basic Python here (I recommend to use python v.2.6.4).
2. Install Pulp 1.4.7 from here (please also follow the install instruction in Windows)
3. Download the Microsoft Visual Studio Express 2008 from microsoft (Indeed, we just want only visual c compiler, but I've not tried it yet).
4. Download the GLPK from here
5. Goes deep into folder "your download directory"\glpk-4.42\glpk-4.42\w32. Find for the file name Build_GLPK_with_VC9.bat.
6. Open with text editor and check for the path of c compiler (in the case that you have changed the default installation directory of visual C compiler).
7. Run Build_GLPK_with_VC9.bat
8. If the installation was successfully, it will display the message 'OPTIMAL SOLUTION FOUND'.
9. Now, you test with the following script

Note that you have to add the path for all executable files (Python, Easy_install and glpsol) in the environment variables of Windows seven.

from pulp import *

prob = LpProblem("test1", LpMinimize)

# Variables x = LpVariable("x", 0, 4) y = LpVariable("y", -1, 1) z = LpVariable("z", 0)

# Objective prob += x + 4*y + 9*z

# Constraints prob += x+y <= 5 prob += x+z >= 10 prob += -y+z == 7

GLPK().solve(prob)

# Solution for v in prob.variables():    print v.name, "=", v.varValue

print "objective=", value(prob.objective)

Monday, October 5, 2009

Pilot VS Preamble symbol in Wireless communication

The Preamble
A preamble is used in Digital Communication Systems to train the VCO of the receiver to the incoming signals's clock so as to produce a clocking in the reciver that is synchronized to the received signal, and so a perfect sampling and/or demodulation can be done.

The Pilot symbols
The pilot symbols are used in wireless communication systems for the sake of channel estimation and correction purposes. Where the wireless channel have great effect on the phase and the frequency of the wireless signal and alters them by some value, which have many bad side effects and may affect the process of demodulation. Some of these effects as :Phase rotation, doppler frequency shift, degradation of the amplitude and phase distortion. All of these cause poor SNR,SIR and one important thing is it may alter the place of the frequncy of some subcarriers in an OFDM which may cause the loss of othogonality between them and the OFDM symbol is destructed. So, at the transmitter a well known symbol (its freqency,amplitude and phase) is inserted among the subcarriers to carry the effects of the channel, and at the receiver it demodulated and then all the effects are calculated and the received signal is corrected by those calculated amounts

From : http://www.edaboard.com/ftopic163961.html

Thursday, July 23, 2009

Showing OTcl class name from C++ in NS2

Actually, C++ does not have any instruction to display the OTcl name. But if you have observed that each OTcl object has it own address which you can see by enter command "set ns [new Simulator]". The line comes after the command is the address of object ns which.
normally,in the form of "_oxx, xx=number".

You can show the object's class name,in this example $ns, by using two alternatives. "$ns info class" or "_oxx info class" (replaces xx with the number you see after the command "set ns [new Simulator]". From this characteristic, it gives the opportunity to display OTcl name
from C++ (Compiled Hierarchy).

The C++ instruction, "this->name()", gives "_oxx" of the object that pointer "this" inside
So, running this instruction (in C++ function)

tcl.evalf("puts \"OTcl name = [%s info class]\"",this->name());

will gives the OTcl name.

Some warning!!
"this" pointer can be used after the constructor only because it is initialized after running the constructor.

Monday, July 13, 2009

Greek symbol in blogger

The blogger has capability to interpret some html tags. I have test some of Greek symbol below

Alpha a , Beta b symbol.

It's work!!!

Saturday, July 11, 2009

Another bug in GNS3 + Running in Windows Vista

Another bug, I found, occured when I have connect line(fastethernet or serial) to cloud (NIO_UDP) which connect to virtual PC on Ubuntu Jaunty. The GN3 says that it cannot connect to NIO_UDP.

Then I decided to work with GNS3 as Root by invoking GNS3 in commandline in with user root. Everthing is going well until I save the project, the problems which occured to me are
1. GNS3 cannot save the workspace outside root directory (it just process as it saved the project, but actually it is not!!)
2. I cannot open project file (*.net) by double click it (open with default application), I have to open it from commandline (but my friend, same os version, has not!!??).

At last, I decided to work with GNS3 in Windows Vista. But the problem mostly occured in Windows Vista is that it does not provide telnet client at first installation. So I have to install telnet client in Control Panel > Program and Features > (on left pane) Turn windows feature on and off and activate telnet client.

Working with Windows telnet is not a comfortavle way for me, then I install the PuTTY for telnet client. The command that we have to config in Edit > Preferences > General > Terminal command is "start C:\progra~1\PuTTY\putty.exe -telnet 127.0.0.1 %p"

Note
---[ For Windows Vista ]---
1. We have to use address 127.0.0.1 instead of localhost (%h) and %p is the router port number for telnet (console connection)
2. We have to change the path to PuTTY from C:\Program Files\PuTTY\putty.exe to C:\progra~1\PuTTY\putty.exe since it will error (Windows thainks that "C:\Program" is telnet program, ToT)
3. the word "start" is to invoke the commandline application

---[ For Both, Windows Vista and Ubuntu Jaunty ]---
1. The path specifies (both workspace and IOS path) in the project file (*.net) cannot use relative path, we have to enter the absolute path only!!

Friday, July 3, 2009

Bug in GNS3

There is little bug in GNS3 running on Ubuntu Jaunty (9.04). The GNS3 cannot display the workspace which has been configured in *.net file. The GNS3 team said that it is the problem of new vesion of qt library.

To solve the problem, you have to right click on project file *.net and select menu "Open with other application" and browse to gns3 application (If you install through synaptic, it would locate at /usr/bin/gns3) the saved project will show in the workspace.

Thank you to
http://www.gns3.net/phpBB/topic813.html

Thursday, July 2, 2009

Cross platform printer sharing with password protection

After googling many sites, large number of people can setup a share folders,files or printers between Windows and Linux Platform, specifically Ubuntu, without password protection. To limit the access of share folder, pinters, the administrator setups the password for some user account.

In my environment, the Host computer which connect to printers is Windows XP platform and client computer is Ubuntu Jaunty Jackalope (9.04) with samba installed. To access shared printer with password protected, the clients have to follow these step
1. Open printer configuration in Administrator>Printing
2. click on New>Printer
3. On left menu, click on Windows printer via SAMBA
4. click browse to browse to target printer
5. activate Set authentication details now and insert username and password given by administrator (you can test that the printer and password match by click on button verify)
6. click forward
7. browse for target printer's brand and click forward
8. Select model then forward (it would load driver for target printer)
9. activate some options that you'd love to
10. In the last step, it would prompt you to print test page
11. Finish!!

Note :
- you can see the status of printing by clicking on properties of target printer, the status is shown in Printer state : field
- printer sharing works on same subnet only