Stylesheet style.css not found, please contact the developer of "arctic" template.

This is an old revision of the document!


An Epic Day

There are days that u'll never forget. This is one of them to me.

There is a mountain, not far from Ancona: Monte San Vicino. It is not hard to get on its peak, but while the fist part of the path is within the forest, the upper part is just a big open field where there is no path.

The first time I met Monte San Vicino I was with Virginia. However she was already ill, and obviously I didn't force her, even if she was very determined.

The second time we went with some friends. However the friends were lazy, and instead of walking trough the top we ended up going horsing and eating in a neighbouring restaurant.

Some months ago I tried for the third time. However, almost on the top, I entered inside the level of the clouds and was very foggy. It was also late in the day, so it was really too dangerous of getting lost. Nothing also that time.

Today I tried for the fourth time. However also today there was a problem: unexpectedly there was snow (and ice!) on the top. It is several weeks that it's not snowing, but the cold temperatures of the area transformed the snow in very slippery sheets of ice. However with great difficult I managed to climb to the top, with the help of the branches of the last trees: I was feeling little bit like Tarzan ;-)

However coming down was an issue: there was no way I could go back form the way I went up. As the path is in the north mountainside, I kept the left in order to stay more toward the east mountainside that was more clear of snow/ice. However at a certain point I had to cross a field of ice slice. And I fell. I started going down at a crazy speed. I was really thinking to die, as I didn't know how I could stop and what there was at the bottom, a tree or a cliff. I saw the bottles of water and coke I had bounded to my backpack jumping over the ice and going down at a very high speed.

However I was lucky. I think what saved me from splashing over the trees below was the effect of the trees themselves that repairing the snow from the cold air preserved the snow of the last few meters of my rush of becoming full ice. Snow has somehow a little bit of friction, and this helped me to slow down to a speed that when I reached the trees I didn't break anything.

I was very scared. Also because now I was way out the path, and basically lost. However I started going east along the last trees that was bordering between the below forest and the above grass field, walking on something that was in the middle between snow and ice.

Finally after a while I reached the original path. I was very, very happy. I also kissed the dog (I never did it before haha). In a short I was down to the car, very happy to have done it. However I got the surprise: the outer pocket of my backpack was open: I put a hand: the keys were gonna! I had my car key, scooter key, Ancona's house key, Padova's house key.. all in one big bunch of keys. They must have went away when I felt.

I had no option that leave the car there. A gently couple helped me taking me (and the dog) to Jesi, a city in the valley where, after waiting one hour on the cold (I was very wet) I border a coach that let me in Ancona. From there the next bus to Montesicuro was after 3 hours, so I did the other thing that I never did it before today: I walked all the way from Ancona city center to Montesicuro, 11 km (6.8 miles), where the neighbours left a key they have under the mat.

At the end of the day I'm happy. I still don't know how I'll get back my car, if there is a bus station that go at least somewhere close to where it is or I need to wait next weekend to go “countryside” with my friends and pick it back.

However I did two things that for me were quite important, and showed to me that I still “can do it” :-)

Any how, I am sure I'll have a deep sleep tonight!

2025/07/01 13:48 · 0 Comments

A JuMP tutorial for GAMS users

JuMP (Julia for Mathematical Optimization) is an Algebraic Modelling Language (AML) that allows to write optimisation problems using a concise mathematical formulation, acting as interface to the specific solver engine API. For non-linear optimisation problems it allows to keep a high-level approach that doesn't require the modeller to compute the Jacobian or the Hessian.
It is developed by the MIT Operations Research Center and appeared in 2013 as an open source package of the relatively new Julia programming language.

GAMS (The General Algebraic Modeling System) does more or less the same things and appeared in the '70s as a project of the World Bank. GAMS is hence a very mature project (maybe too mature) with a lot of followers in the economic domain, where it is used mainly to solve equilibria problems.

This mini-tutorial is intended for gams users that want to try JuMP. There may be two reasons for someone to with to use JuMP instead of GAMS.
The most obvious one, even if often it isn't the key driver, is that GAMS is a commercial software while JuMP being open-source is free both as freedom and as a free beer.
While for GAMS a licence for the underlying solver engine is often included with a particular version of GAMS, JuMP would still require the user to buy a licence to use a specific commercial solvers. However JuMP interfaces with both GLPK (for linear and mixed-integer programming) and IPOPT (for non-linear optimisation) open-source solvers, both of which are top on their classes, leaving the necessity to acquire a licence for a commercial solver to niche cases.
The second reason (and, to me, the most important one) resides in the language features and in the availability of development environments. GAMS uses a VERY ODD syntax, somehow derived from the Cobol language, that is very distant from any programming language in use nowadays. For example a macro mechanism to provide an elementary way to structure the code in reusable components has been introduced only in GAMS 22.9. Its own editor is also very terrible, but as most text editors do not provide a GAMS syntax highlighting, it's still the most common way to code in GAMS.

