Friday, September 30, 2011

OR, the Environment, and the Law of Unintended Consequences

The topic of the INFORMS blog challenge for September is "OR and the Environment", and I'm slipping this in just under the wire.  My guess is that most if not all of the other challenge entries will extol some way in which the use of OR helps the environment.  I shall be (slightly) contrarian here.

*****

Problem: Reduce the cost of shipping raw materials and manufactured goods by sea.

Solution: Companies use OR techniques to pack vessels more efficiently (reducing the number of loads), route vessels more efficiently (reducing transit times and, hopefully, total travel distances), etc.

Short-term Environmental Impact: Fewer ships covering less distance means less consumption of fossil fuels, so less air (and water) pollution.

Long-term Environmental Impact: Lower shipping costs make it more cost effective for manufacturers in Europe and the US to purchase materials and components from distant countries such as India and China, shifting the manufacturing operations from regions with relatively stringent environmental reg (medium environmental regulation) ulations to regions with more lax regulations. The increased volume being shipped by ocean more than offsets the reduction in distance per shipment and results in an increase in ocean traffic.

*****

Problem: Make alternative fuel sources for automobiles more cost-effective.

Solution: Employ OR techniques to improve the manufacture and distribution of gasohol (gasoline/alcohol mixtures), reducing the pump price and therefore expanding the consumption of gasohol.

Short-term Environmental Impact: Some of the demand for a non-renewable source (fossil fuels) with a relatively high pollutant output is shifted to a renewable source (crops such as corn) with a lower pollutant content.

Long-term Environmental Impact: Crops previously grown as animal feed or for human consumption are diverted to the more profitable biofuel production, causing shortages or price increases in food. In some countries, this causes farmers to clear forest areas for replanting with food crops. Forests capture carbon more efficiently than food crops do, and clearing a forest by burning it releases significant amounts of carbon. (There are also arguments in both directions as to whether biofuels actually produce a net gain in energy or reduce net pollution when the activities involved in growing the crops are factored in.)

*****

Does this mean that I think OR is bad for the environment?  Not at all; but it's not automatically good for the environment either.  What OR brings to the table that might be most important, in the context of environmental impact, is a systems perspective.  Hopefully OR practitioners can help decision-makers view problems in sufficient breadth, and yet with sufficient (model-aided?) clarity, to recognize the secondary and tertiary effects of their choices. That still leaves the issue of getting environmental impact on the table as a criterion for evaluating choices -- which is a political, not mathematical problem.

Sunday, September 25, 2011

Fixing TiKZ/PGF to Work with Gnuplot

While working on a new presentation today (in Beamer), I grabbed a slide from a previous presentation (one I reuse annually). The slide contains PGF code that uses Gnuplot to plot functions (which I then annotate using PGF commands). Small problem: the transplanted slide didn't work (no curves on the plot) ... which led me to attempt to recompile the original presentation and discover that it, too, no longer worked. Grrr!

Poking in the files in the /tmp directory showed me that Gnuplot was crabbing about a command (set terminal table) that PGF uses to tell it to create a text file with the points to be plotted. A bit of searching led me to a blog post by
Toine Bogers containing the fix. Instructions for Linux follow (I haven't tried it on Windows yet):
  1. Open a terminal and run 'kpsewhich pgfmoduleplot.code.tex' to locate the file you need to edit. (The location varies with the LaTeX distribution you use; this takes the work out of finding it.)
  2. Issue 'sudo gedit <path>/pgfmoduleplot.code.tex' (where <path> is the path you found in the previous step) and give your password when prompted. (Feel free to use a different editor if gedit is not your cup of tea.)
  3. Find the line containing 'set terminal table' and delete the word 'terminal', so that it becomes 'set table' (the rest of the line staying unchanged).
  4. Save the modified file, and you should be good to go
In LyX, you also have to go to Tools > Preferences... > File Handling > Converters, locate the converter for LaTeX (pdflatex) -> PDF (pdflatex), and tweak the Converter: entry to read 'pdflatex -shell-escape $$i'. Then click Modify and Save. If you use other formats besides PDF (pdflatex) to view/export Beamer presentations, you may have to add the -shell-escape flag (or something similar) to them as well. The flag allows pdflatex to run an external program (in this case gnuplot) in a shell.  Users of other other LaTeX editing software will likely need a similar tweak.

I love open source software, but one of the challenges of using lots of separate pieces of software is that developers will change something in the latest version of one program or library, and that change will break some interaction with another program/library from an entirely separate developer. To modify a saying from my misspent youth: "You pays your money [or, in this case, you don't] and you takes your chances."

Saturday, September 24, 2011

Fixing CUPS-PDF

Not that I needed to find another bug in Mint 11 Katya/Ubuntu 11 Natty, but I just discovered that the "Print to PDF" printer (cups-pdf) was writing a 2.1 KB PDF file containing a single blank page, regardless of what I printed.  A quick web search turned up multiple reports of this.  I used Synaptic to reinstall the cups-pdf package, to no avail.  The solution (which I found on a bug report web page) was to go into Control Center > Printing, delete the "Print to PDF" printer entirely, then use Server > New Printer to reinstall it.  It seems to be working now.  I wonder what the interarrival time for the next gremlin is.  :-(

Thursday, September 15, 2011

Comment Spam

In the interest of free and open discussion (and because I've been known to make mistakes, which I hope someone will correct), I leave this blog open to comments from anyone, with no registration requirement.  To date I've gotten very little comment spam.  (If you're not sure what "comment spam" is, it's some self-promoting poster child for rectal problems leaving a comment that has nothing to do with the actual blog entry and everything to do with drawing attention to a website they own.)  On the rare occasions when I do get comment spam, Blogger is fairly good about moving it to the spam file on its own.

That raises a point I should make for actual readers (and you both know who you are): if you write a comment and shortly thereafter it seems to have disappeared, don't worry.  Blogger has moved it to the spam file for some reason, but I still get an email ping that the comment was posted.  I always check comments to be sure they ended up in the right place, and if your comment was mistakenly classified as spam (this has happened at least once and at most twice in the history of the blog), I will restore it to its rightful place in the sunshine.

In the past couple of days, I've gotten the same comment spam message twice.  Curiously, Blogger correctly identified it as spam the first time but not the second time.  It's a link to "Team PotentiaMED" web site.  The information blurb on their site is long on meaningless buzz phrases and a bit short on specifics, but I think they are some sort of consulting operation.  I'll let you judge their merits for yourself, if you're curious.  Personally, I automatically assume that any business relying on spam to get customers probably lacks solid reasons to patronize them (the sort of reasons that would make for an effective conventional marketing campaign).  I also don't trust anyone who spams.

By way of contrast, the proprietors of Online Engineering Degree contacted me by email to ask permission to post a comment pointing to one of their pages, a list of Q&A sites.  Instead, I devoted a short post to providing the link, since (a) I thought it might be relevant to readers with an interest in industrial engineering and (b) it was not really relevant as a comment to any particular existing post.  A writer from Masters in Engineering wrote to me asking if I would like to mention a page listing forums and boards for engineers. The sites listed were potentially useful to engineers in general but did not seem very useful to IEs, so I declined.  I want to give both of them credit for doing things the right way.

Now if I can just find a way to report comment spammers to Blogger ...