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() {
43 _env = CPXopenCPLEX(&status);
47 throw LicenseError(status);
51 CplexEnv::CplexEnv(const CplexEnv& other) {
57 CplexEnv& CplexEnv::operator=(const CplexEnv& other) {
64 CplexEnv::~CplexEnv() {
72 CplexBase::CplexBase() : LpBase() {
74 _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
75 messageLevel(MESSAGE_NOTHING);
78 CplexBase::CplexBase(const CplexEnv& env)
79 : LpBase(), _env(env) {
81 _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
82 messageLevel(MESSAGE_NOTHING);
85 CplexBase::CplexBase(const CplexBase& cplex)
88 _prob = CPXcloneprob(cplexEnv(), cplex._prob, &status);
91 messageLevel(MESSAGE_NOTHING);
94 CplexBase::~CplexBase() {
95 CPXfreeprob(cplexEnv(),&_prob);
98 int CplexBase::_addCol() {
99 int i = CPXgetnumcols(cplexEnv(), _prob);
100 double lb = -INF, ub = INF;
101 CPXnewcols(cplexEnv(), _prob, 1, 0, &lb, &ub, 0, 0);
106 int CplexBase::_addRow() {
107 int i = CPXgetnumrows(cplexEnv(), _prob);
108 const double ub = INF;
110 CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
115 void CplexBase::_eraseCol(int i) {
116 CPXdelcols(cplexEnv(), _prob, i, i);
119 void CplexBase::_eraseRow(int i) {
120 CPXdelrows(cplexEnv(), _prob, i, i);
123 void CplexBase::_eraseColId(int i) {
125 cols.shiftIndices(i);
127 void CplexBase::_eraseRowId(int i) {
129 rows.shiftIndices(i);
132 void CplexBase::_getColName(int col, std::string &name) const {
134 CPXgetcolname(cplexEnv(), _prob, 0, 0, 0, &size, col, col);
141 std::vector<char> buf(size);
144 CPXgetcolname(cplexEnv(), _prob, &cname, &buf.front(), size,
149 void CplexBase::_setColName(int col, const std::string &name) {
151 cname = const_cast<char*>(name.c_str());
152 CPXchgcolname(cplexEnv(), _prob, 1, &col, &cname);
155 int CplexBase::_colByName(const std::string& name) const {
157 if (CPXgetcolindex(cplexEnv(), _prob,
158 const_cast<char*>(name.c_str()), &index) == 0) {
164 void CplexBase::_getRowName(int row, std::string &name) const {
166 CPXgetrowname(cplexEnv(), _prob, 0, 0, 0, &size, row, row);
173 std::vector<char> buf(size);
176 CPXgetrowname(cplexEnv(), _prob, &cname, &buf.front(), size,
181 void CplexBase::_setRowName(int row, const std::string &name) {
183 cname = const_cast<char*>(name.c_str());
184 CPXchgrowname(cplexEnv(), _prob, 1, &row, &cname);
187 int CplexBase::_rowByName(const std::string& name) const {
189 if (CPXgetrowindex(cplexEnv(), _prob,
190 const_cast<char*>(name.c_str()), &index) == 0) {
196 void CplexBase::_setRowCoeffs(int i, ExprIterator b,
199 std::vector<int> indices;
200 std::vector<int> rowlist;
201 std::vector<Value> values;
203 for(ExprIterator it=b; it!=e; ++it) {
204 indices.push_back(it->first);
205 values.push_back(it->second);
206 rowlist.push_back(i);
209 CPXchgcoeflist(cplexEnv(), _prob, values.size(),
210 &rowlist.front(), &indices.front(), &values.front());
213 void CplexBase::_getRowCoeffs(int i, InsertIterator b) const {
214 int tmp1, tmp2, tmp3, length;
215 CPXgetrows(cplexEnv(), _prob, &tmp1, &tmp2, 0, 0, 0, &length, i, i);
218 std::vector<int> indices(length);
219 std::vector<double> values(length);
221 CPXgetrows(cplexEnv(), _prob, &tmp1, &tmp2,
222 &indices.front(), &values.front(),
223 length, &tmp3, i, i);
225 for (int i = 0; i < length; ++i) {
226 *b = std::make_pair(indices[i], values[i]);
231 void CplexBase::_setColCoeffs(int i, ExprIterator b, ExprIterator e) {
232 std::vector<int> indices;
233 std::vector<int> collist;
234 std::vector<Value> values;
236 for(ExprIterator it=b; it!=e; ++it) {
237 indices.push_back(it->first);
238 values.push_back(it->second);
239 collist.push_back(i);
242 CPXchgcoeflist(cplexEnv(), _prob, values.size(),
243 &indices.front(), &collist.front(), &values.front());
246 void CplexBase::_getColCoeffs(int i, InsertIterator b) const {
248 int tmp1, tmp2, tmp3, length;
249 CPXgetcols(cplexEnv(), _prob, &tmp1, &tmp2, 0, 0, 0, &length, i, i);
252 std::vector<int> indices(length);
253 std::vector<double> values(length);
255 CPXgetcols(cplexEnv(), _prob, &tmp1, &tmp2,
256 &indices.front(), &values.front(),
257 length, &tmp3, i, i);
259 for (int i = 0; i < length; ++i) {
260 *b = std::make_pair(indices[i], values[i]);
266 void CplexBase::_setCoeff(int row, int col, Value value) {
267 CPXchgcoef(cplexEnv(), _prob, row, col, value);
270 CplexBase::Value CplexBase::_getCoeff(int row, int col) const {
271 CplexBase::Value value;
272 CPXgetcoef(cplexEnv(), _prob, row, col, &value);
276 void CplexBase::_setColLowerBound(int i, Value value) {
278 CPXchgbds(cplexEnv(), _prob, 1, &i, &s, &value);
281 CplexBase::Value CplexBase::_getColLowerBound(int i) const {
282 CplexBase::Value res;
283 CPXgetlb(cplexEnv(), _prob, &res, i, i);
284 return res <= -CPX_INFBOUND ? -INF : res;
287 void CplexBase::_setColUpperBound(int i, Value value)
290 CPXchgbds(cplexEnv(), _prob, 1, &i, &s, &value);
293 CplexBase::Value CplexBase::_getColUpperBound(int i) const {
294 CplexBase::Value res;
295 CPXgetub(cplexEnv(), _prob, &res, i, i);
296 return res >= CPX_INFBOUND ? INF : res;
299 CplexBase::Value CplexBase::_getRowLowerBound(int i) const {
301 CPXgetsense(cplexEnv(), _prob, &s, i, i);
302 CplexBase::Value res;
308 CPXgetrhs(cplexEnv(), _prob, &res, i, i);
309 return res <= -CPX_INFBOUND ? -INF : res;
315 CplexBase::Value CplexBase::_getRowUpperBound(int i) const {
317 CPXgetsense(cplexEnv(), _prob, &s, i, i);
318 CplexBase::Value res;
323 CPXgetrhs(cplexEnv(), _prob, &res, i, i);
324 return res >= CPX_INFBOUND ? INF : res;
326 CPXgetrhs(cplexEnv(), _prob, &res, i, i);
329 CPXgetrngval(cplexEnv(), _prob, &rng, i, i);
332 return res >= CPX_INFBOUND ? INF : res;
338 //This is easier to implement
339 void CplexBase::_set_row_bounds(int i, Value lb, Value ub) {
342 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
343 CPXchgrhs(cplexEnv(), _prob, 1, &i, &ub);
344 } else if (ub == INF) {
346 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
347 CPXchgrhs(cplexEnv(), _prob, 1, &i, &lb);
348 } else if (lb == ub){
350 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
351 CPXchgrhs(cplexEnv(), _prob, 1, &i, &lb);
354 CPXchgsense(cplexEnv(), _prob, 1, &i, &s);
355 CPXchgrhs(cplexEnv(), _prob, 1, &i, &lb);
356 double len = ub - lb;
357 CPXchgrngval(cplexEnv(), _prob, 1, &i, &len);
361 void CplexBase::_setRowLowerBound(int i, Value lb)
363 LEMON_ASSERT(lb != INF, "Invalid bound");
364 _set_row_bounds(i, lb, CplexBase::_getRowUpperBound(i));
367 void CplexBase::_setRowUpperBound(int i, Value ub)
370 LEMON_ASSERT(ub != -INF, "Invalid bound");
371 _set_row_bounds(i, CplexBase::_getRowLowerBound(i), ub);
374 void CplexBase::_setObjCoeffs(ExprIterator b, ExprIterator e)
376 std::vector<int> indices;
377 std::vector<Value> values;
378 for(ExprIterator it=b; it!=e; ++it) {
379 indices.push_back(it->first);
380 values.push_back(it->second);
382 CPXchgobj(cplexEnv(), _prob, values.size(),
383 &indices.front(), &values.front());
387 void CplexBase::_getObjCoeffs(InsertIterator b) const
389 int num = CPXgetnumcols(cplexEnv(), _prob);
390 std::vector<Value> x(num);
392 CPXgetobj(cplexEnv(), _prob, &x.front(), 0, num - 1);
393 for (int i = 0; i < num; ++i) {
395 *b = std::make_pair(i, x[i]);
401 void CplexBase::_setObjCoeff(int i, Value obj_coef)
403 CPXchgobj(cplexEnv(), _prob, 1, &i, &obj_coef);
406 CplexBase::Value CplexBase::_getObjCoeff(int i) const
409 CPXgetobj(cplexEnv(), _prob, &x, i, i);
413 void CplexBase::_setSense(CplexBase::Sense sense) {
416 CPXchgobjsen(cplexEnv(), _prob, CPX_MIN);
419 CPXchgobjsen(cplexEnv(), _prob, CPX_MAX);
424 CplexBase::Sense CplexBase::_getSense() const {
425 switch (CPXgetobjsen(cplexEnv(), _prob)) {
431 LEMON_ASSERT(false, "Invalid sense");
432 return CplexBase::Sense();
436 void CplexBase::_clear() {
437 CPXfreeprob(cplexEnv(),&_prob);
439 _prob = CPXcreateprob(cplexEnv(), &status, "Cplex problem");
444 void CplexBase::_messageLevel(MessageLevel level) {
446 case MESSAGE_NOTHING:
447 _message_enabled = false;
450 case MESSAGE_WARNING:
452 case MESSAGE_VERBOSE:
453 _message_enabled = true;
458 void CplexBase::_applyMessageLevel() {
459 CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND,
460 _message_enabled ? CPX_ON : CPX_OFF);
466 : LpBase(), LpSolver(), CplexBase() {}
468 CplexLp::CplexLp(const CplexEnv& env)
469 : LpBase(), LpSolver(), CplexBase(env) {}
471 CplexLp::CplexLp(const CplexLp& other)
472 : LpBase(), LpSolver(), CplexBase(other) {}
474 CplexLp::~CplexLp() {}
476 CplexLp* CplexLp::newSolver() const { return new CplexLp; }
477 CplexLp* CplexLp::cloneSolver() const {return new CplexLp(*this); }
479 const char* CplexLp::_solverName() const { return "CplexLp"; }
481 void CplexLp::_clear_temporals() {
488 // The routine returns zero unless an error occurred during the
489 // optimization. Examples of errors include exhausting available
490 // memory (CPXERR_NO_MEMORY) or encountering invalid data in the
491 // CPLEX problem object (CPXERR_NO_PROBLEM). Exceeding a
492 // user-specified CPLEX limit, or proving the model infeasible or
493 // unbounded, are not considered errors. Note that a zero return
494 // value does not necessarily mean that a solution exists. Use query
495 // routines CPXsolninfo, CPXgetstat, and CPXsolution to obtain
496 // further information about the status of the optimization.
497 CplexLp::SolveExitStatus CplexLp::convertStatus(int status) {
498 #if CPX_VERSION >= 800
500 switch (CPXgetstat(cplexEnv(), _prob)) {
501 case CPX_STAT_OPTIMAL:
502 case CPX_STAT_INFEASIBLE:
503 case CPX_STAT_UNBOUNDED:
513 //We want to exclude some cases
514 switch (CPXgetstat(cplexEnv(), _prob)) {
516 case CPX_IT_LIM_FEAS:
517 case CPX_IT_LIM_INFEAS:
518 case CPX_TIME_LIM_FEAS:
519 case CPX_TIME_LIM_INFEAS:
530 CplexLp::SolveExitStatus CplexLp::_solve() {
532 _applyMessageLevel();
533 return convertStatus(CPXlpopt(cplexEnv(), _prob));
536 CplexLp::SolveExitStatus CplexLp::solvePrimal() {
538 _applyMessageLevel();
539 return convertStatus(CPXprimopt(cplexEnv(), _prob));
542 CplexLp::SolveExitStatus CplexLp::solveDual() {
544 _applyMessageLevel();
545 return convertStatus(CPXdualopt(cplexEnv(), _prob));
548 CplexLp::SolveExitStatus CplexLp::solveBarrier() {
550 _applyMessageLevel();
551 return convertStatus(CPXbaropt(cplexEnv(), _prob));
554 CplexLp::Value CplexLp::_getPrimal(int i) const {
556 CPXgetx(cplexEnv(), _prob, &x, i, i);
560 CplexLp::Value CplexLp::_getDual(int i) const {
562 CPXgetpi(cplexEnv(), _prob, &y, i, i);
566 CplexLp::Value CplexLp::_getPrimalValue() const {
568 CPXgetobjval(cplexEnv(), _prob, &objval);
572 CplexLp::VarStatus CplexLp::_getColStatus(int i) const {
573 if (_col_status.empty()) {
574 _col_status.resize(CPXgetnumcols(cplexEnv(), _prob));
575 CPXgetbase(cplexEnv(), _prob, &_col_status.front(), 0);
577 switch (_col_status[i]) {
587 LEMON_ASSERT(false, "Wrong column status");
588 return CplexLp::VarStatus();
592 CplexLp::VarStatus CplexLp::_getRowStatus(int i) const {
593 if (_row_status.empty()) {
594 _row_status.resize(CPXgetnumrows(cplexEnv(), _prob));
595 CPXgetbase(cplexEnv(), _prob, 0, &_row_status.front());
597 switch (_row_status[i]) {
603 CPXgetsense(cplexEnv(), _prob, &s, i, i);
604 return s != 'L' ? LOWER : UPPER;
609 LEMON_ASSERT(false, "Wrong row status");
610 return CplexLp::VarStatus();
614 CplexLp::Value CplexLp::_getPrimalRay(int i) const {
615 if (_primal_ray.empty()) {
616 _primal_ray.resize(CPXgetnumcols(cplexEnv(), _prob));
617 CPXgetray(cplexEnv(), _prob, &_primal_ray.front());
619 return _primal_ray[i];
622 CplexLp::Value CplexLp::_getDualRay(int i) const {
623 if (_dual_ray.empty()) {
629 // Cplex 7.0 status values
630 // This table lists the statuses, returned by the CPXgetstat()
631 // routine, for solutions to LP problems or mixed integer problems. If
632 // no solution exists, the return value is zero.
634 // For Simplex, Barrier
636 // Optimal solution found
638 // Problem infeasible
642 // Objective limit exceeded in Phase II
644 // Iteration limit exceeded in Phase II
645 // 6 CPX_IT_LIM_INFEAS
646 // Iteration limit exceeded in Phase I
647 // 7 CPX_TIME_LIM_FEAS
648 // Time limit exceeded in Phase II
649 // 8 CPX_TIME_LIM_INFEAS
650 // Time limit exceeded in Phase I
651 // 9 CPX_NUM_BEST_FEAS
652 // Problem non-optimal, singularities in Phase II
653 // 10 CPX_NUM_BEST_INFEAS
654 // Problem non-optimal, singularities in Phase I
655 // 11 CPX_OPTIMAL_INFEAS
656 // Optimal solution found, unscaled infeasibilities
658 // Aborted in Phase II
659 // 13 CPX_ABORT_INFEAS
660 // Aborted in Phase I
661 // 14 CPX_ABORT_DUAL_INFEAS
662 // Aborted in barrier, dual infeasible
663 // 15 CPX_ABORT_PRIM_INFEAS
664 // Aborted in barrier, primal infeasible
665 // 16 CPX_ABORT_PRIM_DUAL_INFEAS
666 // Aborted in barrier, primal and dual infeasible
667 // 17 CPX_ABORT_PRIM_DUAL_FEAS
668 // Aborted in barrier, primal and dual feasible
669 // 18 CPX_ABORT_CROSSOVER
670 // Aborted in crossover
672 // Infeasible or unbounded
676 // Pending return values
677 // ??case CPX_ABORT_DUAL_INFEAS
678 // ??case CPX_ABORT_CROSSOVER
679 // ??case CPX_INForUNBD
682 //Some more interesting stuff:
684 // CPX_PARAM_PROBMETHOD 1062 int LPMETHOD
689 // 4 Standard Barrier
691 // Description: Method for linear optimization.
692 // Determines which algorithm is used when CPXlpopt() (or "optimize"
693 // in the Interactive Optimizer) is called. Currently the behavior of
694 // the "Automatic" setting is that CPLEX simply invokes the dual
695 // simplex method, but this capability may be expanded in the future
696 // so that CPLEX chooses the method based on problem characteristics
697 #if CPX_VERSION < 900
698 void statusSwitch(CPXENVptr cplexEnv(),int& stat){
700 CPXgetintparam (cplexEnv(),CPX_PARAM_PROBMETHOD,&lpmethod);
702 if (stat==CPX_UNBOUNDED){
706 if (stat==CPX_INFEASIBLE)
712 void statusSwitch(CPXENVptr,int&){}
715 CplexLp::ProblemType CplexLp::_getPrimalType() const {
716 // Unboundedness not treated well: the following is from cplex 9.0 doc
717 // About Unboundedness
719 // The treatment of models that are unbounded involves a few
720 // subtleties. Specifically, a declaration of unboundedness means that
721 // ILOG CPLEX has determined that the model has an unbounded
722 // ray. Given any feasible solution x with objective z, a multiple of
723 // the unbounded ray can be added to x to give a feasible solution
724 // with objective z-1 (or z+1 for maximization models). Thus, if a
725 // feasible solution exists, then the optimal objective is
726 // unbounded. Note that ILOG CPLEX has not necessarily concluded that
727 // a feasible solution exists. Users can call the routine CPXsolninfo
728 // to determine whether ILOG CPLEX has also concluded that the model
729 // has a feasible solution.
731 int stat = CPXgetstat(cplexEnv(), _prob);
732 #if CPX_VERSION >= 800
735 case CPX_STAT_OPTIMAL:
737 case CPX_STAT_UNBOUNDED:
739 case CPX_STAT_INFEASIBLE:
745 statusSwitch(cplexEnv(),stat);
746 //CPXgetstat(cplexEnv(), _prob);
749 return UNDEFINED; //Undefined
750 case CPX_OPTIMAL://Optimal
752 case CPX_UNBOUNDED://Unbounded
753 return INFEASIBLE;//In case of dual simplex
755 case CPX_INFEASIBLE://Infeasible
756 // case CPX_IT_LIM_INFEAS:
757 // case CPX_TIME_LIM_INFEAS:
758 // case CPX_NUM_BEST_INFEAS:
759 // case CPX_OPTIMAL_INFEAS:
760 // case CPX_ABORT_INFEAS:
761 // case CPX_ABORT_PRIM_INFEAS:
762 // case CPX_ABORT_PRIM_DUAL_INFEAS:
763 return UNBOUNDED;//In case of dual simplex
766 // case CPX_IT_LIM_FEAS:
767 // case CPX_TIME_LIM_FEAS:
768 // case CPX_NUM_BEST_FEAS:
769 // case CPX_ABORT_FEAS:
770 // case CPX_ABORT_PRIM_DUAL_FEAS:
773 return UNDEFINED; //Everything else comes here
779 // Cplex 9.0 status values
780 // CPX_STAT_ABORT_DUAL_OBJ_LIM
781 // CPX_STAT_ABORT_IT_LIM
782 // CPX_STAT_ABORT_OBJ_LIM
783 // CPX_STAT_ABORT_PRIM_OBJ_LIM
784 // CPX_STAT_ABORT_TIME_LIM
785 // CPX_STAT_ABORT_USER
786 // CPX_STAT_FEASIBLE_RELAXED
787 // CPX_STAT_INFEASIBLE
788 // CPX_STAT_INForUNBD
791 // CPX_STAT_OPTIMAL_FACE_UNBOUNDED
792 // CPX_STAT_OPTIMAL_INFEAS
793 // CPX_STAT_OPTIMAL_RELAXED
794 // CPX_STAT_UNBOUNDED
796 CplexLp::ProblemType CplexLp::_getDualType() const {
797 int stat = CPXgetstat(cplexEnv(), _prob);
798 #if CPX_VERSION >= 800
800 case CPX_STAT_OPTIMAL:
802 case CPX_STAT_UNBOUNDED:
808 statusSwitch(cplexEnv(),stat);
811 return UNDEFINED; //Undefined
812 case CPX_OPTIMAL://Optimal
817 return UNDEFINED; //Everything else comes here
826 : LpBase(), MipSolver(), CplexBase() {
828 #if CPX_VERSION < 800
829 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MIP);
831 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MILP);
835 CplexMip::CplexMip(const CplexEnv& env)
836 : LpBase(), MipSolver(), CplexBase(env) {
838 #if CPX_VERSION < 800
839 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MIP);
841 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MILP);
846 CplexMip::CplexMip(const CplexMip& other)
847 : LpBase(), MipSolver(), CplexBase(other) {}
849 CplexMip::~CplexMip() {}
851 CplexMip* CplexMip::newSolver() const { return new CplexMip; }
852 CplexMip* CplexMip::cloneSolver() const {return new CplexMip(*this); }
854 const char* CplexMip::_solverName() const { return "CplexMip"; }
856 void CplexMip::_setColType(int i, CplexMip::ColTypes col_type) {
858 // Note If a variable is to be changed to binary, a call to CPXchgbds
859 // should also be made to change the bounds to 0 and 1.
864 CPXchgctype (cplexEnv(), _prob, 1, &i, &t);
868 CPXchgctype (cplexEnv(), _prob, 1, &i, &t);
875 CplexMip::ColTypes CplexMip::_getColType(int i) const {
877 CPXgetctype (cplexEnv(), _prob, &t, i, i);
884 LEMON_ASSERT(false, "Invalid column type");
890 CplexMip::SolveExitStatus CplexMip::_solve() {
892 _applyMessageLevel();
893 status = CPXmipopt (cplexEnv(), _prob);
902 CplexMip::ProblemType CplexMip::_getType() const {
904 int stat = CPXgetstat(cplexEnv(), _prob);
906 //Fortunately, MIP statuses did not change for cplex 8.0
909 // Optimal integer solution has been found.
910 case CPXMIP_OPTIMAL_TOL:
911 // Optimal soluton with the tolerance defined by epgap or epagap has
914 //This also exists in later issues
915 // case CPXMIP_UNBOUNDED:
917 case CPXMIP_INFEASIBLE:
922 //Unboundedness not treated well: the following is from cplex 9.0 doc
923 // About Unboundedness
925 // The treatment of models that are unbounded involves a few
926 // subtleties. Specifically, a declaration of unboundedness means that
927 // ILOG CPLEX has determined that the model has an unbounded
928 // ray. Given any feasible solution x with objective z, a multiple of
929 // the unbounded ray can be added to x to give a feasible solution
930 // with objective z-1 (or z+1 for maximization models). Thus, if a
931 // feasible solution exists, then the optimal objective is
932 // unbounded. Note that ILOG CPLEX has not necessarily concluded that
933 // a feasible solution exists. Users can call the routine CPXsolninfo
934 // to determine whether ILOG CPLEX has also concluded that the model
935 // has a feasible solution.
938 CplexMip::Value CplexMip::_getSol(int i) const {
940 CPXgetmipx(cplexEnv(), _prob, &x, i, i);
944 CplexMip::Value CplexMip::_getSolValue() const {
946 CPXgetmipobjval(cplexEnv(), _prob, &objval);