lemon/lp_base.h
changeset 1585 0e3ef435bdc3
parent 1536 308150155bb5
child 1610 893dacc1866c
equal deleted inserted replaced
11:e6b9bc350368 12:cd359b4d054f
   136       ///\todo Give a feasible solution and an infinite ray (and the
   136       ///\todo Give a feasible solution and an infinite ray (and the
   137       ///corresponding bases)
   137       ///corresponding bases)
   138       INFINITE = 4
   138       INFINITE = 4
   139     };
   139     };
   140 
   140 
   141       ///\e The type of the investigated LP problem
   141     ///\e The type of the investigated LP problem
   142       enum ProblemTypes {
   142     enum ProblemTypes {
   143 	  ///Primal-dual feasible
   143       ///Primal-dual feasible
   144 	  PRIMAL_DUAL_FEASIBLE = 0,
   144       PRIMAL_DUAL_FEASIBLE = 0,
   145 	  ///Primal feasible dual infeasible
   145       ///Primal feasible dual infeasible
   146 	  PRIMAL_FEASIBLE_DUAL_INFEASIBLE = 1,
   146       PRIMAL_FEASIBLE_DUAL_INFEASIBLE = 1,
   147 	  ///Primal infeasible dual feasible
   147       ///Primal infeasible dual feasible
   148 	  PRIMAL_INFEASIBLE_DUAL_FEASIBLE = 2,
   148       PRIMAL_INFEASIBLE_DUAL_FEASIBLE = 2,
   149 	  ///Primal-dual infeasible
   149       ///Primal-dual infeasible
   150 	  PRIMAL_DUAL_INFEASIBLE = 3,
   150       PRIMAL_DUAL_INFEASIBLE = 3,
   151 	  ///Could not determine so far
   151       ///Could not determine so far
   152 	  UNKNOWN = 4
   152       UNKNOWN = 4
   153       };
   153     };
   154 
   154 
   155     ///The floating point type used by the solver
   155     ///The floating point type used by the solver
   156     typedef double Value;
   156     typedef double Value;
   157     ///The infinity constant
   157     ///The infinity constant
   158     static const Value INF;
   158     static const Value INF;
   550       //return *(LpSolverBase*)0;
   550       //return *(LpSolverBase*)0;
   551     };
   551     };
   552 
   552 
   553     virtual int _addCol() = 0;
   553     virtual int _addCol() = 0;
   554     virtual int _addRow() = 0;
   554     virtual int _addRow() = 0;
       
   555     virtual void _eraseCol(int col) = 0;
       
   556     virtual void _eraseRow(int row) = 0;
   555     virtual void _setRowCoeffs(int i, 
   557     virtual void _setRowCoeffs(int i, 
   556 			       int length,
   558 			       int length,
   557                                int  const * indices, 
   559                                int  const * indices, 
   558                                Value  const * values ) = 0;
   560                                Value  const * values ) = 0;
   559     virtual void _setColCoeffs(int i, 
   561     virtual void _setColCoeffs(int i, 
   678 
   680 
   679     ///Set a column (i.e a dual constraint) of the LP
   681     ///Set a column (i.e a dual constraint) of the LP
   680 
   682 
   681     ///\param c is the column to be modified
   683     ///\param c is the column to be modified
   682     ///\param e is a dual linear expression (see \ref DualExpr)
   684     ///\param e is a dual linear expression (see \ref DualExpr)
   683     ///\bug This is a temportary function. The interface will change to
   685     ///\bug This is a temporary function. The interface will change to
   684     ///a better one.
   686     ///a better one.
   685     void setCol(Col c,const DualExpr &e) {
   687     void setCol(Col c,const DualExpr &e) {
   686       std::vector<int> indices;
   688       std::vector<int> indices;
   687       std::vector<Value> values;
   689       std::vector<Value> values;
   688       indices.push_back(0);
   690       indices.push_back(0);
   715 
   717 
   716     ///This function adds a new empty row (i.e a new constraint) to the LP.
   718     ///This function adds a new empty row (i.e a new constraint) to the LP.
   717     ///\return The created row
   719     ///\return The created row
   718     Row addRow() { Row r; r.id=rows.insert(_addRow()); return r;}
   720     Row addRow() { Row r; r.id=rows.insert(_addRow()); return r;}
   719 
   721 
   720     ///\brief Adds several new row
   722     ///\brief Add several new rows
   721     ///(i.e a variables) at once
   723     ///(i.e a constraints) at once
   722     ///
   724     ///
   723     ///This magic function takes a container as its argument
   725     ///This magic function takes a container as its argument
   724     ///and fills its elements
   726     ///and fills its elements
   725     ///with new row (i.e. variables)
   727     ///with new row (i.e. variables)
   726     ///\param t can be
   728     ///\param t can be
   841     Row addRow(const Constr &c) {
   843     Row addRow(const Constr &c) {
   842       Row r=addRow();
   844       Row r=addRow();
   843       setRow(r,c);
   845       setRow(r,c);
   844       return r;
   846       return r;
   845     }
   847     }
       
   848     ///Erase a coloumn (i.e a variable) from the LP
       
   849 
       
   850     ///\param c is the coloumn to be deleted
       
   851     ///\todo Please check this
       
   852     void eraseCol(Col c) {
       
   853       _eraseCol(cols.floatingId(c.id));
       
   854       cols.erase(c.id);
       
   855     }
       
   856     ///Erase a  row (i.e a constraint) from the LP
       
   857 
       
   858     ///\param r is the row to be deleted
       
   859     ///\todo Please check this
       
   860     void eraseRow(Row r) {
       
   861       _eraseRow(rows.floatingId(r.id));
       
   862       rows.erase(r.id);
       
   863     }
   846 
   864 
   847     ///Set an element of the coefficient matrix of the LP
   865     ///Set an element of the coefficient matrix of the LP
   848 
   866 
   849     ///\param r is the row of the element to be modified
   867     ///\param r is the row of the element to be modified
   850     ///\param c is the coloumn of the element to be modified
   868     ///\param c is the coloumn of the element to be modified