Exemple #1
0
def ImportCplex(file_path, terminal="OFF"):
    """Returns a lp struct which can be us by"""
    if terminal == "OFF":
        glpki.glp_term_out(glpki.GLP_OFF)
    elif terminal == "ON":
        glpki.glp_term_out(glpki.GLP_ON)
    else:
        raise Exception, 'wrong option specified.'
    if os.path.exists(file_path):
        prob = glpki._glp_lpx_create_prob()
        glpki.glp_read_lp(prob, None, file_path)
        glpki.glp_term_out(glpki.GLP_ON)
        return prob
    else:
        raise IOError, 'no such file: ' + file_path
Exemple #2
0
def ImportMPS(file_path):
    """Returns a lp struct which can be us by"""
    glpki.glp_term_out(glpki.GLP_OFF)
    return glpki.glp_read_freemps(file_path)