athos@1299: /* -*- C++ -*- athos@1299: * src/lemon/lp_cplex.cc athos@1299: * - Part of LEMON, a generic C++ optimization library athos@1299: * athos@1299: * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport athos@1299: * (Egervary Combinatorial Optimization Research Group, EGRES). athos@1299: * athos@1299: * Permission to use, modify and distribute this software is granted athos@1299: * provided that this copyright notice appears in all copies. For athos@1299: * precise terms see the accompanying LICENSE file. athos@1299: * athos@1299: * This software is provided "AS IS" with no warranty of any kind, athos@1299: * express or implied, and with no claim as to its suitability for any athos@1299: * purpose. athos@1299: * athos@1299: */ athos@1299: athos@1299: #include"lp_cplex.h" athos@1299: athos@1299: ///\file athos@1299: ///\brief Implementation of the LEMON-CPLEX lp solver interface. athos@1299: namespace lemon { athos@1299: athos@1299: int LpCplex::_addCol() athos@1299: { athos@1299: int i = CPXgetnumcols (env, lp); athos@1299: int lb[1],ub[1]; athos@1299: lb[0]=-INF;//-CPX_INFBOUND; athos@1299: ub[0]=INF;//CPX_INFBOUND; athos@1299: status = CPXnewcols (env, lp, 1, NULL, lb, ub, NULL, NULL); athos@1299: return i; athos@1299: } athos@1299: athos@1299: int LpCplex::_addRow() athos@1299: { athos@1299: int i = CPXgetnumrows (env, lp); athos@1299: status = CPXnewrows (env, lp, 1, NULL, NULL, NULL, NULL, NULL); athos@1299: return i; athos@1299: } athos@1299: athos@1299: ///\warning Data at index 0 is ignored iin the arrays. athos@1299: void LpCplex::_setRowCoeffs(int i, athos@1299: int length, athos@1299: int const * indices, athos@1299: Value const * values ) athos@1299: { athos@1299: int rowlist[length+1]; athos@1299: for (int k=1;k<=length;++k){ athos@1299: rowlist[k]=i; athos@1299: } athos@1299: status = CPXchgcoeflist(env, lp, athos@1299: length, athos@1299: rowlist++, athos@1299: inices++, athos@1299: values++); athos@1299: } athos@1299: athos@1299: void LpCplex::_setColCoeffs(int i, athos@1299: int length, athos@1299: int const * indices, athos@1299: Value const * values) athos@1299: { athos@1299: int collist[length+1]; athos@1299: for (int k=1;k<=length;++k){ athos@1299: collist[k]=i; athos@1299: } athos@1299: status = CPXchgcoeflist(env, lp, athos@1299: length, athos@1299: inices++, athos@1299: collist++, athos@1299: values++); athos@1299: } athos@1299: athos@1299: void LpCplex::_setColLowerBound(int i, Value value) athos@1299: { athos@1299: } athos@1299: athos@1299: void LpCplex::_setColUpperBound(int i, Value value) athos@1299: { athos@1299: } athos@1299: athos@1299: void LpCplex::_setRowLowerBound(int i, Value value) athos@1299: { athos@1299: } athos@1299: athos@1299: void LpCplex::_setRowUpperBound(int i, Value value) athos@1299: { athos@1299: } athos@1299: athos@1299: void LpCplex::_setObjCoeff(int i, Value obj_coef) athos@1299: { athos@1299: } athos@1299: athos@1299: LpCplex::SolutionType LpCplex::_solve() athos@1299: { athos@1299: return OPTIMAL; athos@1299: } athos@1299: athos@1299: LpCplex::Value LpCplex::_getSolution(int i) athos@1299: { athos@1299: return 0; athos@1299: } athos@1299: athos@1299: } //namespace lemon athos@1299: