1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/lemon/lp_cplex.h Tue Dec 02 21:40:33 2008 +0100
1.3 @@ -0,0 +1,113 @@
1.4 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
1.5 + *
1.6 + * This file is a part of LEMON, a generic C++ optimization library.
1.7 + *
1.8 + * Copyright (C) 2003-2008
1.9 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 + * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 + *
1.12 + * Permission to use, modify and distribute this software is granted
1.13 + * provided that this copyright notice appears in all copies. For
1.14 + * precise terms see the accompanying LICENSE file.
1.15 + *
1.16 + * This software is provided "AS IS" with no warranty of any kind,
1.17 + * express or implied, and with no claim as to its suitability for any
1.18 + * purpose.
1.19 + *
1.20 + */
1.21 +
1.22 +#ifndef LEMON_LP_CPLEX_H
1.23 +#define LEMON_LP_CPLEX_H
1.24 +
1.25 +///\file
1.26 +///\brief Header of the LEMON-CPLEX lp solver interface.
1.27 +
1.28 +#include <lemon/lp_base.h>
1.29 +
1.30 +struct cpxenv;
1.31 +struct cpxlp;
1.32 +
1.33 +namespace lemon {
1.34 +
1.35 +
1.36 + /// \brief Interface for the CPLEX solver
1.37 + ///
1.38 + /// This class implements an interface for the CPLEX LP solver.
1.39 + class LpCplex :virtual public LpSolverBase {
1.40 +
1.41 + public:
1.42 +
1.43 + typedef LpSolverBase Parent;
1.44 +
1.45 + /// \e
1.46 + int status;
1.47 + cpxenv* env;
1.48 + cpxlp* lp;
1.49 +
1.50 +
1.51 + /// \e
1.52 + LpCplex();
1.53 + /// \e
1.54 + LpCplex(const LpCplex&);
1.55 + /// \e
1.56 + ~LpCplex();
1.57 +
1.58 + protected:
1.59 + virtual LpSolverBase* _newLp();
1.60 + virtual LpSolverBase* _copyLp();
1.61 +
1.62 +
1.63 + virtual int _addCol();
1.64 + virtual int _addRow();
1.65 + virtual void _eraseCol(int i);
1.66 + virtual void _eraseRow(int i);
1.67 + virtual void _getColName(int col, std::string & name) const;
1.68 + virtual void _setColName(int col, const std::string & name);
1.69 + virtual int _colByName(const std::string& name) const;
1.70 + virtual void _setRowCoeffs(int i, ConstRowIterator b, ConstRowIterator e);
1.71 + virtual void _getRowCoeffs(int i, RowIterator b) const;
1.72 + virtual void _setColCoeffs(int i, ConstColIterator b, ConstColIterator e);
1.73 + virtual void _getColCoeffs(int i, ColIterator b) const;
1.74 + virtual void _setCoeff(int row, int col, Value value);
1.75 + virtual Value _getCoeff(int row, int col) const;
1.76 +
1.77 + virtual void _setColLowerBound(int i, Value value);
1.78 + virtual Value _getColLowerBound(int i) const;
1.79 + virtual void _setColUpperBound(int i, Value value);
1.80 + virtual Value _getColUpperBound(int i) const;
1.81 +
1.82 +// virtual void _setRowLowerBound(int i, Value value);
1.83 +// virtual void _setRowUpperBound(int i, Value value);
1.84 + virtual void _setRowBounds(int i, Value lower, Value upper);
1.85 + virtual void _getRowBounds(int i, Value &lb, Value &ub) const;
1.86 + virtual void _setObjCoeff(int i, Value obj_coef);
1.87 + virtual Value _getObjCoeff(int i) const;
1.88 + virtual void _clearObj();
1.89 +
1.90 +
1.91 + virtual SolveExitStatus _solve();
1.92 + virtual Value _getPrimal(int i) const;
1.93 + virtual Value _getDual(int i) const;
1.94 + virtual Value _getPrimalValue() const;
1.95 + virtual bool _isBasicCol(int i) const;
1.96 +
1.97 + virtual SolutionStatus _getPrimalStatus() const;
1.98 + virtual SolutionStatus _getDualStatus() const;
1.99 + virtual ProblemTypes _getProblemType() const;
1.100 +
1.101 +
1.102 + virtual void _setMax();
1.103 + virtual void _setMin();
1.104 +
1.105 + virtual bool _isMax() const;
1.106 +
1.107 + public:
1.108 +
1.109 + cpxenv* cplexEnv() { return env; }
1.110 + cpxlp* cplexLp() { return lp; }
1.111 +
1.112 + };
1.113 +} //END OF NAMESPACE LEMON
1.114 +
1.115 +#endif //LEMON_LP_CPLEX_H
1.116 +