1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
3 * This file is a part of LEMON, a generic C++ optimization library.
5 * Copyright (C) 2003-2011
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
23 #include <lemon/cplex.h>
26 #include <ilcplex/cplex.h>
31 ///\brief Implementation of the LEMON-CPLEX lp solver interface.
34 CplexEnv::LicenseError::LicenseError(int status) {
35 if (!CPXgeterrorstring(0, status, _message)) {
36 std::strcpy(_message, "Cplex unknown error");
40 CplexEnv::CplexEnv() {
44 _env = CPXopenCPLEX(&status);
48 throw LicenseError(status);
52 CplexEnv::CplexEnv(const CplexEnv& other) {
58 CplexEnv& CplexEnv::operator=(const CplexEnv& other) {
65 CplexEnv::~CplexEnv() {
73 CplexBase::CplexBase() : LpBase() {
75 _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
76 messageLevel(MESSAGE_NOTHING);
79 CplexBase::CplexBase(const CplexEnv& env)
80 : LpBase(), _env(env) {
82 _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
83 messageLevel(MESSAGE_NOTHING);
86 CplexBase::CplexBase(const CplexBase& cplex)
89 _prob = CPXcloneprob(cplexEnv(), cplex._prob, &status);
92 messageLevel(MESSAGE_NOTHING);
95 CplexBase::~CplexBase() {
96 CPXfreeprob(cplexEnv(),&_prob);
99 int CplexBase::_addCol() {
100 int i = CPXgetnumcols(cplexEnv(), _prob);
101 double lb = -INF, ub = INF;
102 CPXnewcols(cplexEnv(), _prob, 1, 0, &lb, &ub, 0, 0);
107 int CplexBase::_addRow() {
108 int i = CPXgetnumrows(cplexEnv(), _prob);
109 const double ub = INF;
111 CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
116 void CplexBase::_eraseCol(int i) {
117 CPXdelcols(cplexEnv(), _prob, i, i);
120 void CplexBase::_eraseRow(int i) {
121 CPXdelrows(cplexEnv(), _prob, i, i);
124 void CplexBase::_eraseColId(int i) {
126 cols.shiftIndices(i);
128 void CplexBase::_eraseRowId(int i) {
130 rows.shiftIndices(i);
133 void CplexBase::_getColName(int col, std::string &name) const {
135 CPXgetcolname(cplexEnv(), _prob, 0, 0, 0, &size, col, col);
142 std::vector<char> buf(size);
145 CPXgetcolname(cplexEnv(), _prob, &cname, &buf.front(), size,
150 void CplexBase::_setColName(int col, const std::string &name) {
152 cname = const_cast<char*>(name.c_str());
153 CPXchgcolname(cplexEnv(), _prob, 1, &col, &cname);
156 int CplexBase::_colByName(const std::string& name) const {
158 if (CPXgetcolindex(cplexEnv(), _prob,
159 const_cast<char*>(name.c_str()), &index) == 0) {
165 void CplexBase::_getRowName(int row, std::string &name) const {
167 CPXgetrowname(cplexEnv(), _prob, 0, 0, 0, &size, row, row);
174 std::vector<char> buf(size);
177 CPXgetrowname(cplexEnv(), _prob, &cname, &buf.front(), size,
182 void CplexBase::_setRowName(int row, const std::string &name) {
184 cname = const_cast<char*>(name.c_str());
185 CPXchgrowname(cplexEnv(), _prob, 1, &row, &cname);
188 int CplexBase::_rowByName(const std::string& name) const {
190 if (CPXgetrowindex(cplexEnv(), _prob,
191 const_cast<char*>(name.c_str()), &index) == 0) {
197 void CplexBase::_setRowCoeffs(int i, ExprIterator b,
200 std::vector<int> indices;
201 std::vector<int> rowlist;
202 std::vector<Value> values;
204 for(ExprIterator it=b; it!=e; ++it) {
205 indices.push_back(it->first);
206 values.push_back(it->second);
207 rowlist.push_back(i);
210 CPXchgcoeflist(cplexEnv(), _prob, values.size(),
211 &rowlist.front(), &indices.front(), &values.front());
214 void CplexBase::_getRowCoeffs(int i, InsertIterator b) const {
215 int tmp1, tmp2, tmp3, length;
216 CPXgetrows(cplexEnv(), _prob, &tmp1, &tmp2, 0, 0, 0, &length, i, i);
219 std::vector<int> indices(length);
220 std::vector<double> values(length);
222 CPXgetrows(cplexEnv(), _prob, &tmp1, &tmp2,
223 &indices.front(), &values.front(),
224 length, &tmp3, i, i);
226 for (int i = 0; i < length; ++i) {
227 *b = std::make_pair(indices[i], values[i]);
232 void CplexBase::_setColCoeffs(int i, ExprIterator b, ExprIterator e) {
233 std::vector<int> indices;
234 std::vector<int> collist;
235 std::vector<Value> values;
237 for(ExprIterator it=b; it!=e; ++it) {
238 indices.push_back(it->first);
239 values.push_back(it->second);
240 collist.push_back(i);
243 CPXchgcoeflist(cplexEnv(), _prob, values.size(),
244 &indices.front(), &collist.front(), &values.front());
247 void CplexBase::_getColCoeffs(int i, InsertIterator b) const {
249 int tmp1, tmp2, tmp3, length;
250 CPXgetcols(cplexEnv(), _prob, &tmp1, &tmp2, 0, 0, 0, &length, i, i);
253 std::vector<int> indices(length);
254 std::vector<double> values(length);
256 CPXgetcols(cplexEnv(), _prob, &tmp1, &tmp2,
257 &indices.front(), &values.front(),
258 length, &tmp3, i, i);
260 for (int i = 0; i < length; ++i) {
261 *b = std::make_pair(indices[i], values[i]);
267 void CplexBase::_setCoeff(int row, int col, Value value) {
268 CPXchgcoef(cplexEnv(), _prob, row, col, value);
271 CplexBase::Value CplexBase::_getCoeff(int row, int col) const {
272 CplexBase::Value value;
273 CPXgetcoef(cplexEnv(), _prob, row, col, &value);
277 void CplexBase::_setColLowerBound(int i, Value value) {
279 CPXchgbds(cplexEnv(), _prob, 1, &i, &s, &value);
282 CplexBase::Value CplexBase::_getColLowerBound(int i) const {
283 CplexBase::Value res;
284 CPXgetlb(cplexEnv(), _prob, &res, i, i);
285 return res <= -CPX_INFBOUND ? -INF : res;
288 void CplexBase::_setColUpperBound(int i, Value value)
291 CPXchgbds(cplexEnv(), _prob, 1, &i, &s, &value);
294 CplexBase::Value CplexBase::_getColUpperBound(int i) const {
295 CplexBase::Value res;
296 CPXgetub(cplexEnv(), _prob, &res, i, i);
297 return res >= CPX_INFBOUND ? INF : res;
300 CplexBase::Value CplexBase::_getRowLowerBound(int i) const {
302 CPXgetsense(cplexEnv(), _prob, &s, i, i);
303 CplexBase::Value res;
309 CPXgetrhs(cplexEnv(), _prob, &res, i, i);
310 return res <= -CPX_INFBOUND ? -INF : res;
316 CplexBase::Value CplexBase::_getRowUpperBound(int i) const {
318 CPXgetsense(cplexEnv(), _prob, &s, i, i);
319 CplexBase::Value res;
324 CPXgetrhs(cplexEnv(), _prob, &res, i, i);
325 return res >= CPX_INFBOUND ? INF : res;
327 CPXgetrhs(cplexEnv(), _prob, &res, i, i);
330 CPXgetrngval(cplexEnv(), _prob, &rng, i, i);
333 return res >= CPX_INFBOUND ? INF : res;
339 //This is easier to implement
340 void CplexBase::_set_row_bounds(int i, Value lb, Value ub) {
343 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
344 CPXchgrhs(cplexEnv(), _prob, 1, &i, &ub);
345 } else if (ub == INF) {
347 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
348 CPXchgrhs(cplexEnv(), _prob, 1, &i, &lb);
349 } else if (lb == ub){
351 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
352 CPXchgrhs(cplexEnv(), _prob, 1, &i, &lb);
355 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
356 CPXchgrhs(cplexEnv(), _prob, 1, &i, &lb);
357 double len = ub - lb;
358 CPXchgrngval(cplexEnv(), _prob, 1, &i, &len);
362 void CplexBase::_setRowLowerBound(int i, Value lb)
364 LEMON_ASSERT(lb != INF, "Invalid bound");
365 _set_row_bounds(i, lb, CplexBase::_getRowUpperBound(i));
368 void CplexBase::_setRowUpperBound(int i, Value ub)
371 LEMON_ASSERT(ub != -INF, "Invalid bound");
372 _set_row_bounds(i, CplexBase::_getRowLowerBound(i), ub);
375 void CplexBase::_setObjCoeffs(ExprIterator b, ExprIterator e)
377 std::vector<int> indices;
378 std::vector<Value> values;
379 for(ExprIterator it=b; it!=e; ++it) {
380 indices.push_back(it->first);
381 values.push_back(it->second);
383 CPXchgobj(cplexEnv(), _prob, values.size(),
384 &indices.front(), &values.front());
388 void CplexBase::_getObjCoeffs(InsertIterator b) const
390 int num = CPXgetnumcols(cplexEnv(), _prob);
391 std::vector<Value> x(num);
393 CPXgetobj(cplexEnv(), _prob, &x.front(), 0, num - 1);
394 for (int i = 0; i < num; ++i) {
396 *b = std::make_pair(i, x[i]);
402 void CplexBase::_setObjCoeff(int i, Value obj_coef)
404 CPXchgobj(cplexEnv(), _prob, 1, &i, &obj_coef);
407 CplexBase::Value CplexBase::_getObjCoeff(int i) const
410 CPXgetobj(cplexEnv(), _prob, &x, i, i);
414 void CplexBase::_setSense(CplexBase::Sense sense) {
417 CPXchgobjsen(cplexEnv(), _prob, CPX_MIN);
420 CPXchgobjsen(cplexEnv(), _prob, CPX_MAX);
425 CplexBase::Sense CplexBase::_getSense() const {
426 switch (CPXgetobjsen(cplexEnv(), _prob)) {
432 LEMON_ASSERT(false, "Invalid sense");
433 return CplexBase::Sense();
437 void CplexBase::_clear() {
438 CPXfreeprob(cplexEnv(),&_prob);
440 _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
443 void CplexBase::_messageLevel(MessageLevel level) {
445 case MESSAGE_NOTHING:
446 _message_enabled = false;
449 case MESSAGE_WARNING:
451 case MESSAGE_VERBOSE:
452 _message_enabled = true;
457 void CplexBase::_applyMessageLevel() {
458 CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND,
459 _message_enabled ? CPX_ON : CPX_OFF);
465 : LpBase(), LpSolver(), CplexBase() {}
467 CplexLp::CplexLp(const CplexEnv& env)
468 : LpBase(), LpSolver(), CplexBase(env) {}
470 CplexLp::CplexLp(const CplexLp& other)
471 : LpBase(), LpSolver(), CplexBase(other) {}
473 CplexLp::~CplexLp() {}
475 CplexLp* CplexLp::newSolver() const { return new CplexLp; }
476 CplexLp* CplexLp::cloneSolver() const {return new CplexLp(*this); }
478 const char* CplexLp::_solverName() const { return "CplexLp"; }
480 void CplexLp::_clear_temporals() {
487 // The routine returns zero unless an error occurred during the
488 // optimization. Examples of errors include exhausting available
489 // memory (CPXERR_NO_MEMORY) or encountering invalid data in the
490 // CPLEX problem object (CPXERR_NO_PROBLEM). Exceeding a
491 // user-specified CPLEX limit, or proving the model infeasible or
492 // unbounded, are not considered errors. Note that a zero return
493 // value does not necessarily mean that a solution exists. Use query
494 // routines CPXsolninfo, CPXgetstat, and CPXsolution to obtain
495 // further information about the status of the optimization.
496 CplexLp::SolveExitStatus CplexLp::convertStatus(int status) {
497 #if CPX_VERSION >= 800
499 switch (CPXgetstat(cplexEnv(), _prob)) {
500 case CPX_STAT_OPTIMAL:
501 case CPX_STAT_INFEASIBLE:
502 case CPX_STAT_UNBOUNDED:
512 //We want to exclude some cases
513 switch (CPXgetstat(cplexEnv(), _prob)) {
515 case CPX_IT_LIM_FEAS:
516 case CPX_IT_LIM_INFEAS:
517 case CPX_TIME_LIM_FEAS:
518 case CPX_TIME_LIM_INFEAS:
529 CplexLp::SolveExitStatus CplexLp::_solve() {
531 _applyMessageLevel();
532 return convertStatus(CPXlpopt(cplexEnv(), _prob));
535 CplexLp::SolveExitStatus CplexLp::solvePrimal() {
537 _applyMessageLevel();
538 return convertStatus(CPXprimopt(cplexEnv(), _prob));
541 CplexLp::SolveExitStatus CplexLp::solveDual() {
543 _applyMessageLevel();
544 return convertStatus(CPXdualopt(cplexEnv(), _prob));
547 CplexLp::SolveExitStatus CplexLp::solveBarrier() {
549 _applyMessageLevel();
550 return convertStatus(CPXbaropt(cplexEnv(), _prob));
553 CplexLp::Value CplexLp::_getPrimal(int i) const {
555 CPXgetx(cplexEnv(), _prob, &x, i, i);
559 CplexLp::Value CplexLp::_getDual(int i) const {
561 CPXgetpi(cplexEnv(), _prob, &y, i, i);
565 CplexLp::Value CplexLp::_getPrimalValue() const {
567 CPXgetobjval(cplexEnv(), _prob, &objval);
571 CplexLp::VarStatus CplexLp::_getColStatus(int i) const {
572 if (_col_status.empty()) {
573 _col_status.resize(CPXgetnumcols(cplexEnv(), _prob));
574 CPXgetbase(cplexEnv(), _prob, &_col_status.front(), 0);
576 switch (_col_status[i]) {
586 LEMON_ASSERT(false, "Wrong column status");
587 return CplexLp::VarStatus();
591 CplexLp::VarStatus CplexLp::_getRowStatus(int i) const {
592 if (_row_status.empty()) {
593 _row_status.resize(CPXgetnumrows(cplexEnv(), _prob));
594 CPXgetbase(cplexEnv(), _prob, 0, &_row_status.front());
596 switch (_row_status[i]) {
602 CPXgetsense(cplexEnv(), _prob, &s, i, i);
603 return s != 'L' ? LOWER : UPPER;
608 LEMON_ASSERT(false, "Wrong row status");
609 return CplexLp::VarStatus();
613 CplexLp::Value CplexLp::_getPrimalRay(int i) const {
614 if (_primal_ray.empty()) {
615 _primal_ray.resize(CPXgetnumcols(cplexEnv(), _prob));
616 CPXgetray(cplexEnv(), _prob, &_primal_ray.front());
618 return _primal_ray[i];
621 CplexLp::Value CplexLp::_getDualRay(int i) const {
622 if (_dual_ray.empty()) {
628 // Cplex 7.0 status values
629 // This table lists the statuses, returned by the CPXgetstat()
630 // routine, for solutions to LP problems or mixed integer problems. If
631 // no solution exists, the return value is zero.
633 // For Simplex, Barrier
635 // Optimal solution found
637 // Problem infeasible
641 // Objective limit exceeded in Phase II
643 // Iteration limit exceeded in Phase II
644 // 6 CPX_IT_LIM_INFEAS
645 // Iteration limit exceeded in Phase I
646 // 7 CPX_TIME_LIM_FEAS
647 // Time limit exceeded in Phase II
648 // 8 CPX_TIME_LIM_INFEAS
649 // Time limit exceeded in Phase I
650 // 9 CPX_NUM_BEST_FEAS
651 // Problem non-optimal, singularities in Phase II
652 // 10 CPX_NUM_BEST_INFEAS
653 // Problem non-optimal, singularities in Phase I
654 // 11 CPX_OPTIMAL_INFEAS
655 // Optimal solution found, unscaled infeasibilities
657 // Aborted in Phase II
658 // 13 CPX_ABORT_INFEAS
659 // Aborted in Phase I
660 // 14 CPX_ABORT_DUAL_INFEAS
661 // Aborted in barrier, dual infeasible
662 // 15 CPX_ABORT_PRIM_INFEAS
663 // Aborted in barrier, primal infeasible
664 // 16 CPX_ABORT_PRIM_DUAL_INFEAS
665 // Aborted in barrier, primal and dual infeasible
666 // 17 CPX_ABORT_PRIM_DUAL_FEAS
667 // Aborted in barrier, primal and dual feasible
668 // 18 CPX_ABORT_CROSSOVER
669 // Aborted in crossover
671 // Infeasible or unbounded
675 // Pending return values
676 // ??case CPX_ABORT_DUAL_INFEAS
677 // ??case CPX_ABORT_CROSSOVER
678 // ??case CPX_INForUNBD
681 //Some more interesting stuff:
683 // CPX_PARAM_PROBMETHOD 1062 int LPMETHOD
688 // 4 Standard Barrier
690 // Description: Method for linear optimization.
691 // Determines which algorithm is used when CPXlpopt() (or "optimize"
692 // in the Interactive Optimizer) is called. Currently the behavior of
693 // the "Automatic" setting is that CPLEX simply invokes the dual
694 // simplex method, but this capability may be expanded in the future
695 // so that CPLEX chooses the method based on problem characteristics
696 #if CPX_VERSION < 900
697 void statusSwitch(CPXENVptr cplexEnv(),int& stat){
699 CPXgetintparam (cplexEnv(),CPX_PARAM_PROBMETHOD,&lpmethod);
701 if (stat==CPX_UNBOUNDED){
705 if (stat==CPX_INFEASIBLE)
711 void statusSwitch(CPXENVptr,int&){}
714 CplexLp::ProblemType CplexLp::_getPrimalType() const {
715 // Unboundedness not treated well: the following is from cplex 9.0 doc
716 // About Unboundedness
718 // The treatment of models that are unbounded involves a few
719 // subtleties. Specifically, a declaration of unboundedness means that
720 // ILOG CPLEX has determined that the model has an unbounded
721 // ray. Given any feasible solution x with objective z, a multiple of
722 // the unbounded ray can be added to x to give a feasible solution
723 // with objective z-1 (or z+1 for maximization models). Thus, if a
724 // feasible solution exists, then the optimal objective is
725 // unbounded. Note that ILOG CPLEX has not necessarily concluded that
726 // a feasible solution exists. Users can call the routine CPXsolninfo
727 // to determine whether ILOG CPLEX has also concluded that the model
728 // has a feasible solution.
730 int stat = CPXgetstat(cplexEnv(), _prob);
731 #if CPX_VERSION >= 800
734 case CPX_STAT_OPTIMAL:
736 case CPX_STAT_UNBOUNDED:
738 case CPX_STAT_INFEASIBLE:
744 statusSwitch(cplexEnv(),stat);
745 //CPXgetstat(cplexEnv(), _prob);
748 return UNDEFINED; //Undefined
749 case CPX_OPTIMAL://Optimal
751 case CPX_UNBOUNDED://Unbounded
752 return INFEASIBLE;//In case of dual simplex
754 case CPX_INFEASIBLE://Infeasible
755 // case CPX_IT_LIM_INFEAS:
756 // case CPX_TIME_LIM_INFEAS:
757 // case CPX_NUM_BEST_INFEAS:
758 // case CPX_OPTIMAL_INFEAS:
759 // case CPX_ABORT_INFEAS:
760 // case CPX_ABORT_PRIM_INFEAS:
761 // case CPX_ABORT_PRIM_DUAL_INFEAS:
762 return UNBOUNDED;//In case of dual simplex
765 // case CPX_IT_LIM_FEAS:
766 // case CPX_TIME_LIM_FEAS:
767 // case CPX_NUM_BEST_FEAS:
768 // case CPX_ABORT_FEAS:
769 // case CPX_ABORT_PRIM_DUAL_FEAS:
772 return UNDEFINED; //Everything else comes here
778 // Cplex 9.0 status values
779 // CPX_STAT_ABORT_DUAL_OBJ_LIM
780 // CPX_STAT_ABORT_IT_LIM
781 // CPX_STAT_ABORT_OBJ_LIM
782 // CPX_STAT_ABORT_PRIM_OBJ_LIM
783 // CPX_STAT_ABORT_TIME_LIM
784 // CPX_STAT_ABORT_USER
785 // CPX_STAT_FEASIBLE_RELAXED
786 // CPX_STAT_INFEASIBLE
787 // CPX_STAT_INForUNBD
790 // CPX_STAT_OPTIMAL_FACE_UNBOUNDED
791 // CPX_STAT_OPTIMAL_INFEAS
792 // CPX_STAT_OPTIMAL_RELAXED
793 // CPX_STAT_UNBOUNDED
795 CplexLp::ProblemType CplexLp::_getDualType() const {
796 int stat = CPXgetstat(cplexEnv(), _prob);
797 #if CPX_VERSION >= 800
799 case CPX_STAT_OPTIMAL:
801 case CPX_STAT_UNBOUNDED:
807 statusSwitch(cplexEnv(),stat);
810 return UNDEFINED; //Undefined
811 case CPX_OPTIMAL://Optimal
816 return UNDEFINED; //Everything else comes here
825 : LpBase(), MipSolver(), CplexBase() {
827 #if CPX_VERSION < 800
828 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MIP);
830 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MILP);
834 CplexMip::CplexMip(const CplexEnv& env)
835 : LpBase(), MipSolver(), CplexBase(env) {
837 #if CPX_VERSION < 800
838 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MIP);
840 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MILP);
845 CplexMip::CplexMip(const CplexMip& other)
846 : LpBase(), MipSolver(), CplexBase(other) {}
848 CplexMip::~CplexMip() {}
850 CplexMip* CplexMip::newSolver() const { return new CplexMip; }
851 CplexMip* CplexMip::cloneSolver() const {return new CplexMip(*this); }
853 const char* CplexMip::_solverName() const { return "CplexMip"; }
855 void CplexMip::_setColType(int i, CplexMip::ColTypes col_type) {
857 // Note If a variable is to be changed to binary, a call to CPXchgbds
858 // should also be made to change the bounds to 0 and 1.
863 CPXchgctype (cplexEnv(), _prob, 1, &i, &t);
867 CPXchgctype (cplexEnv(), _prob, 1, &i, &t);
874 CplexMip::ColTypes CplexMip::_getColType(int i) const {
876 CPXgetctype (cplexEnv(), _prob, &t, i, i);
883 LEMON_ASSERT(false, "Invalid column type");
889 CplexMip::SolveExitStatus CplexMip::_solve() {
891 _applyMessageLevel();
892 status = CPXmipopt (cplexEnv(), _prob);
901 CplexMip::ProblemType CplexMip::_getType() const {
903 int stat = CPXgetstat(cplexEnv(), _prob);
905 //Fortunately, MIP statuses did not change for cplex 8.0
908 // Optimal integer solution has been found.
909 case CPXMIP_OPTIMAL_TOL:
910 // Optimal soluton with the tolerance defined by epgap or epagap has
913 //This also exists in later issues
914 // case CPXMIP_UNBOUNDED:
916 case CPXMIP_INFEASIBLE:
921 //Unboundedness not treated well: the following is from cplex 9.0 doc
922 // About Unboundedness
924 // The treatment of models that are unbounded involves a few
925 // subtleties. Specifically, a declaration of unboundedness means that
926 // ILOG CPLEX has determined that the model has an unbounded
927 // ray. Given any feasible solution x with objective z, a multiple of
928 // the unbounded ray can be added to x to give a feasible solution
929 // with objective z-1 (or z+1 for maximization models). Thus, if a
930 // feasible solution exists, then the optimal objective is
931 // unbounded. Note that ILOG CPLEX has not necessarily concluded that
932 // a feasible solution exists. Users can call the routine CPXsolninfo
933 // to determine whether ILOG CPLEX has also concluded that the model
934 // has a feasible solution.
937 CplexMip::Value CplexMip::_getSol(int i) const {
939 CPXgetmipx(cplexEnv(), _prob, &x, i, i);
943 CplexMip::Value CplexMip::_getSolValue() const {
945 CPXgetmipobjval(cplexEnv(), _prob, &objval);