lemon/glpk.cc
changeset 898 e74b5db4f2c6
parent 746 e4554cd6b2bf
child 989 38e1d4383262
equal deleted inserted replaced
10:49d8ccefc1da 11:55b409a51a85
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2010
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
    57     int i = glp_add_rows(lp, 1);
    57     int i = glp_add_rows(lp, 1);
    58     glp_set_row_bnds(lp, i, GLP_FR, 0.0, 0.0);
    58     glp_set_row_bnds(lp, i, GLP_FR, 0.0, 0.0);
    59     return i;
    59     return i;
    60   }
    60   }
    61 
    61 
    62   int GlpkBase::_addRow(Value lo, ExprIterator b, 
    62   int GlpkBase::_addRow(Value lo, ExprIterator b,
    63                         ExprIterator e, Value up) {
    63                         ExprIterator e, Value up) {
    64     int i = glp_add_rows(lp, 1);
    64     int i = glp_add_rows(lp, 1);
    65 
    65 
    66     if (lo == -INF) {
    66     if (lo == -INF) {
    67       if (up == INF) {
    67       if (up == INF) {
    68         glp_set_row_bnds(lp, i, GLP_FR, lo, up);
    68         glp_set_row_bnds(lp, i, GLP_FR, lo, up);
    69       } else {
    69       } else {
    70         glp_set_row_bnds(lp, i, GLP_UP, lo, up);
    70         glp_set_row_bnds(lp, i, GLP_UP, lo, up);
    71       }    
    71       }
    72     } else {
    72     } else {
    73       if (up == INF) {
    73       if (up == INF) {
    74         glp_set_row_bnds(lp, i, GLP_LO, lo, up);
    74         glp_set_row_bnds(lp, i, GLP_LO, lo, up);
    75       } else if (lo != up) {        
    75       } else if (lo != up) {
    76         glp_set_row_bnds(lp, i, GLP_DB, lo, up);
    76         glp_set_row_bnds(lp, i, GLP_DB, lo, up);
    77       } else {
    77       } else {
    78         glp_set_row_bnds(lp, i, GLP_FX, lo, up);
    78         glp_set_row_bnds(lp, i, GLP_FX, lo, up);
    79       }
    79       }
    80     }
    80     }