JuMP, at the opposite, is both open source and it allow to write the model in a powerful general-purpose language like Julia
You have plenty of development environment to choose from (e.g. Jupiter, Juno), a clear modern language, the possibility to interface your model with third party libraries.. all of this basically for free.
It is also, at least for my user case, much faster than GAMS. Aside the preparation of the model to pass to the solver, where it is roughly equivalent, in the solver execution I can benefit of having on my system a version of IPOPT compiled with the much more performing ma27 linear solver, while for GAMS I would have to rely on the embedded version that is compiled with the MUMPS linear solver. That's part of the flexibility you gain in using JuMP in place of GAMS. That's said, for people that don't need such flexibility, the package automatically install a local pre-compiled version of the solver, so just adding the package relative to the solver is enough to start writing the model.

So let's start. We will see how to code the trasnport.gms problem, the one that ship as default example in GAMS1), using JuMP. For a fictions product, there are three canning plants and three markets and the objective of the model is to find the optimal allocation of products between plants and markets that minimises the (transport) costs.
GAMS equivalent code is inserted as single-dash comments. The original GAMS code needs slightly different ordering of the commands and it's available at http://www.gams.com/mccarl/trnsport.gms

→ Read more...

2025/05/02 12:12 · 5 Comments

Best off-line GPS navigator for Android 2015

It's December 2014 and I need to go back for Christmas to Italy from France, so I need an “off-line” navigator for my Android smartphone, that is one where, contrary to the default Google maps, I can pre-save the map on the sd card and use it without internet.

And possibly, I want it free.

So I tested 7 of the most popular gps android applications that offer off-line turn-by-turn navigation.

I can with confidence affirm that today the “winners” are 2:

→ Read more...

2025/05/02 12:12 · 0 Comments

A Pyomo tutorial for GAMS users

Updates:

  • 2015.01.12: Updated to run under Pyomo 4. See previous revisions if you still use Pyomo 3.

Pyomo (Python Optimisation Modeling Object) is an Algebraic Modelling Language (AML) that allows to write optimisation problems using a concise mathematical formulation, acting as interface to the specific solver engine API. For non-linear optimisation problems it allows to keep a high-level approach that doesn't require the modeller to compute the Jacobian or the Hessian.
It is developed by the Sandia National Laboratories and appeared in 2008 as an open source project.

GAMS (The General Algebraic Modeling System) does more or less the same things and appeared in the '70s as a project of the World Bank. GAMS is hence a very mature project (maybe too mature) with a lot of followers in the economic domain, where it is used mainly to solve equilibria problems.

This mini-tutorial is intended for gams users that want to try Pyomo. There may be two reasons for someone to with to use Pyomo instead of GAMS.
The most obvious one, even if often it isn't the key driver, is that GAMS is a commercial software while Pyomo being open-source is free both as freedom and as a free beer.
While for GAMS a licence for the underlying solver engine is often included with a particular version of GAMS, Pyomo would still require the user to buy a licence to use a specific commercial solvers. However Pyomo interfaces with both GLPK (for linear and mixed-integer programming) and IPOPT (for non-linear optimisation) open-source solvers, both of which are top on their classes, leaving the necessity to acquire a licence for a commercial solver to niche cases.
The second reason (and, to me, the most important one) resides in the language features and in the availability of development environments. GAMS uses a VERY ODD syntax, somehow derived from the Cobol language, that is very distant from any programming language in use nowadays. For example a macro mechanism to provide an elementary way to structure the code in reusable components has been introduced only in GAMS 22.9. Its own editor is also very terrible, but as most text editors do not provide a gams syntax highlighting, it's still the most common way to code in GAMS.

Pyomo, at the opposite, is both open source and.. it's python!
You have plenty of development environment to choose from, a clear modern language, the possibility to interface your model with third party libraries.. all of this basically for free.
While there are some reports of pyomo being somehow slower that GAMS it really depends. In my case it is actually much faster, as the IPOPT version that is embedded in GAMS uses the MUMPS linear solver, while on my system I have IPOPT compiled with the much more performing ma27 linear solver. That's part of the flexibility you gain in using pyomo in place of GAMS.

So let's start. We will see how to code the trasnport.gms problem, the one that ship as default example in GAMS2), using Pyomo. For a fictions product, there are three canning plants and three markets and the objective of the model is to find the optimal allocation of products between plants and markets that minimises the (transport) costs.
GAMS equivalent code is inserted as single-dash comments. The original GAMS code needs slightly different ordering of the commands and it's available at http://www.gams.com/mccarl/trnsport.gms

→ Read more...

2025/05/02 12:12 · 15 Comments

Older entries >>

1) , 2)
yes, the default GAMS example is named “trasnport”
personal/blog/home.1218556039.txt.gz · Last modified: (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0