File Reference

Go to the source code of this file.


def markowitz.get_model_text ()

Variables = GamsWorkspace(system_directory = sys.argv[1])
 markowitz.job = ws.add_job_from_string(get_model_text())
 markowitz.opt = ws.add_options()
 markowitz.cp = ws.add_checkpoint()
 markowitz.mi = cp.add_modelinstance()
 markowitz.l = mi.sync_db.add_parameter("lambda", 0, "")
list markowitz.data_points = []
 markowitz.min_ret = mi.sync_db["ret"].first_record().level
 markowitz.max_ret = mi.sync_db["ret"].first_record().level
float = 0.02
list markowitz.intervals = [((0.0, min_ret), (1.0, max_ret))]
list markowitz.i = intervals.pop()
tuple markowitz.l_val = (min_l+max_l)/2
 markowitz.cur_ret = mi.sync_db["ret"].first_record().level
 markowitz.ret = map(lambda x: x[0], data_points)
 markowitz.var = map(lambda x: x[1], data_points)

Detailed Description

This is a small graphical program that plots the efficient frontier of Markowitz' portfolio selection problem with the two objectives return and risk. The example utilizes the GamsModelInstance class to solve the parameterized objective max lambda*return - (1-lambda)*risk in the most efficient way. The example requires the matplotlib module.

Definition in file