Gurobi Python Interface

Gurobi released the latest 7.0 version optimizer in Oct. 2016, and Python modeling enhancements is one of the new features. Advertisements

Edit and run Python using Notepad++

Toolbar: Run>Run Type in the follows and then click Save*: cmd /k python3 “$(FULL_CURRENT_PATH)” & PAUSE & EXIT   Now, you can name this shortcut and define it for easily executing your python code!   *Please note that I’ve added python3 into your system environmental variables, or you have to use the full installed path

Tower of Hanoi

This problem might be the most famous example for teaching Recursion, and here is a simple example in Python.

Random number in Python

A brief note about random number in Python For this purpose, we need import random module. random.random()用於生成一個0到1的隨機符點數: 0 <= n < 1.0 0.14812154696888702 random.random(a,b)用來產生介於a與b之間的整數 14 random.uniform(a,b)用來產生介於a與b之間的浮點數 14.255325776146638 上述函數其實也就是Uniform distribution, 而Python當中還提供了相當多的統計分配: uniform triangular normal (Gaussian) lognormal negative exponential gamma beta pareto Weibull 例如常見的常態分配, gauss() 6.040336918401728