1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/work/athos/lp/lp_cplex.cc Mon Apr 04 14:46:08 2005 +0000
1.3 @@ -0,0 +1,105 @@
1.4 +/* -*- C++ -*-
1.5 + * src/lemon/lp_cplex.cc
1.6 + * - Part of LEMON, a generic C++ optimization library
1.7 + *
1.8 + * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.9 + * (Egervary Combinatorial Optimization Research Group, EGRES).
1.10 + *
1.11 + * Permission to use, modify and distribute this software is granted
1.12 + * provided that this copyright notice appears in all copies. For
1.13 + * precise terms see the accompanying LICENSE file.
1.14 + *
1.15 + * This software is provided "AS IS" with no warranty of any kind,
1.16 + * express or implied, and with no claim as to its suitability for any
1.17 + * purpose.
1.18 + *
1.19 + */
1.20 +
1.21 +#include"lp_cplex.h"
1.22 +
1.23 +///\file
1.24 +///\brief Implementation of the LEMON-CPLEX lp solver interface.
1.25 +namespace lemon {
1.26 +
1.27 + int LpCplex::_addCol()
1.28 + {
1.29 + int i = CPXgetnumcols (env, lp);
1.30 + int lb[1],ub[1];
1.31 + lb[0]=-INF;//-CPX_INFBOUND;
1.32 + ub[0]=INF;//CPX_INFBOUND;
1.33 + status = CPXnewcols (env, lp, 1, NULL, lb, ub, NULL, NULL);
1.34 + return i;
1.35 + }
1.36 +
1.37 + int LpCplex::_addRow()
1.38 + {
1.39 + int i = CPXgetnumrows (env, lp);
1.40 + status = CPXnewrows (env, lp, 1, NULL, NULL, NULL, NULL, NULL);
1.41 + return i;
1.42 + }
1.43 +
1.44 + ///\warning Data at index 0 is ignored iin the arrays.
1.45 + void LpCplex::_setRowCoeffs(int i,
1.46 + int length,
1.47 + int const * indices,
1.48 + Value const * values )
1.49 + {
1.50 + int rowlist[length+1];
1.51 + for (int k=1;k<=length;++k){
1.52 + rowlist[k]=i;
1.53 + }
1.54 + status = CPXchgcoeflist(env, lp,
1.55 + length,
1.56 + rowlist++,
1.57 + inices++,
1.58 + values++);
1.59 + }
1.60 +
1.61 + void LpCplex::_setColCoeffs(int i,
1.62 + int length,
1.63 + int const * indices,
1.64 + Value const * values)
1.65 + {
1.66 + int collist[length+1];
1.67 + for (int k=1;k<=length;++k){
1.68 + collist[k]=i;
1.69 + }
1.70 + status = CPXchgcoeflist(env, lp,
1.71 + length,
1.72 + inices++,
1.73 + collist++,
1.74 + values++);
1.75 + }
1.76 +
1.77 + void LpCplex::_setColLowerBound(int i, Value value)
1.78 + {
1.79 + }
1.80 +
1.81 + void LpCplex::_setColUpperBound(int i, Value value)
1.82 + {
1.83 + }
1.84 +
1.85 + void LpCplex::_setRowLowerBound(int i, Value value)
1.86 + {
1.87 + }
1.88 +
1.89 + void LpCplex::_setRowUpperBound(int i, Value value)
1.90 + {
1.91 + }
1.92 +
1.93 + void LpCplex::_setObjCoeff(int i, Value obj_coef)
1.94 + {
1.95 + }
1.96 +
1.97 + LpCplex::SolutionType LpCplex::_solve()
1.98 + {
1.99 + return OPTIMAL;
1.100 + }
1.101 +
1.102 + LpCplex::Value LpCplex::_getSolution(int i)
1.103 + {
1.104 + return 0;
1.105 + }
1.106 +
1.107 +} //namespace lemon
1.108 +