def optimize_model(args):
    print 'Found model: {}'.format(args.modelfile)
    actions = get_actions(args)
    feat_cls = get_feat_cls(args)
    mm_model = get_model_cls(args).read(args.modelfile, actions, feat_cls.get_size(len(actions)))
    try:
        mm_model.scale_objective(args.C, args.D)
    except __HOLE__:
        mm_model.scale_objective(args.C)

    # Use dual simplex method
    mm_model.model.setParam('method', 1)
    #mm_model.model.setParam('method', 0)  # Use primal simplex method to solve model
    # mm_model.model.setParam('threads', 1)  # Use single thread instead of maximum
    # # barrier method (#2) is default for QP, but uses more memory and could lead to error
    mm_model.optimize_model()

#    mm_model.model.setParam('method', 2)  # try solving model with barrier
    assert mm_model.model.status == 2
    mm_model.save_weights_to_file(args.weightfile)
dataset/ETHPy150Open rll/lfd/lfd/mmqe/build.py/optimize_model