Can you notify me when the run is over?

18 06 2012

It is not directly an OR related post. I am writing this, because it may help you some others, who have same problems as me.

While I’m getting a simulation run from Java (it is a simulation for a heuristic in my thesis) I’m surfing on the internet, because it is boring to wait. It is not certain when the run will over. So I looked for a solution and came up with an idea; playing a sound file!

First of all I have found a simple “beep” file, which you can download here. I placed the wav file into my desktop. Then in Java I used the following codes;

AudioClip song;
URL songPath = null;
try {
songPath = new URL(“file:///”+System.getProperty(“user.home”)+”/Desktop/beep.wav”);
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
song = Applet.newAudioClip(songPath);

…. stuff goes here, calculations, etc,etc…

song.play();

Well, you see, it is easy as pie. In most programming language, there is a simple way to play sound file. In this text it is for Java programming language in Windows 7. I think it is suitable for most platforms though. AudioClip and URL are included Java API. So you don’t need any other library for this job.

Hope your calculations be faster!

Advertisements




Gurobi: Starting from a solution for Mixed Integer Programming Problem by Using Interactive Shell

14 06 2012

As you may know, Gurobi is a powerful solver for MIP formulations. In this post, I will briefly explain how to start simplex algorithm by using an initial solution.

Gurobi can read and write files in “.mst” format for loading/saving solutions. Suppose, you have a formulation and know a good solution for starting. In order to load the solution, you need to write your own .mst file. MST format is easy to handle; click here for reference. You need to start with hash sign (#) and list variable names and their values by placing a space between. Then you can use the following code in interactive shell:

gurobi> m=read(“yourmodelname.lp”)
gurobi> m.read(“yourmstfile.mst”)
gurobi> m.optimize()

Simple, isn’t it? You will see that your solution will be loaded as initial solution.

Now, suppose you have two formulations where only objective functions are different. Then, you can record solution of the first one in mst format. Here:

gurobi> m=read(“yourfirstmodel.lp”)
gurobi> m.optimize()
… stuff stuff
gurobi> m.write(“mymstfile.mst”)
gurobi> n=read(“yoursecondmodel.lp”)
gurobi> n.read(“mymstfile.mst”)
gurobi> n.optimize()

Well you can interrupt first model at any time by pressing Ctrl+C and can apply the same procedure.

Hope it helps, you can ask your questions.





Hello World, Hello Earthlings

14 06 2012

Hi,

As a “prospective” PhD student (in Industrial and Systems Engineering), I am starting this blog at the moment for helping anyone, who uses computer and software for ISE related works. During all my undergraduate and graduate education, I always enjoyed with computer interactive jobs. Object Oriented Programming, Database, Open Source Tools, Computation Software, Optimization Software, Simulation, Web Programming are included in my knowledge. I believe that effective use computing power can be spread to people need supporting systems for their jobs.

Of course, I am well aware that there is a huge stuff that I don’t know anything about, however, I decided to share my humble knowledge. There is also another intention of this blog: I am expecting to learn from you, as well. Your comments, questions, corrections (including my English and grammar, since I am not a native speaker/writer) are welcome. Hope, the content comes in handy for someone.

Thank you for reading me!