gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Fix lp indexing bug (#205)
0 1 0
default
1 file changed with 2 insertions and 2 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -1046,50 +1046,50 @@
1046 1046
      }
1047 1047
      return s;
1048 1048
    }
1049 1049
    template<class T>
1050 1050
    typename enable_if<typename T::MapIt::Value::LpCol,
1051 1051
                       int>::type
1052 1052
    addColSet(T &t,dummy<2> = 2) {
1053 1053
      int s=0;
1054 1054
      for(typename T::MapIt i(t); i!=INVALID; ++i)
1055 1055
        {
1056 1056
          i.set(addCol());
1057 1057
          s++;
1058 1058
        }
1059 1059
      return s;
1060 1060
    }
1061 1061
#endif
1062 1062

	
1063 1063
    ///Set a column (i.e a dual constraint) of the LP
1064 1064

	
1065 1065
    ///\param c is the column to be modified
1066 1066
    ///\param e is a dual linear expression (see \ref DualExpr)
1067 1067
    ///a better one.
1068 1068
    void col(Col c, const DualExpr &e) {
1069 1069
      e.simplify();
1070
      _setColCoeffs(cols(id(c)), ExprIterator(e.comps.begin(), cols),
1071
                    ExprIterator(e.comps.end(), cols));
1070
      _setColCoeffs(cols(id(c)), ExprIterator(e.comps.begin(), rows),
1071
                    ExprIterator(e.comps.end(), rows));
1072 1072
    }
1073 1073

	
1074 1074
    ///Get a column (i.e a dual constraint) of the LP
1075 1075

	
1076 1076
    ///\param c is the column to get
1077 1077
    ///\return the dual expression associated to the column
1078 1078
    DualExpr col(Col c) const {
1079 1079
      DualExpr e;
1080 1080
      _getColCoeffs(cols(id(c)), InsertIterator(e.comps, rows));
1081 1081
      return e;
1082 1082
    }
1083 1083

	
1084 1084
    ///Add a new column to the LP
1085 1085

	
1086 1086
    ///\param e is a dual linear expression (see \ref DualExpr)
1087 1087
    ///\param o is the corresponding component of the objective
1088 1088
    ///function. It is 0 by default.
1089 1089
    ///\return The created column.
1090 1090
    Col addCol(const DualExpr &e, Value o = 0) {
1091 1091
      Col c=addCol();
1092 1092
      col(c,e);
1093 1093
      objCoeff(c,o);
1094 1094
      return c;
1095 1095
    }
0 comments (0 inline)