Rabu, 14 September 2011
Too Many Cooks in the Kitchen
One of the wonderful things about an academic institution like Stanford or UCSF is that you have specialists of all kinds. It's pretty common to get a smattering of consultations for patients with complex problems, whether medical, surgical, psychiatric, or something else. We have cutting edge tests, tools, and therapies. However, having "too many cooks in the kitchen," so to speak, can be frustrating at times. I remember as an intern last year, my consultants would occasionally contradict each other or keep the patient in the hospital for tests that were really outpatient issues. The primary team is always aware of how long a patient has been in the hospital. Consultants, on the other hand, often take advantage of the convenience of a patient being admitted and keep them there longer than necessary. Even right now, on the pain consultation service, we are seeing several patients whose main or only issue is pain management. One patient is having multiple procedures to try to control his pain, but the scheduling of these procedures and technical problems with them have kept him in the hospital longer than necessary. It's good to have access to lots of consultants, but it also creates confusion of who is in charge and drives up the costs of medicine.
Selasa, 13 September 2011
Reflexiones sobre el "Chess Query Language"
¿Qué es lo que hace de una posición de ajedrez un patrón en particular? ¿qué elementos son los que hacen que se pueda describir un patrón como ganador -digamos- en una posición particular? Por ejemplo, consideremos la siguiente:
Juegan las blancas
(Patrón 1)
Quien sepa algunas cosas sobre el ajedrez sabrá que las blancas pueden dar mate en cuatro jugadas con 1.Axh7+ Rh8 2.Ag6+! (evitando que la dama negra capture a la blanca), 2. ... Rg8 3. Dh7+ Rf8 4.Df7#. De hecho, no importa dónde esté el alfil blanco siempre y cuando se mantenga en la diagonal b1-h7:
Juegan las blancas
(Patrón 2)
En este ejemplo podríamos caracterizar la posición como un alfil que corre sin interrupción desde b1 hasta h7, con la dama blanca en h6 y el rey negro en g8. Pero... ¿es esto suficiente? Aparentemente sí. Pero consideremos ahora la siguiente posición:
Juegan las blancas
(Patrón 3)
Este patrón parece ser el mismo que en la posición anterior, pero he aquí que cambia totalmente todo el asunto, porque ahora la torre negra de a7 defiende el punto del mate en f7. Aquí, por ejemplo, las blancas no tienen más que tablas: 1.Axh7+ Rh8 2.Ag6+ Rg8 3.Ah7+ y tablas por repetición. Las blancas no tienen mejor opción que esto.
La pregunta aquí es ¿cómo definir los elementos del patrón que hacen que el patrón 1 sea ganador, Mientras que en el patrón 3 el hecho de tener la torre negra en a7 hace imposible que el patrón de mate se dé? Yo quisiera hallar un lenguaje que describiera los patrones, algo así como una geometría analítica para el tablero de ajedrez. Déjenme ponerles un ejemplo:
Considérese la ecuación de la parábola:
Gráfica 1
y=x^2. Sin vemos la expresión, podemos hacer el dibujo que genera la imagen de la parábola, porque la expresión algebraica representa ni más ni menos a la gráfica 1. En este sentido, la expresión algebraica define y caracteriza la parábola mencionada. ¿Podría haber una especie de "lenguaje algebraico" para caracterizar sin errores cualquier posición de ajedrez? Llevo ya un par de años atorado en esta problemática. No veo cómo hacer un lenguaje que caracterice las posiciones del tablero.
Más de uno se preguntará como para qué quiero algo así. Es fácil: imaginen que tengo la siguiente posición, la cual se dio en la siguiente partida:
Paulsen - Schwarz
Lepzig 1879 (match)
3er juego
1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Nc6 5. Nf3 Qb6 6. a3 Bd7 7. b4 cxd4 8. cxd4 Nge7 9. Nc3 Nf5 10. Na4 Qc7 11. Bb2 Be7 12. Rc1 a6 13. Nc5 Bxc5 14. Rxc5 O-O 15. Bd3 Nfe7?
Paulsen-Schwarz
Leipzig 1897 (match)
3er partida
Juegan las blancas
(Patrón 4)
16. Bxh7+! el clásico "regalo griego". El esquema está dado: el rey negro enrocado. El caballo negro que normalmente está en f6, defendiendo h7 ya no está. El alfil blanco apunta a h7, el caballo en f3 brincará a g5 y la dama blanca entonces se incorporará al ataque.
Si tuviese una manera de describir esta posición vía este "mágico lenguaje" entonces podría hacer búsquedas sobre todas las posiciones en donde este esquema se diese en una base de datos, por ejemplo la megabase 2010. Así, por ejemplo, hallar todas las posiciones con el patrón 4 me permitiría hacer incluso un catálogo o libro con este esquema, y así practicarlo hasta que fuese parte de mi acervo ajedrecístico. Vaya, que escribir libros de ejercicios de combinación sería algo ridículamente simple, pues como autor no tendría que hurgar literalmente en las posiciones, sino que podría pedirle al sistema que hallara el patrón buscado y listo, colección de posiciones para estudiar.
Por ello mismo, el Chess Query Language - CQL, del cual ya hablé aquí antes, es quizás la herramienta que podría solventar las dificultades. Curiosamente el CQL me permite buscar todas las posiciones en un archivo PGN, en donde se dio el regalo griego. Entonces me pregunto: ¿Necesito realmente un lenguaje que describa las posiciones en ajedrez para crear patrones? o bien ¿un lenguaje de consultas en una base de datos es la sustitución natural de este potencial lenguaje y es más que suficiente? Dicho de otra manera, ¿para qué quiero describir posiciones si el CQL me permite crear una búsqueda de un patrón determinado? ¿Será esto equivalente a lo que busco?
Me llama la atención que el problema de generar un lenguaje descriptor de posiciones sea lo mismo (o al menos equivalente, para hablar con propiedad), que el tener un lenguaje de consultas sobre una base de datos, que finalmente tiene un origen en búsquedas de cadenas. ¿Qué opina lector/a, sobre esto en particular?
Más mentiras oficiales
México, como ya la mayoría de los países, está enmarcado dentro de un ámbito global. Ahora se hacen negocios con muchos más países que antes. Ahora lo que pasa en algunos mercados puede afectar la economía local. Obviamente los enlaces y las interrelaciones comerciales entre los países son ahora muy diferentes que antaño y me es claro que muchísimos fenómenos pueden alterar el rumbo económico de la nación.
Por ejemplo, cuando mataron al candidato del PRI, Colosio, el gobierno de inmediato tomó acciones, por ejemplo: cerró los bancos por tres días, si mal no recuerdo. La razón de esto era, entre otras cosas, evitar que se fugaran capitales. El asesinato del candidato del tricolor a la presidencia nunca se había dado en la época moderna de la política nacional y era un elemento que podía considerarse como peligroso para la economía. Un hehco de esta magnitud, sin duda, podría modificar el mundo económico y financiero de ese momento. Los inversionistas, por ejemplo, podrían haber visto al país como no el más adecuado para invertir, y menos en una situación por demás extrema no vista antes.
Puedo entender eso. Y puedo entender que con el ataque terrorista del 11 de septiembre, algo parecido habrá pasado en los Estados Unidos y por ende a México. Se dice que cuando a los Estados Unidos le da un catarrito, a nosotros nos da pulmonía. Eso simplemente habla, repito, de las interrelaciones comerciales entre los países, las cuales hacen que haya más nexos y en consecuencia, ciertos movimientos en un país pueden afectar económicamente a otros países.
Y todo esto viene a cuento porque leo en los diarios que el dólar ahora se ha puesto muy caro. Se acerca a los 13 pesos por unidad del billete verde. Habrá muchas razones por las cuales el peso se deprecia, pero los argumentos que se leen en los periódicos son mentiras por demás infames. Dicen algunos que estas depreciaciones del peso se observan por los problemas financieros que están pasando en ¡Grecia! Sí, los inversionistas no ven con buenos ojos lo que pasa en la economía de ese país y por ende, México enfrenta la depreciación del peso. Ajá. Me pregunto qué tantos negocios tenemos como país con Grecia como para que el peso se deprecie ante un problema que ya lleva rato en Europa, que es el desastre económico y financiero de Grecia, ni más ni menos que la cuna de la civilización occidental.
En serio ¿a qué salen estos personajes de las finanzas a dar explicaciones que son por decir poco, burdas mentiras? Pudiese entender que el peso se devalúe si hay ciertos eventos en los Estados Unidos, pero... ¿en Grecia? ¿A quién quieren engañar?
La realidad es que así son los mercados. Hay eventos que hacen que el peso se revalúe o de deprecie. En general es un mecanismo que el propio gobierno tiene para controlar algunos aspectos de la economía. Yo puedo entender todo esto. Lo que simplemente no entiendo es esa manía de mentir abiertamente, bajo la premisa ya tradicional de que la gente es por definición tonta y se traga todo lo que le dicen.
Senin, 12 September 2011
Solución al problema de filtración de agua del chevy
El "Bachoco", mi chevy blanco como un huevo, es un guerrero de los caminos. Fielmente ha aguantado todo género de embates, desde los que yo le he dado, hasta los que la Naturaleza le ha aplicado. El último, que tiene un año más o menos, es el de filtración de agua al piso del copiloto cuando llueve. Aquí hablé un poco del problema. ¿Por dónde se mete el agua? era difícil saberlo. Recuerdo alguna vez la lectura que hice sobre una isla en donde supuestamente hay un tesoro escondido. Quienes lo buscaban iban escavando en la tierra y cuando aparentemente se acercaban al objetivo, de pronto se les inundaba el agujero que habían hecho. ¿De dónde provenía esa agua? Para saberlo, echaron agua de color y vieron por qué parte de la isla salía. La historia de este tesoro y la isal en donde está es por demás fascinante.
Desafortunadamente no iba a echar agua con tinta para saber de dónde venía el agua que inundaba el piso del copiloto, porque esto hubiese pintado de otro color la alfombra del chevy. Le eché luz, pero no detecté agujeros. La cuestión es que con las lluvias eventualmente se llenaba de agua, y no sólo se humedecía, sino que si la lluvia era lo suficientemente fuerte, se creaba un charco de dos a tres dedos de altura. Una pesadilla en todos los sentidos.
Porque miren, es tan malo no tener agua como tener en exceso. El asunto aquí es peor no por el agua en sí, sino porque la humedad tiende a la larga a oler mal y además, arruina los materiales. Por ende, había que buscarle una solución.
Entonces Juan, mi hermano, me dijo que había comentado en su trabajo sobre este particular asunto y que alguien le había dicho que al lado de la batería hay un agujero para precisamente drenar el agua. Y sí, había un agujero pero no estaba tapado. Sin embargo, hallamos que la parte debajo de donde va la batería del Chevy estaba semicarcomida. Leyendo y buscando en la inefable red Internet, eventualmente hallamos una posible solución.
Aparentemente cuando llueve, entra por las rendijas del chevy (que están abajo de los parabrisas) y se va el agua por los tubos de drenaje contemplados por el diseño del auto. Sin embargo, si el material que está debajo de la batería está oxidado o picado por los mismos ácidos de la propia batería, entonces el agua no llega toda al tubo de drenaje y se cuela hacia la alformbra del copiloto. Consecuentemente, lo que había que hacer era arreglar esa dificultad viendo cómo estaba esa parte del chasis del auto bajo la batería.
Hallé en esta página, la solución a la dificultad. Ayer Juan y yo fuimos a comprar los materiales. No hallamos los que estrictamente sugiere el autor de la solución, pero compramos una "hoja" de corcho y "duct tape", esa cinta color gris plateado, que se usa precisamente para sellar a veces los ductos, por lo cual, es bastante resistente al agua.
A mí se me olvidó tomar las fotografías de todo este procedimiento, pero rescato las del sitio web mencionado, porque más o menos funciona igual. He aquí las instrucciones:
En esta primer imagen ya se quitó la batería del chevy. Nótese los huecos dejados por el óxido que se ha comido el material. Por ahí se está metiendo el agua que se filtra a la alfombra del copiloto. Para sacar la batería hay que sacar también la rejilla que está pegada a la parte inferior del parabrisas.
El autor de la solución consiguió un pedazo de hule que bien podría ser los que usan en el piso de los autobuses. Yo no hallé algo así, pero un pedazo de corcho de 30x18 cms hizo la tarea.
Se limpió todo resto de agua. De hecho, al hacer este proceso ya el lado del copiloto estaba totalmente seco.
Se aspiró el espacio donde va la batería. Se quitaron restos de óxido, de hojas secas, etc. La cuestión es que quedara totalmente limpio.
Se colocó la base de hule (en este caso el corcho), previamente forrado con la "duct tape", de manera que quedara el corcho totalmente cubierto por ambos lados y se pegó con más cinta, sellando todos los agujeros visibles previamente (con la misma cinta).
Una vez asegurados de que no habás agujeros que tapar y dejando sin tapar, desde luego, el ducto que permite que el agua salga por la lateral de la salpicadera, procedimos a poner la batería, las rejillas mencionadas, conectar todo y listo. Asunto terminado.
Esa tarde amenazaba con gran lluvia, lo cual no ocurrió, pero sí llovió un rato y no tomé ninguna precaución como antes estaba haciendo (que era tapar con una lona el auto). No se metió el agua, por lo que pienso, el asunto quedó solucionado. Vaya pues mi agradecimiento a Juan, que me echó la mano en toda esta cirugía menor con la que el Bachoco de nuevo está listo para una aventura más.
Minggu, 11 September 2011
September 11, 2011
All stories start with some sacred truth, and this story started ten years ago. It is like seeing lightning again. Storms come in and scatter leaves askance. Suddenly we look up and a flash of brightness casts into relief the heaviness of the skies. For some, it is shock, reverberation, awakening; for others it is unremitting malevolence; for others it is the illumination of grief; for others it is the reclamation of hope; and for others it is justification for the decade. Lightning flashes again. What do you see?
For the last ten years, much of what we do, what we value, what we spend our money on, what we worry about, what we think, how we dwell, what we tolerate, and what we love has been tinted by four planes on a fateful morning. You can trace out the shockwaves as they echoed around the world, as if the event held reins that carefully orchestrated a global marionette dance. No one could have predicted how much the world would change over the last ten years. It is as if the boulder of Sisyphus got away and has been rampaging down the hill, taking us all with it. We now take for granted these changes, that we're gridlocked in several global wars, that we no longer press our faces against the glass to wave airplanes goodbye, that we mop the floors of security checkpoints with our socks, that we have all incorporated some sense of prejudice that we would never admit.
The world has changed; that is certain. But we have also started a process of rebuilding. We have grown saplings in memory whose canopy now shields us. We have carved memorial into stone, imbuing our grief into art. We have begun to design towers again. We have perhaps surmounted the crux of this global war and started to look beyond vengeance and dismantling. We have resumed our jobs. We spend 364 days of the year more or less on our own.
But today, we are joined by memories: memories of those we love and those we never met but who we love all the same. We find by bond of tragedy some quiet equanimity with those around us, and perhaps this will be the last time. Every single year in the last decade, I sat down on September 10th and wrote. There is an evolution of emotion over those ten years; when I first picked up the pen, I was seventeen. I tried to persuade words, caress images to express what I felt. But how hard it is to describe the impact of a thing like nine-eleven. We write and write and write, and all that comes out is a phantom of what we mean, and it has taken ten years for me to accumulate some measure of composure about this topic.
In the first two years after 9/11, I wrote in anger, imploring people not to forget the gravity of what happened. "I cannot stand relegating that memory to some distant and aloof history," I wrote, "So many will pay tribute by rote - pinching out candles as soon as they are kindled...How much meaning is there in a day of fasting when every other day is a feast, a day of remembrance when every other day is oblivion?" It was hard to see at that time that we needed to move towards healing, toward achieving some semblance of normality. Indeed, in 2004 and 2005, I nearly forgot to write about September 11 as it had faded in its impact. As a midnight gravedigger, I began to unearth those reflections. I wondered why memory was important and wrote, a little petulantly, "Another disaster, another tragedy, a pinch of nutmeg, a sprig of parsley. Fields of vices spring up! What have we to battle them? A soliloquy? A treatise? Words, words, words." And yet I continued to write, stubborn to find "some semblance of meaning, some coherence of moral."
Five years after the event, I realized "a new generation emerges that will learn our shock and grief through history books." Isn't that something? That we would be so defined by an event that others would only acquire second-hand? How do we protect their innocence, and should we? In 2007, I asked whether we could move on; "Are we stricken with inertia, bound like Greek Gods to orbit a fiery luminescence of the past?" I challenged those who paused in silence on September 11 to justify why they did it, why it was important. "Tell me. Because if we've lost cause, then it is time to come back inside, put piety on the hat stand, hang the cloak of duty for another day's resolve because I hate to admit it, but you will tap that well again and it best not be siphoned for an empty gourd." The following year, half-way through medical school, I pondered the randomness that you and I were not on the destined planes, not having breakfast in those towers of memory; "by stochastigarchy," I wrote, "we were drawn elsewhere, away from the epicenter." Finally, two years ago, I wrote about where I was on that day "when plumes like hands sent skyward a misery unfettered, a poison mistaken for a draught."
Last year, I wrote this:
"She is nine today, and in the fourth grade. She likes ice cream and plays four square and never washes her hands before meals. Imagine how big she is; she looks upon the world with wide eyes. She breaks rules sometimes; maybe she stays up past her bedtime drawing under the covers. What does she draw? For reasons unknown to her but stark to us, she draws misery and memory, sketches of fire and loss. They are not sad drawings, only serious ones, ones that outstrip her age, a light that casts generations upon her face. This is the juxtaposition of innocence and reality; she is only beginning to know what she means, how like Helen, she turns fleets. And we turn to her. She is a marking, a pivot point, a child whose grace we cannot take for granted. Give me a lever, said Archimedes, and she will be the fulcrum. She will move planets; they will take flight and hurl out into space, satellites that echo into orbit a refrain she has taught. With crayons, she maps out connections, a gravity that tugs on your heart when you hear of strangers in distress. Oh, it's all propaganda, you say, and it is; what could be more persuasive than a nine year old who teaches us to relinquish selfishness, to volunteer, to donate, to pray, to wish. She is nine this year, but think of what she has endured, and imagine how fast she has had to grow. Listen; don't ignore her because she whispers. No whisper is left unheard. 09.11.10."
I only recount this saga because I find myself at its epilogue. It is time to close the book. Writing on this eclipse year after year has taught me much about myself, about rationing emotional bandwidth, about excavating meaning in something that appears devoid of such, about writing the hard and fast-running feelings. We write to discover, and the sacred truth I find here is simply this. I cannot say whether September 11, 2001 and the impact it has had on this world was an inevitability. We cannot choose where we are born, which religion our parents take, what political system we struggle with. Perhaps the world had no choice and we were sent careening down this uncertain and unavoidable path. The world has changed for the better and it has changed for the worse, and we are here ten years later.
But whether illusion or not, we do have the sense of free will, and despite all those things we cannot control, we feel that we can choose good or evil, right or wrong, to move forward or to stall. After ten years of this funeral wake, it is time for us to take hands and rebuild. There will be more tragedies, more sorrow, more evil. We must take from these ten years what we can and set aside those emotions and values - fear, anger, vengeance, hatred, intolerance - that have no place in a post-9/11 world. Stagnant dwelling does no good. Ignoring the past does no good. But recognizing things for what they are, honoring those who took part, and incorporating the right values and morals into our everyday lives, that is what I take away. We are in a world that is hardly perfect but eminently liveable, in a society whose values are tarnished but not irreparable, in a story that has slowly rebuilt crumbling edifices into beautiful memorial. No whisper is left unheard. I write to turn this whisper into a song. 09.11.11.
Image of firefighter at Ground Zero in the public domain, from Wikipedia.
For the last ten years, much of what we do, what we value, what we spend our money on, what we worry about, what we think, how we dwell, what we tolerate, and what we love has been tinted by four planes on a fateful morning. You can trace out the shockwaves as they echoed around the world, as if the event held reins that carefully orchestrated a global marionette dance. No one could have predicted how much the world would change over the last ten years. It is as if the boulder of Sisyphus got away and has been rampaging down the hill, taking us all with it. We now take for granted these changes, that we're gridlocked in several global wars, that we no longer press our faces against the glass to wave airplanes goodbye, that we mop the floors of security checkpoints with our socks, that we have all incorporated some sense of prejudice that we would never admit.
The world has changed; that is certain. But we have also started a process of rebuilding. We have grown saplings in memory whose canopy now shields us. We have carved memorial into stone, imbuing our grief into art. We have begun to design towers again. We have perhaps surmounted the crux of this global war and started to look beyond vengeance and dismantling. We have resumed our jobs. We spend 364 days of the year more or less on our own.
But today, we are joined by memories: memories of those we love and those we never met but who we love all the same. We find by bond of tragedy some quiet equanimity with those around us, and perhaps this will be the last time. Every single year in the last decade, I sat down on September 10th and wrote. There is an evolution of emotion over those ten years; when I first picked up the pen, I was seventeen. I tried to persuade words, caress images to express what I felt. But how hard it is to describe the impact of a thing like nine-eleven. We write and write and write, and all that comes out is a phantom of what we mean, and it has taken ten years for me to accumulate some measure of composure about this topic.
In the first two years after 9/11, I wrote in anger, imploring people not to forget the gravity of what happened. "I cannot stand relegating that memory to some distant and aloof history," I wrote, "So many will pay tribute by rote - pinching out candles as soon as they are kindled...How much meaning is there in a day of fasting when every other day is a feast, a day of remembrance when every other day is oblivion?" It was hard to see at that time that we needed to move towards healing, toward achieving some semblance of normality. Indeed, in 2004 and 2005, I nearly forgot to write about September 11 as it had faded in its impact. As a midnight gravedigger, I began to unearth those reflections. I wondered why memory was important and wrote, a little petulantly, "Another disaster, another tragedy, a pinch of nutmeg, a sprig of parsley. Fields of vices spring up! What have we to battle them? A soliloquy? A treatise? Words, words, words." And yet I continued to write, stubborn to find "some semblance of meaning, some coherence of moral."
Five years after the event, I realized "a new generation emerges that will learn our shock and grief through history books." Isn't that something? That we would be so defined by an event that others would only acquire second-hand? How do we protect their innocence, and should we? In 2007, I asked whether we could move on; "Are we stricken with inertia, bound like Greek Gods to orbit a fiery luminescence of the past?" I challenged those who paused in silence on September 11 to justify why they did it, why it was important. "Tell me. Because if we've lost cause, then it is time to come back inside, put piety on the hat stand, hang the cloak of duty for another day's resolve because I hate to admit it, but you will tap that well again and it best not be siphoned for an empty gourd." The following year, half-way through medical school, I pondered the randomness that you and I were not on the destined planes, not having breakfast in those towers of memory; "by stochastigarchy," I wrote, "we were drawn elsewhere, away from the epicenter." Finally, two years ago, I wrote about where I was on that day "when plumes like hands sent skyward a misery unfettered, a poison mistaken for a draught."
Last year, I wrote this:
"She is nine today, and in the fourth grade. She likes ice cream and plays four square and never washes her hands before meals. Imagine how big she is; she looks upon the world with wide eyes. She breaks rules sometimes; maybe she stays up past her bedtime drawing under the covers. What does she draw? For reasons unknown to her but stark to us, she draws misery and memory, sketches of fire and loss. They are not sad drawings, only serious ones, ones that outstrip her age, a light that casts generations upon her face. This is the juxtaposition of innocence and reality; she is only beginning to know what she means, how like Helen, she turns fleets. And we turn to her. She is a marking, a pivot point, a child whose grace we cannot take for granted. Give me a lever, said Archimedes, and she will be the fulcrum. She will move planets; they will take flight and hurl out into space, satellites that echo into orbit a refrain she has taught. With crayons, she maps out connections, a gravity that tugs on your heart when you hear of strangers in distress. Oh, it's all propaganda, you say, and it is; what could be more persuasive than a nine year old who teaches us to relinquish selfishness, to volunteer, to donate, to pray, to wish. She is nine this year, but think of what she has endured, and imagine how fast she has had to grow. Listen; don't ignore her because she whispers. No whisper is left unheard. 09.11.10."
I only recount this saga because I find myself at its epilogue. It is time to close the book. Writing on this eclipse year after year has taught me much about myself, about rationing emotional bandwidth, about excavating meaning in something that appears devoid of such, about writing the hard and fast-running feelings. We write to discover, and the sacred truth I find here is simply this. I cannot say whether September 11, 2001 and the impact it has had on this world was an inevitability. We cannot choose where we are born, which religion our parents take, what political system we struggle with. Perhaps the world had no choice and we were sent careening down this uncertain and unavoidable path. The world has changed for the better and it has changed for the worse, and we are here ten years later.
But whether illusion or not, we do have the sense of free will, and despite all those things we cannot control, we feel that we can choose good or evil, right or wrong, to move forward or to stall. After ten years of this funeral wake, it is time for us to take hands and rebuild. There will be more tragedies, more sorrow, more evil. We must take from these ten years what we can and set aside those emotions and values - fear, anger, vengeance, hatred, intolerance - that have no place in a post-9/11 world. Stagnant dwelling does no good. Ignoring the past does no good. But recognizing things for what they are, honoring those who took part, and incorporating the right values and morals into our everyday lives, that is what I take away. We are in a world that is hardly perfect but eminently liveable, in a society whose values are tarnished but not irreparable, in a story that has slowly rebuilt crumbling edifices into beautiful memorial. No whisper is left unheard. I write to turn this whisper into a song. 09.11.11.
Image of firefighter at Ground Zero in the public domain, from Wikipedia.
Sobre resolver con Prolog el problema de los sudokus
En mi último artículo sobre programación y sudokus, hablé de un programa que podría resolver, en esencia, cualquier sudoku que se le pusiese, utilizando para ello fuerza bruta, es decir, considerando todas las posibilidades de números a poner en cada casilla. Alguna combinación debe ser la adecuada y con ello el asunto estaría resuelto.
Cuando corrí mi programa, pensé que se tardaría algunas horas quizás, de hecho no lo sabía, pero sospechaba que así sería. Un par de horas después de haber empezado el proceso lo aborté porque me hartó. No se veía para cuando terminaría. Así que decidí primero ver cuántos cálculos tiene que hacer el programa para poder resolver el sudoku planteado, que en ese caso hablamos de 46 números por hallar. Si usamos Prolog, tenemos que calcular la cantidad de combinaciones con repetición de 9 números tomados de 46 en 46.
La fórmula para ello es:
donde n es la cantidad de números diferentes y r es la cantidad de espacios a llenar. Además, se pueden repetir los números, es decir, no todos tienen que ser siempre distintos. El resultado de esto es 1,040,465,790, es decir, mil cuatrocientos millones de posibles combinaciones. Para entender la magnitud de este número, si cada combinación se genera en un segundo (muy lento), entonces tardará unos 32 años en probar todas las posibles combinaciones. Si hace 1000 combinaciones por segundo (una aproximación más razonable), el sistema tardará unos 120 días en resolver todas las posibles combinaciones de números. Algo sin duda, demasiado lento. Vaya, si hiciese 10000 combinaciones por segundo, tardaría 12 días en resolverlo. Aún así es muy lento.
La razón de esto es que el programa, como originalmente está escrito, está obligado a prtimero poner a todos los números que buscamos, un "1". Se prueban entonces la combinación (como si fuese una caja fuerte). Si no "se abre", entonces probamos con otra combinación, haciendo backtrack. El resultado es un gigantesco proceso de ir cambiando números.
¿Cómo se podría mejorar? Desde luego que la técnica de prolog de examinar hasta agotar todas las posibilidades (simple fuerza bruta), no es práctica en este caso. Se necesita más inteligencia. Aún así, si no se quiere pensar mucho, bien podría intercalarse la búsqueda de unos pocos números, y entonces checar algunas de las ecuaciones, si eso está correcto, entonces buscar las restantes. Esto es lo que en principio sugirió el buen amigo Eduardo Ramos, aunque aún así los resultados pueden tardar si bien nos va, muchos días. De hecho, el programa se vería esta intercalación así:
predicates
sudoku
suma(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer)
num(integer)
clauses
num(1).
num(2).
num(3).
num(4).
num(5).
num(6).
num(7).
num(8).
num(9).
suma(A,B,C,D,E,F,G,H,I,R) :-
A+B+C+D+E+F+G+H+I = R.
sudoku :-
/ horizontales */
num(A1), num(B1), num(C1), num(D1),
suma(5,A1,4,3,B1,6,C1,7,D1,45),
num(A2), num(B2), num(C2), num(D2), num(E2),
num(F2), num(G2), num(H2),
suma(A2,B2,1,C2,D2,E2,F2,G2,H2,45),
num(A3), num(B3), num(C3), num(D3), num(E3),
suma(A3,7,6,B3,C3,2,9,D3,E3,45),
num(A4), num(B4), num(C4), num(D4),
suma(A4,8,B4,7,C4,5,6,D4,1,45),
num(A5), num(B5), num(C5), num(D5),
suma(7,6,A5,B5,3,C5,D5,8,9,45),
num(A6), num(B6), num(C6), num(D6),
suma(9,A6,3,8,B6,4,C6,2,D6,45),
num(A7), num(B7), num(C7), num(D7), num(E7),
suma(A7,B7,8,1,C7,D7,2,9,E7,45),
num(A8), num(B8), num(C8), num(D8), num(E8),
num(F8), num(G8), num(H8),
suma(A8,B8,C8,D8,E8,F8,3,G8,H8,45),
num(A9), num(B9), num(C9), num(D9),
suma(A9,3,B9,4,C9,7,1,D9,6,45),
/* verticales */
suma(5,A2,A3,A4,7,9,A7,A8,A9,45),
suma(A1,B2,7,8,6,A6,B7,B8,3,45),
suma(4,1,6,B4,A5,3,8,C8,B9,45),
suma(3,C2,B3,7,B5,8,1,D8,4,45),
suma(B1,D2,C3,C4,3,B6,C7,E8,C9,45),
suma(6,E2,2,5,C5,4,D7,F8,7,45),
suma(C1,F2,9,6,D5,C6,2,3,1,45),
suma(7,G2,D3,D4,8,2,9,G8,D9,45),
suma(D1,H2,E3,1,9,D6,E7,H8,6,45),
/* cajas */
suma(5,A1,4,A2,B2,1,A3,7,6,45),
suma(3,B1,6,C2,D2,E2,B3,C3,2,45),
suma(C1,7,D1,F2,G2,H2,9,D3,E3,45),
suma(A4,8,B4,7,6,A5,9,A6,3,45),
suma(7,C4,5,B5,3,C5,8,B6,4,45),
suma(6,D4,1,D5,8,9,C6,2,D6, 45),
suma(A7,B7,8,A8,B8,C8,A9,3,B9,45),
suma(1,C7,D7,D8,E8,F8,4,C9,7,45),
suma(2,9,E7,3,G8,H8,1,D9,6,45).
por cierto, este programa está en el antiguo turbo Prolog 2.0 de Borland.
La conclusión inicial es que si tuviésemos memoria infinita y poder de procesamiento infinito, las soluciones tipo prolog, resolviendo todo el árbol de búsquedas (árbol solución), podría llegar a la conclusión del resultado correcto. Pero en la vida real, al tener limitaciones en memoria y velocidad de proceso, esto desde luego vuelve impráctico este enfoque.
Cabe decir que no por ello prolog no es útil para resolver problemas. Simplemente el sudoku -utilizando el esquema de fuerza bruta- no es el más adecuado.
Cuando corrí mi programa, pensé que se tardaría algunas horas quizás, de hecho no lo sabía, pero sospechaba que así sería. Un par de horas después de haber empezado el proceso lo aborté porque me hartó. No se veía para cuando terminaría. Así que decidí primero ver cuántos cálculos tiene que hacer el programa para poder resolver el sudoku planteado, que en ese caso hablamos de 46 números por hallar. Si usamos Prolog, tenemos que calcular la cantidad de combinaciones con repetición de 9 números tomados de 46 en 46.
La fórmula para ello es:
(n+r-1)!
Combinaciones = ----------
r!(n-1)!
donde n es la cantidad de números diferentes y r es la cantidad de espacios a llenar. Además, se pueden repetir los números, es decir, no todos tienen que ser siempre distintos. El resultado de esto es 1,040,465,790, es decir, mil cuatrocientos millones de posibles combinaciones. Para entender la magnitud de este número, si cada combinación se genera en un segundo (muy lento), entonces tardará unos 32 años en probar todas las posibles combinaciones. Si hace 1000 combinaciones por segundo (una aproximación más razonable), el sistema tardará unos 120 días en resolver todas las posibles combinaciones de números. Algo sin duda, demasiado lento. Vaya, si hiciese 10000 combinaciones por segundo, tardaría 12 días en resolverlo. Aún así es muy lento.
La razón de esto es que el programa, como originalmente está escrito, está obligado a prtimero poner a todos los números que buscamos, un "1". Se prueban entonces la combinación (como si fuese una caja fuerte). Si no "se abre", entonces probamos con otra combinación, haciendo backtrack. El resultado es un gigantesco proceso de ir cambiando números.
¿Cómo se podría mejorar? Desde luego que la técnica de prolog de examinar hasta agotar todas las posibilidades (simple fuerza bruta), no es práctica en este caso. Se necesita más inteligencia. Aún así, si no se quiere pensar mucho, bien podría intercalarse la búsqueda de unos pocos números, y entonces checar algunas de las ecuaciones, si eso está correcto, entonces buscar las restantes. Esto es lo que en principio sugirió el buen amigo Eduardo Ramos, aunque aún así los resultados pueden tardar si bien nos va, muchos días. De hecho, el programa se vería esta intercalación así:
predicates
sudoku
suma(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer)
num(integer)
clauses
num(1).
num(2).
num(3).
num(4).
num(5).
num(6).
num(7).
num(8).
num(9).
suma(A,B,C,D,E,F,G,H,I,R) :-
A+B+C+D+E+F+G+H+I = R.
sudoku :-
/ horizontales */
num(A1), num(B1), num(C1), num(D1),
suma(5,A1,4,3,B1,6,C1,7,D1,45),
num(A2), num(B2), num(C2), num(D2), num(E2),
num(F2), num(G2), num(H2),
suma(A2,B2,1,C2,D2,E2,F2,G2,H2,45),
num(A3), num(B3), num(C3), num(D3), num(E3),
suma(A3,7,6,B3,C3,2,9,D3,E3,45),
num(A4), num(B4), num(C4), num(D4),
suma(A4,8,B4,7,C4,5,6,D4,1,45),
num(A5), num(B5), num(C5), num(D5),
suma(7,6,A5,B5,3,C5,D5,8,9,45),
num(A6), num(B6), num(C6), num(D6),
suma(9,A6,3,8,B6,4,C6,2,D6,45),
num(A7), num(B7), num(C7), num(D7), num(E7),
suma(A7,B7,8,1,C7,D7,2,9,E7,45),
num(A8), num(B8), num(C8), num(D8), num(E8),
num(F8), num(G8), num(H8),
suma(A8,B8,C8,D8,E8,F8,3,G8,H8,45),
num(A9), num(B9), num(C9), num(D9),
suma(A9,3,B9,4,C9,7,1,D9,6,45),
/* verticales */
suma(5,A2,A3,A4,7,9,A7,A8,A9,45),
suma(A1,B2,7,8,6,A6,B7,B8,3,45),
suma(4,1,6,B4,A5,3,8,C8,B9,45),
suma(3,C2,B3,7,B5,8,1,D8,4,45),
suma(B1,D2,C3,C4,3,B6,C7,E8,C9,45),
suma(6,E2,2,5,C5,4,D7,F8,7,45),
suma(C1,F2,9,6,D5,C6,2,3,1,45),
suma(7,G2,D3,D4,8,2,9,G8,D9,45),
suma(D1,H2,E3,1,9,D6,E7,H8,6,45),
/* cajas */
suma(5,A1,4,A2,B2,1,A3,7,6,45),
suma(3,B1,6,C2,D2,E2,B3,C3,2,45),
suma(C1,7,D1,F2,G2,H2,9,D3,E3,45),
suma(A4,8,B4,7,6,A5,9,A6,3,45),
suma(7,C4,5,B5,3,C5,8,B6,4,45),
suma(6,D4,1,D5,8,9,C6,2,D6, 45),
suma(A7,B7,8,A8,B8,C8,A9,3,B9,45),
suma(1,C7,D7,D8,E8,F8,4,C9,7,45),
suma(2,9,E7,3,G8,H8,1,D9,6,45).
por cierto, este programa está en el antiguo turbo Prolog 2.0 de Borland.
La conclusión inicial es que si tuviésemos memoria infinita y poder de procesamiento infinito, las soluciones tipo prolog, resolviendo todo el árbol de búsquedas (árbol solución), podría llegar a la conclusión del resultado correcto. Pero en la vida real, al tener limitaciones en memoria y velocidad de proceso, esto desde luego vuelve impráctico este enfoque.
Cabe decir que no por ello prolog no es útil para resolver problemas. Simplemente el sudoku -utilizando el esquema de fuerza bruta- no es el más adecuado.
Las mentiras del sistema
Ahora que se cumplen 10 años de los ataques terroristas en los Estados Unidos, en ese país se ha hablado de que hay una amenaza "creíble y específica" de otro posible atentado precisamente hoy, el día que se conmemoran estos trágicos acontecimientos. El viernes escuchaba a León Krauze, que está en Nueva York precisamente para este evento, que esta amenaza contemplaba una "bomba sucia", lo cual significa, para los que no sepan, de una bomba de carácter nuclear con alcance limitado. Una bomba de esta naturaleza no produciría demasiadas muertes (como en el caso de Hiroshima y Nagasaky, que mató a decenas de miles de civiles en pocos segundos), pero la radiación resultante podría ser un problema de mediano y largo plazo.
Pues bien, en mi opinión, esta nota está creada para sembrar el miedo. Imaginemos que existe verdaderamente esa amenaza y se cumple... ¿Cómo quedarían las autoridades norteamericanas? Como ineptos al no poder evitar un nuevo atentado terrorista el 11 de septiembre, a diez años de lo que todos vimos por televisión con asombro. El gobierno norteamericano siembra el miedo en sus ciudadanos (e incluso el mundo), con noticias como ésta, porque es una amenaza invisible, de la cual no se tiene ninguna certeza, en donde en cualquier momento -supuestamente- puede atacar. Y esa incertidumbre causa desazón, miedo, y por ende, el gobierno norteamericano tiene argumentos para hacer cosas que son, por lo menos, discutibles. Así, podrían crea una nueva "acta patriótica", la cual es un absurdo y que viola muchísimas garantías individuales, pero se aplica, porque ante la amenaza terrorista "hay que tomar acciones".
En suma, esta dizque amenaza "creíble" es -desde mi punto de vista- más falso que una moneda de tres pesos (porque hay de dos pesos, sino...). La política de aterrorizar no es algo que no se haga cotidianamente. Cuando vi los siguientes episodios (en youtube) de un documental llamado "el poder de las pesadillas", me quedó claro que los gobiernos son capaces de todo género de bajezas. Yo creo que esto se aplica en el caso presente. He aquí los siete videos de youtube. Lleva en total como una hora pero en serio, podrán tener un nuevo punto de vista que es sin duda, interesante de analizar.
Gracias a @Staregirl por llamar mi atención a este documental.
Por cierto, el siguiente video muestra que los Simpsons ya habían predecido años antes el ataque a las torres gemelas:
Langganan:
Postingan (Atom)
















