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");
442 void CplexBase::_messageLevel(MessageLevel level) {
444 case MESSAGE_NOTHING:
445 _message_enabled = false;
448 case MESSAGE_WARNING:
450 case MESSAGE_VERBOSE:
451 _message_enabled = true;
456 void CplexBase::_applyMessageLevel() {
457 CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND,
458 _message_enabled ? CPX_ON : CPX_OFF);
464 : LpBase(), LpSolver(), CplexBase() {}
466 CplexLp::CplexLp(const CplexEnv& env)
467 : LpBase(), LpSolver(), CplexBase(env) {}
469 CplexLp::CplexLp(const CplexLp& other)
470 : LpBase(), LpSolver(), CplexBase(other) {}
472 CplexLp::~CplexLp() {}
474 CplexLp* CplexLp::newSolver() const { return new CplexLp; }
475 CplexLp* CplexLp::cloneSolver() const {return new CplexLp(*this); }
477 const char* CplexLp::_solverName() const { return "CplexLp"; }
479 void CplexLp::_clear_temporals() {
486 // The routine returns zero unless an error occurred during the
487 // optimization. Examples of errors include exhausting available
488 // memory (CPXERR_NO_MEMORY) or encountering invalid data in the
489 // CPLEX problem object (CPXERR_NO_PROBLEM). Exceeding a
490 // user-specified CPLEX limit, or proving the model infeasible or
491 // unbounded, are not considered errors. Note that a zero return
492 // value does not necessarily mean that a solution exists. Use query
493 // routines CPXsolninfo, CPXgetstat, and CPXsolution to obtain
494 // further information about the status of the optimization.
495 CplexLp::SolveExitStatus CplexLp::convertStatus(int status) {
496 #if CPX_VERSION >= 800
498 switch (CPXgetstat(cplexEnv(), _prob)) {
499 case CPX_STAT_OPTIMAL:
500 case CPX_STAT_INFEASIBLE:
501 case CPX_STAT_UNBOUNDED:
511 //We want to exclude some cases
512 switch (CPXgetstat(cplexEnv(), _prob)) {
514 case CPX_IT_LIM_FEAS:
515 case CPX_IT_LIM_INFEAS:
516 case CPX_TIME_LIM_FEAS:
517 case CPX_TIME_LIM_INFEAS:
528 CplexLp::SolveExitStatus CplexLp::_solve() {
530 _applyMessageLevel();
531 return convertStatus(CPXlpopt(cplexEnv(), _prob));
534 CplexLp::SolveExitStatus CplexLp::solvePrimal() {
536 _applyMessageLevel();
537 return convertStatus(CPXprimopt(cplexEnv(), _prob));
540 CplexLp::SolveExitStatus CplexLp::solveDual() {
542 _applyMessageLevel();
543 return convertStatus(CPXdualopt(cplexEnv(), _prob));
546 CplexLp::SolveExitStatus CplexLp::solveBarrier() {
548 _applyMessageLevel();
549 return convertStatus(CPXbaropt(cplexEnv(), _prob));
552 CplexLp::Value CplexLp::_getPrimal(int i) const {
554 CPXgetx(cplexEnv(), _prob, &x, i, i);
558 CplexLp::Value CplexLp::_getDual(int i) const {
560 CPXgetpi(cplexEnv(), _prob, &y, i, i);
564 CplexLp::Value CplexLp::_getPrimalValue() const {
566 CPXgetobjval(cplexEnv(), _prob, &objval);
570 CplexLp::VarStatus CplexLp::_getColStatus(int i) const {
571 if (_col_status.empty()) {
572 _col_status.resize(CPXgetnumcols(cplexEnv(), _prob));
573 CPXgetbase(cplexEnv(), _prob, &_col_status.front(), 0);
575 switch (_col_status[i]) {
585 LEMON_ASSERT(false, "Wrong column status");
586 return CplexLp::VarStatus();
590 CplexLp::VarStatus CplexLp::_getRowStatus(int i) const {
591 if (_row_status.empty()) {
592 _row_status.resize(CPXgetnumrows(cplexEnv(), _prob));
593 CPXgetbase(cplexEnv(), _prob, 0, &_row_status.front());
595 switch (_row_status[i]) {
601 CPXgetsense(cplexEnv(), _prob, &s, i, i);
602 return s != 'L' ? LOWER : UPPER;
607 LEMON_ASSERT(false, "Wrong row status");
608 return CplexLp::VarStatus();
612 CplexLp::Value CplexLp::_getPrimalRay(int i) const {
613 if (_primal_ray.empty()) {
614 _primal_ray.resize(CPXgetnumcols(cplexEnv(), _prob));
615 CPXgetray(cplexEnv(), _prob, &_primal_ray.front());
617 return _primal_ray[i];
620 CplexLp::Value CplexLp::_getDualRay(int i) const {
621 if (_dual_ray.empty()) {
627 // Cplex 7.0 status values
628 // This table lists the statuses, returned by the CPXgetstat()
629 // routine, for solutions to LP problems or mixed integer problems. If
630 // no solution exists, the return value is zero.
632 // For Simplex, Barrier
634 // Optimal solution found
636 // Problem infeasible
640 // Objective limit exceeded in Phase II
642 // Iteration limit exceeded in Phase II
643 // 6 CPX_IT_LIM_INFEAS
644 // Iteration limit exceeded in Phase I
645 // 7 CPX_TIME_LIM_FEAS
646 // Time limit exceeded in Phase II
647 // 8 CPX_TIME_LIM_INFEAS
648 // Time limit exceeded in Phase I
649 // 9 CPX_NUM_BEST_FEAS
650 // Problem non-optimal, singularities in Phase II
651 // 10 CPX_NUM_BEST_INFEAS
652 // Problem non-optimal, singularities in Phase I
653 // 11 CPX_OPTIMAL_INFEAS
654 // Optimal solution found, unscaled infeasibilities
656 // Aborted in Phase II
657 // 13 CPX_ABORT_INFEAS
658 // Aborted in Phase I
659 // 14 CPX_ABORT_DUAL_INFEAS
660 // Aborted in barrier, dual infeasible
661 // 15 CPX_ABORT_PRIM_INFEAS
662 // Aborted in barrier, primal infeasible
663 // 16 CPX_ABORT_PRIM_DUAL_INFEAS
664 // Aborted in barrier, primal and dual infeasible
665 // 17 CPX_ABORT_PRIM_DUAL_FEAS
666 // Aborted in barrier, primal and dual feasible
667 // 18 CPX_ABORT_CROSSOVER
668 // Aborted in crossover
670 // Infeasible or unbounded
674 // Pending return values
675 // ??case CPX_ABORT_DUAL_INFEAS
676 // ??case CPX_ABORT_CROSSOVER
677 // ??case CPX_INForUNBD
680 //Some more interesting stuff:
682 // CPX_PARAM_PROBMETHOD 1062 int LPMETHOD
687 // 4 Standard Barrier
689 // Description: Method for linear optimization.
690 // Determines which algorithm is used when CPXlpopt() (or "optimize"
691 // in the Interactive Optimizer) is called. Currently the behavior of
692 // the "Automatic" setting is that CPLEX simply invokes the dual
693 // simplex method, but this capability may be expanded in the future
694 // so that CPLEX chooses the method based on problem characteristics
695 #if CPX_VERSION < 900
696 void statusSwitch(CPXENVptr cplexEnv(),int& stat){
698 CPXgetintparam (cplexEnv(),CPX_PARAM_PROBMETHOD,&lpmethod);
700 if (stat==CPX_UNBOUNDED){
704 if (stat==CPX_INFEASIBLE)
710 void statusSwitch(CPXENVptr,int&){}
713 CplexLp::ProblemType CplexLp::_getPrimalType() const {
714 // Unboundedness not treated well: the following is from cplex 9.0 doc
715 // About Unboundedness
717 // The treatment of models that are unbounded involves a few
718 // subtleties. Specifically, a declaration of unboundedness means that
719 // ILOG CPLEX has determined that the model has an unbounded
720 // ray. Given any feasible solution x with objective z, a multiple of
721 // the unbounded ray can be added to x to give a feasible solution
722 // with objective z-1 (or z+1 for maximization models). Thus, if a
723 // feasible solution exists, then the optimal objective is
724 // unbounded. Note that ILOG CPLEX has not necessarily concluded that
725 // a feasible solution exists. Users can call the routine CPXsolninfo
726 // to determine whether ILOG CPLEX has also concluded that the model
727 // has a feasible solution.
729 int stat = CPXgetstat(cplexEnv(), _prob);
730 #if CPX_VERSION >= 800
733 case CPX_STAT_OPTIMAL:
735 case CPX_STAT_UNBOUNDED:
737 case CPX_STAT_INFEASIBLE:
743 statusSwitch(cplexEnv(),stat);
744 //CPXgetstat(cplexEnv(), _prob);
747 return UNDEFINED; //Undefined
748 case CPX_OPTIMAL://Optimal
750 case CPX_UNBOUNDED://Unbounded
751 return INFEASIBLE;//In case of dual simplex
753 case CPX_INFEASIBLE://Infeasible
754 // case CPX_IT_LIM_INFEAS:
755 // case CPX_TIME_LIM_INFEAS:
756 // case CPX_NUM_BEST_INFEAS:
757 // case CPX_OPTIMAL_INFEAS:
758 // case CPX_ABORT_INFEAS:
759 // case CPX_ABORT_PRIM_INFEAS:
760 // case CPX_ABORT_PRIM_DUAL_INFEAS:
761 return UNBOUNDED;//In case of dual simplex
764 // case CPX_IT_LIM_FEAS:
765 // case CPX_TIME_LIM_FEAS:
766 // case CPX_NUM_BEST_FEAS:
767 // case CPX_ABORT_FEAS:
768 // case CPX_ABORT_PRIM_DUAL_FEAS:
771 return UNDEFINED; //Everything else comes here
777 // Cplex 9.0 status values
778 // CPX_STAT_ABORT_DUAL_OBJ_LIM
779 // CPX_STAT_ABORT_IT_LIM
780 // CPX_STAT_ABORT_OBJ_LIM
781 // CPX_STAT_ABORT_PRIM_OBJ_LIM
782 // CPX_STAT_ABORT_TIME_LIM
783 // CPX_STAT_ABORT_USER
784 // CPX_STAT_FEASIBLE_RELAXED
785 // CPX_STAT_INFEASIBLE
786 // CPX_STAT_INForUNBD
789 // CPX_STAT_OPTIMAL_FACE_UNBOUNDED
790 // CPX_STAT_OPTIMAL_INFEAS
791 // CPX_STAT_OPTIMAL_RELAXED
792 // CPX_STAT_UNBOUNDED
794 CplexLp::ProblemType CplexLp::_getDualType() const {
795 int stat = CPXgetstat(cplexEnv(), _prob);
796 #if CPX_VERSION >= 800
798 case CPX_STAT_OPTIMAL:
800 case CPX_STAT_UNBOUNDED:
806 statusSwitch(cplexEnv(),stat);
809 return UNDEFINED; //Undefined
810 case CPX_OPTIMAL://Optimal
815 return UNDEFINED; //Everything else comes here
824 : LpBase(), MipSolver(), CplexBase() {
826 #if CPX_VERSION < 800
827 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MIP);
829 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MILP);
833 CplexMip::CplexMip(const CplexEnv& env)
834 : LpBase(), MipSolver(), CplexBase(env) {
836 #if CPX_VERSION < 800
837 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MIP);
839 CPXchgprobtype(cplexEnv(), _prob, CPXPROB_MILP);
844 CplexMip::CplexMip(const CplexMip& other)
845 : LpBase(), MipSolver(), CplexBase(other) {}
847 CplexMip::~CplexMip() {}
849 CplexMip* CplexMip::newSolver() const { return new CplexMip; }
850 CplexMip* CplexMip::cloneSolver() const {return new CplexMip(*this); }
852 const char* CplexMip::_solverName() const { return "CplexMip"; }
854 void CplexMip::_setColType(int i, CplexMip::ColTypes col_type) {
856 // Note If a variable is to be changed to binary, a call to CPXchgbds
857 // should also be made to change the bounds to 0 and 1.
862 CPXchgctype (cplexEnv(), _prob, 1, &i, &t);
866 CPXchgctype (cplexEnv(), _prob, 1, &i, &t);
873 CplexMip::ColTypes CplexMip::_getColType(int i) const {
875 CPXgetctype (cplexEnv(), _prob, &t, i, i);
882 LEMON_ASSERT(false, "Invalid column type");
888 CplexMip::SolveExitStatus CplexMip::_solve() {
890 _applyMessageLevel();
891 status = CPXmipopt (cplexEnv(), _prob);
900 CplexMip::ProblemType CplexMip::_getType() const {
902 int stat = CPXgetstat(cplexEnv(), _prob);
904 //Fortunately, MIP statuses did not change for cplex 8.0
907 // Optimal integer solution has been found.
908 case CPXMIP_OPTIMAL_TOL:
909 // Optimal soluton with the tolerance defined by epgap or epagap has
912 //This also exists in later issues
913 // case CPXMIP_UNBOUNDED:
915 case CPXMIP_INFEASIBLE:
920 //Unboundedness not treated well: the following is from cplex 9.0 doc
921 // About Unboundedness
923 // The treatment of models that are unbounded involves a few
924 // subtleties. Specifically, a declaration of unboundedness means that
925 // ILOG CPLEX has determined that the model has an unbounded
926 // ray. Given any feasible solution x with objective z, a multiple of
927 // the unbounded ray can be added to x to give a feasible solution
928 // with objective z-1 (or z+1 for maximization models). Thus, if a
929 // feasible solution exists, then the optimal objective is
930 // unbounded. Note that ILOG CPLEX has not necessarily concluded that
931 // a feasible solution exists. Users can call the routine CPXsolninfo
932 // to determine whether ILOG CPLEX has also concluded that the model
933 // has a feasible solution.
936 CplexMip::Value CplexMip::_getSol(int i) const {
938 CPXgetmipx(cplexEnv(), _prob, &x, i, i);
942 CplexMip::Value CplexMip::_getSolValue() const {
944 CPXgetmipobjval(cplexEnv(), _prob, &objval);