You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

706 lines
22 KiB

  1. /* glpapi13.c (branch-and-bound interface routines) */
  2. /***********************************************************************
  3. * This code is part of GLPK (GNU Linear Programming Kit).
  4. *
  5. * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
  6. * 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied
  7. * Informatics, Moscow Aviation Institute, Moscow, Russia. All rights
  8. * reserved. E-mail: <mao@gnu.org>.
  9. *
  10. * GLPK is free software: you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * GLPK is distributed in the hope that it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  17. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  18. * License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
  22. ***********************************************************************/
  23. #include "env.h"
  24. #include "glpios.h"
  25. /***********************************************************************
  26. * NAME
  27. *
  28. * glp_ios_reason - determine reason for calling the callback routine
  29. *
  30. * SYNOPSIS
  31. *
  32. * glp_ios_reason(glp_tree *tree);
  33. *
  34. * RETURNS
  35. *
  36. * The routine glp_ios_reason returns a code, which indicates why the
  37. * user-defined callback routine is being called. */
  38. int glp_ios_reason(glp_tree *tree)
  39. { return
  40. tree->reason;
  41. }
  42. /***********************************************************************
  43. * NAME
  44. *
  45. * glp_ios_get_prob - access the problem object
  46. *
  47. * SYNOPSIS
  48. *
  49. * glp_prob *glp_ios_get_prob(glp_tree *tree);
  50. *
  51. * DESCRIPTION
  52. *
  53. * The routine glp_ios_get_prob can be called from the user-defined
  54. * callback routine to access the problem object, which is used by the
  55. * MIP solver. It is the original problem object passed to the routine
  56. * glp_intopt if the MIP presolver is not used; otherwise it is an
  57. * internal problem object built by the presolver. If the current
  58. * subproblem exists, LP segment of the problem object corresponds to
  59. * its LP relaxation.
  60. *
  61. * RETURNS
  62. *
  63. * The routine glp_ios_get_prob returns a pointer to the problem object
  64. * used by the MIP solver. */
  65. glp_prob *glp_ios_get_prob(glp_tree *tree)
  66. { return
  67. tree->mip;
  68. }
  69. /***********************************************************************
  70. * NAME
  71. *
  72. * glp_ios_tree_size - determine size of the branch-and-bound tree
  73. *
  74. * SYNOPSIS
  75. *
  76. * void glp_ios_tree_size(glp_tree *tree, int *a_cnt, int *n_cnt,
  77. * int *t_cnt);
  78. *
  79. * DESCRIPTION
  80. *
  81. * The routine glp_ios_tree_size stores the following three counts which
  82. * characterize the current size of the branch-and-bound tree:
  83. *
  84. * a_cnt is the current number of active nodes, i.e. the current size of
  85. * the active list;
  86. *
  87. * n_cnt is the current number of all (active and inactive) nodes;
  88. *
  89. * t_cnt is the total number of nodes including those which have been
  90. * already removed from the tree. This count is increased whenever
  91. * a new node appears in the tree and never decreased.
  92. *
  93. * If some of the parameters a_cnt, n_cnt, t_cnt is a null pointer, the
  94. * corresponding count is not stored. */
  95. void glp_ios_tree_size(glp_tree *tree, int *a_cnt, int *n_cnt,
  96. int *t_cnt)
  97. { if (a_cnt != NULL) *a_cnt = tree->a_cnt;
  98. if (n_cnt != NULL) *n_cnt = tree->n_cnt;
  99. if (t_cnt != NULL) *t_cnt = tree->t_cnt;
  100. return;
  101. }
  102. /***********************************************************************
  103. * NAME
  104. *
  105. * glp_ios_curr_node - determine current active subproblem
  106. *
  107. * SYNOPSIS
  108. *
  109. * int glp_ios_curr_node(glp_tree *tree);
  110. *
  111. * RETURNS
  112. *
  113. * The routine glp_ios_curr_node returns the reference number of the
  114. * current active subproblem. However, if the current subproblem does
  115. * not exist, the routine returns zero. */
  116. int glp_ios_curr_node(glp_tree *tree)
  117. { IOSNPD *node;
  118. /* obtain pointer to the current subproblem */
  119. node = tree->curr;
  120. /* return its reference number */
  121. return node == NULL ? 0 : node->p;
  122. }
  123. /***********************************************************************
  124. * NAME
  125. *
  126. * glp_ios_next_node - determine next active subproblem
  127. *
  128. * SYNOPSIS
  129. *
  130. * int glp_ios_next_node(glp_tree *tree, int p);
  131. *
  132. * RETURNS
  133. *
  134. * If the parameter p is zero, the routine glp_ios_next_node returns
  135. * the reference number of the first active subproblem. However, if the
  136. * tree is empty, zero is returned.
  137. *
  138. * If the parameter p is not zero, it must specify the reference number
  139. * of some active subproblem, in which case the routine returns the
  140. * reference number of the next active subproblem. However, if there is
  141. * no next active subproblem in the list, zero is returned.
  142. *
  143. * All subproblems in the active list are ordered chronologically, i.e.
  144. * subproblem A precedes subproblem B if A was created before B. */
  145. int glp_ios_next_node(glp_tree *tree, int p)
  146. { IOSNPD *node;
  147. if (p == 0)
  148. { /* obtain pointer to the first active subproblem */
  149. node = tree->head;
  150. }
  151. else
  152. { /* obtain pointer to the specified subproblem */
  153. if (!(1 <= p && p <= tree->nslots))
  154. err: xerror("glp_ios_next_node: p = %d; invalid subproblem refer"
  155. "ence number\n", p);
  156. node = tree->slot[p].node;
  157. if (node == NULL) goto err;
  158. /* the specified subproblem must be active */
  159. if (node->count != 0)
  160. xerror("glp_ios_next_node: p = %d; subproblem not in the ac"
  161. "tive list\n", p);
  162. /* obtain pointer to the next active subproblem */
  163. node = node->next;
  164. }
  165. /* return the reference number */
  166. return node == NULL ? 0 : node->p;
  167. }
  168. /***********************************************************************
  169. * NAME
  170. *
  171. * glp_ios_prev_node - determine previous active subproblem
  172. *
  173. * SYNOPSIS
  174. *
  175. * int glp_ios_prev_node(glp_tree *tree, int p);
  176. *
  177. * RETURNS
  178. *
  179. * If the parameter p is zero, the routine glp_ios_prev_node returns
  180. * the reference number of the last active subproblem. However, if the
  181. * tree is empty, zero is returned.
  182. *
  183. * If the parameter p is not zero, it must specify the reference number
  184. * of some active subproblem, in which case the routine returns the
  185. * reference number of the previous active subproblem. However, if there
  186. * is no previous active subproblem in the list, zero is returned.
  187. *
  188. * All subproblems in the active list are ordered chronologically, i.e.
  189. * subproblem A precedes subproblem B if A was created before B. */
  190. int glp_ios_prev_node(glp_tree *tree, int p)
  191. { IOSNPD *node;
  192. if (p == 0)
  193. { /* obtain pointer to the last active subproblem */
  194. node = tree->tail;
  195. }
  196. else
  197. { /* obtain pointer to the specified subproblem */
  198. if (!(1 <= p && p <= tree->nslots))
  199. err: xerror("glp_ios_prev_node: p = %d; invalid subproblem refer"
  200. "ence number\n", p);
  201. node = tree->slot[p].node;
  202. if (node == NULL) goto err;
  203. /* the specified subproblem must be active */
  204. if (node->count != 0)
  205. xerror("glp_ios_prev_node: p = %d; subproblem not in the ac"
  206. "tive list\n", p);
  207. /* obtain pointer to the previous active subproblem */
  208. node = node->prev;
  209. }
  210. /* return the reference number */
  211. return node == NULL ? 0 : node->p;
  212. }
  213. /***********************************************************************
  214. * NAME
  215. *
  216. * glp_ios_up_node - determine parent subproblem
  217. *
  218. * SYNOPSIS
  219. *
  220. * int glp_ios_up_node(glp_tree *tree, int p);
  221. *
  222. * RETURNS
  223. *
  224. * The parameter p must specify the reference number of some (active or
  225. * inactive) subproblem, in which case the routine iet_get_up_node
  226. * returns the reference number of its parent subproblem. However, if
  227. * the specified subproblem is the root of the tree and, therefore, has
  228. * no parent, the routine returns zero. */
  229. int glp_ios_up_node(glp_tree *tree, int p)
  230. { IOSNPD *node;
  231. /* obtain pointer to the specified subproblem */
  232. if (!(1 <= p && p <= tree->nslots))
  233. err: xerror("glp_ios_up_node: p = %d; invalid subproblem reference "
  234. "number\n", p);
  235. node = tree->slot[p].node;
  236. if (node == NULL) goto err;
  237. /* obtain pointer to the parent subproblem */
  238. node = node->up;
  239. /* return the reference number */
  240. return node == NULL ? 0 : node->p;
  241. }
  242. /***********************************************************************
  243. * NAME
  244. *
  245. * glp_ios_node_level - determine subproblem level
  246. *
  247. * SYNOPSIS
  248. *
  249. * int glp_ios_node_level(glp_tree *tree, int p);
  250. *
  251. * RETURNS
  252. *
  253. * The routine glp_ios_node_level returns the level of the subproblem,
  254. * whose reference number is p, in the branch-and-bound tree. (The root
  255. * subproblem has level 0, and the level of any other subproblem is the
  256. * level of its parent plus one.) */
  257. int glp_ios_node_level(glp_tree *tree, int p)
  258. { IOSNPD *node;
  259. /* obtain pointer to the specified subproblem */
  260. if (!(1 <= p && p <= tree->nslots))
  261. err: xerror("glp_ios_node_level: p = %d; invalid subproblem referen"
  262. "ce number\n", p);
  263. node = tree->slot[p].node;
  264. if (node == NULL) goto err;
  265. /* return the node level */
  266. return node->level;
  267. }
  268. /***********************************************************************
  269. * NAME
  270. *
  271. * glp_ios_node_bound - determine subproblem local bound
  272. *
  273. * SYNOPSIS
  274. *
  275. * double glp_ios_node_bound(glp_tree *tree, int p);
  276. *
  277. * RETURNS
  278. *
  279. * The routine glp_ios_node_bound returns the local bound for (active or
  280. * inactive) subproblem, whose reference number is p.
  281. *
  282. * COMMENTS
  283. *
  284. * The local bound for subproblem p is an lower (minimization) or upper
  285. * (maximization) bound for integer optimal solution to this subproblem
  286. * (not to the original problem). This bound is local in the sense that
  287. * only subproblems in the subtree rooted at node p cannot have better
  288. * integer feasible solutions.
  289. *
  290. * On creating a subproblem (due to the branching step) its local bound
  291. * is inherited from its parent and then may get only stronger (never
  292. * weaker). For the root subproblem its local bound is initially set to
  293. * -DBL_MAX (minimization) or +DBL_MAX (maximization) and then improved
  294. * as the root LP relaxation has been solved.
  295. *
  296. * Note that the local bound is not necessarily the optimal objective
  297. * value to corresponding LP relaxation; it may be stronger. */
  298. double glp_ios_node_bound(glp_tree *tree, int p)
  299. { IOSNPD *node;
  300. /* obtain pointer to the specified subproblem */
  301. if (!(1 <= p && p <= tree->nslots))
  302. err: xerror("glp_ios_node_bound: p = %d; invalid subproblem referen"
  303. "ce number\n", p);
  304. node = tree->slot[p].node;
  305. if (node == NULL) goto err;
  306. /* return the node local bound */
  307. return node->bound;
  308. }
  309. /***********************************************************************
  310. * NAME
  311. *
  312. * glp_ios_best_node - find active subproblem with best local bound
  313. *
  314. * SYNOPSIS
  315. *
  316. * int glp_ios_best_node(glp_tree *tree);
  317. *
  318. * RETURNS
  319. *
  320. * The routine glp_ios_best_node returns the reference number of the
  321. * active subproblem, whose local bound is best (i.e. smallest in case
  322. * of minimization or largest in case of maximization). However, if the
  323. * tree is empty, the routine returns zero.
  324. *
  325. * COMMENTS
  326. *
  327. * The best local bound is an lower (minimization) or upper
  328. * (maximization) bound for integer optimal solution to the original
  329. * MIP problem. */
  330. int glp_ios_best_node(glp_tree *tree)
  331. { return
  332. ios_best_node(tree);
  333. }
  334. /***********************************************************************
  335. * NAME
  336. *
  337. * glp_ios_mip_gap - compute relative MIP gap
  338. *
  339. * SYNOPSIS
  340. *
  341. * double glp_ios_mip_gap(glp_tree *tree);
  342. *
  343. * DESCRIPTION
  344. *
  345. * The routine glp_ios_mip_gap computes the relative MIP gap with the
  346. * following formula:
  347. *
  348. * gap = |best_mip - best_bnd| / (|best_mip| + DBL_EPSILON),
  349. *
  350. * where best_mip is the best integer feasible solution found so far,
  351. * best_bnd is the best (global) bound. If no integer feasible solution
  352. * has been found yet, gap is set to DBL_MAX.
  353. *
  354. * RETURNS
  355. *
  356. * The routine glp_ios_mip_gap returns the relative MIP gap. */
  357. double glp_ios_mip_gap(glp_tree *tree)
  358. { return
  359. ios_relative_gap(tree);
  360. }
  361. /***********************************************************************
  362. * NAME
  363. *
  364. * glp_ios_node_data - access subproblem application-specific data
  365. *
  366. * SYNOPSIS
  367. *
  368. * void *glp_ios_node_data(glp_tree *tree, int p);
  369. *
  370. * DESCRIPTION
  371. *
  372. * The routine glp_ios_node_data allows the application accessing a
  373. * memory block allocated for the subproblem (which may be active or
  374. * inactive), whose reference number is p.
  375. *
  376. * The size of the block is defined by the control parameter cb_size
  377. * passed to the routine glp_intopt. The block is initialized by binary
  378. * zeros on creating corresponding subproblem, and its contents is kept
  379. * until the subproblem will be removed from the tree.
  380. *
  381. * The application may use these memory blocks to store specific data
  382. * for each subproblem.
  383. *
  384. * RETURNS
  385. *
  386. * The routine glp_ios_node_data returns a pointer to the memory block
  387. * for the specified subproblem. Note that if cb_size = 0, the routine
  388. * returns a null pointer. */
  389. void *glp_ios_node_data(glp_tree *tree, int p)
  390. { IOSNPD *node;
  391. /* obtain pointer to the specified subproblem */
  392. if (!(1 <= p && p <= tree->nslots))
  393. err: xerror("glp_ios_node_level: p = %d; invalid subproblem referen"
  394. "ce number\n", p);
  395. node = tree->slot[p].node;
  396. if (node == NULL) goto err;
  397. /* return pointer to the application-specific data */
  398. return node->data;
  399. }
  400. /***********************************************************************
  401. * NAME
  402. *
  403. * glp_ios_row_attr - retrieve additional row attributes
  404. *
  405. * SYNOPSIS
  406. *
  407. * void glp_ios_row_attr(glp_tree *tree, int i, glp_attr *attr);
  408. *
  409. * DESCRIPTION
  410. *
  411. * The routine glp_ios_row_attr retrieves additional attributes of row
  412. * i and stores them in the structure glp_attr. */
  413. void glp_ios_row_attr(glp_tree *tree, int i, glp_attr *attr)
  414. { GLPROW *row;
  415. if (!(1 <= i && i <= tree->mip->m))
  416. xerror("glp_ios_row_attr: i = %d; row number out of range\n",
  417. i);
  418. row = tree->mip->row[i];
  419. attr->level = row->level;
  420. attr->origin = row->origin;
  421. attr->klass = row->klass;
  422. return;
  423. }
  424. /**********************************************************************/
  425. int glp_ios_pool_size(glp_tree *tree)
  426. { /* determine current size of the cut pool */
  427. if (tree->reason != GLP_ICUTGEN)
  428. xerror("glp_ios_pool_size: operation not allowed\n");
  429. xassert(tree->local != NULL);
  430. return tree->local->size;
  431. }
  432. /**********************************************************************/
  433. int glp_ios_add_row(glp_tree *tree,
  434. const char *name, int klass, int flags, int len, const int ind[],
  435. const double val[], int type, double rhs)
  436. { /* add row (constraint) to the cut pool */
  437. int num;
  438. if (tree->reason != GLP_ICUTGEN)
  439. xerror("glp_ios_add_row: operation not allowed\n");
  440. xassert(tree->local != NULL);
  441. num = ios_add_row(tree, tree->local, name, klass, flags, len,
  442. ind, val, type, rhs);
  443. return num;
  444. }
  445. /**********************************************************************/
  446. void glp_ios_del_row(glp_tree *tree, int i)
  447. { /* remove row (constraint) from the cut pool */
  448. if (tree->reason != GLP_ICUTGEN)
  449. xerror("glp_ios_del_row: operation not allowed\n");
  450. ios_del_row(tree, tree->local, i);
  451. return;
  452. }
  453. /**********************************************************************/
  454. void glp_ios_clear_pool(glp_tree *tree)
  455. { /* remove all rows (constraints) from the cut pool */
  456. if (tree->reason != GLP_ICUTGEN)
  457. xerror("glp_ios_clear_pool: operation not allowed\n");
  458. ios_clear_pool(tree, tree->local);
  459. return;
  460. }
  461. /***********************************************************************
  462. * NAME
  463. *
  464. * glp_ios_can_branch - check if can branch upon specified variable
  465. *
  466. * SYNOPSIS
  467. *
  468. * int glp_ios_can_branch(glp_tree *tree, int j);
  469. *
  470. * RETURNS
  471. *
  472. * If j-th variable (column) can be used to branch upon, the routine
  473. * glp_ios_can_branch returns non-zero, otherwise zero. */
  474. int glp_ios_can_branch(glp_tree *tree, int j)
  475. { if (!(1 <= j && j <= tree->mip->n))
  476. xerror("glp_ios_can_branch: j = %d; column number out of range"
  477. "\n", j);
  478. return tree->non_int[j];
  479. }
  480. /***********************************************************************
  481. * NAME
  482. *
  483. * glp_ios_branch_upon - choose variable to branch upon
  484. *
  485. * SYNOPSIS
  486. *
  487. * void glp_ios_branch_upon(glp_tree *tree, int j, int sel);
  488. *
  489. * DESCRIPTION
  490. *
  491. * The routine glp_ios_branch_upon can be called from the user-defined
  492. * callback routine in response to the reason GLP_IBRANCH to choose a
  493. * branching variable, whose ordinal number is j. Should note that only
  494. * variables, for which the routine glp_ios_can_branch returns non-zero,
  495. * can be used to branch upon.
  496. *
  497. * The parameter sel is a flag that indicates which branch (subproblem)
  498. * should be selected next to continue the search:
  499. *
  500. * GLP_DN_BRNCH - select down-branch;
  501. * GLP_UP_BRNCH - select up-branch;
  502. * GLP_NO_BRNCH - use general selection technique. */
  503. void glp_ios_branch_upon(glp_tree *tree, int j, int sel)
  504. { if (!(1 <= j && j <= tree->mip->n))
  505. xerror("glp_ios_branch_upon: j = %d; column number out of rang"
  506. "e\n", j);
  507. if (!(sel == GLP_DN_BRNCH || sel == GLP_UP_BRNCH ||
  508. sel == GLP_NO_BRNCH))
  509. xerror("glp_ios_branch_upon: sel = %d: invalid branch selectio"
  510. "n flag\n", sel);
  511. if (!(tree->non_int[j]))
  512. xerror("glp_ios_branch_upon: j = %d; variable cannot be used t"
  513. "o branch upon\n", j);
  514. if (tree->br_var != 0)
  515. xerror("glp_ios_branch_upon: branching variable already chosen"
  516. "\n");
  517. tree->br_var = j;
  518. tree->br_sel = sel;
  519. return;
  520. }
  521. /***********************************************************************
  522. * NAME
  523. *
  524. * glp_ios_select_node - select subproblem to continue the search
  525. *
  526. * SYNOPSIS
  527. *
  528. * void glp_ios_select_node(glp_tree *tree, int p);
  529. *
  530. * DESCRIPTION
  531. *
  532. * The routine glp_ios_select_node can be called from the user-defined
  533. * callback routine in response to the reason GLP_ISELECT to select an
  534. * active subproblem, whose reference number is p. The search will be
  535. * continued from the subproblem selected. */
  536. void glp_ios_select_node(glp_tree *tree, int p)
  537. { IOSNPD *node;
  538. /* obtain pointer to the specified subproblem */
  539. if (!(1 <= p && p <= tree->nslots))
  540. err: xerror("glp_ios_select_node: p = %d; invalid subproblem refere"
  541. "nce number\n", p);
  542. node = tree->slot[p].node;
  543. if (node == NULL) goto err;
  544. /* the specified subproblem must be active */
  545. if (node->count != 0)
  546. xerror("glp_ios_select_node: p = %d; subproblem not in the act"
  547. "ive list\n", p);
  548. /* no subproblem must be selected yet */
  549. if (tree->next_p != 0)
  550. xerror("glp_ios_select_node: subproblem already selected\n");
  551. /* select the specified subproblem to continue the search */
  552. tree->next_p = p;
  553. return;
  554. }
  555. /***********************************************************************
  556. * NAME
  557. *
  558. * glp_ios_heur_sol - provide solution found by heuristic
  559. *
  560. * SYNOPSIS
  561. *
  562. * int glp_ios_heur_sol(glp_tree *tree, const double x[]);
  563. *
  564. * DESCRIPTION
  565. *
  566. * The routine glp_ios_heur_sol can be called from the user-defined
  567. * callback routine in response to the reason GLP_IHEUR to provide an
  568. * integer feasible solution found by a primal heuristic.
  569. *
  570. * Primal values of *all* variables (columns) found by the heuristic
  571. * should be placed in locations x[1], ..., x[n], where n is the number
  572. * of columns in the original problem object. Note that the routine
  573. * glp_ios_heur_sol *does not* check primal feasibility of the solution
  574. * provided.
  575. *
  576. * Using the solution passed in the array x the routine computes value
  577. * of the objective function. If the objective value is better than the
  578. * best known integer feasible solution, the routine computes values of
  579. * auxiliary variables (rows) and stores all solution components in the
  580. * problem object.
  581. *
  582. * RETURNS
  583. *
  584. * If the provided solution is accepted, the routine glp_ios_heur_sol
  585. * returns zero. Otherwise, if the provided solution is rejected, the
  586. * routine returns non-zero. */
  587. int glp_ios_heur_sol(glp_tree *tree, const double x[])
  588. { glp_prob *mip = tree->mip;
  589. int m = tree->orig_m;
  590. int n = tree->n;
  591. int i, j;
  592. double obj;
  593. xassert(mip->m >= m);
  594. xassert(mip->n == n);
  595. /* check values of integer variables and compute value of the
  596. objective function */
  597. obj = mip->c0;
  598. for (j = 1; j <= n; j++)
  599. { GLPCOL *col = mip->col[j];
  600. if (col->kind == GLP_IV)
  601. { /* provided value must be integral */
  602. if (x[j] != floor(x[j])) return 1;
  603. }
  604. obj += col->coef * x[j];
  605. }
  606. /* check if the provided solution is better than the best known
  607. integer feasible solution */
  608. if (mip->mip_stat == GLP_FEAS)
  609. { switch (mip->dir)
  610. { case GLP_MIN:
  611. if (obj >= tree->mip->mip_obj) return 1;
  612. break;
  613. case GLP_MAX:
  614. if (obj <= tree->mip->mip_obj) return 1;
  615. break;
  616. default:
  617. xassert(mip != mip);
  618. }
  619. }
  620. /* it is better; store it in the problem object */
  621. if (tree->parm->msg_lev >= GLP_MSG_ON)
  622. xprintf("Solution found by heuristic: %.12g\n", obj);
  623. mip->mip_stat = GLP_FEAS;
  624. mip->mip_obj = obj;
  625. for (j = 1; j <= n; j++)
  626. mip->col[j]->mipx = x[j];
  627. for (i = 1; i <= m; i++)
  628. { GLPROW *row = mip->row[i];
  629. GLPAIJ *aij;
  630. row->mipx = 0.0;
  631. for (aij = row->ptr; aij != NULL; aij = aij->r_next)
  632. row->mipx += aij->val * aij->col->mipx;
  633. }
  634. #if 1 /* 11/VII-2013 */
  635. ios_process_sol(tree);
  636. #endif
  637. return 0;
  638. }
  639. /***********************************************************************
  640. * NAME
  641. *
  642. * glp_ios_terminate - terminate the solution process.
  643. *
  644. * SYNOPSIS
  645. *
  646. * void glp_ios_terminate(glp_tree *tree);
  647. *
  648. * DESCRIPTION
  649. *
  650. * The routine glp_ios_terminate sets a flag indicating that the MIP
  651. * solver should prematurely terminate the search. */
  652. void glp_ios_terminate(glp_tree *tree)
  653. { if (tree->parm->msg_lev >= GLP_MSG_DBG)
  654. xprintf("The search is prematurely terminated due to applicati"
  655. "on request\n");
  656. tree->stop = 1;
  657. return;
  658. }
  659. /* eof */