gravatar
deba@inf.elte.hu
deba@inf.elte.hu
Silent glp_adv_basis() (#255)
0 1 0
default
1 file changed with 6 insertions and 3 deletions:
↑ Collapse diff ↑
Ignore white space 64 line context
... ...
@@ -557,108 +557,110 @@
557 557
  }
558 558

	
559 559
  GlpkLp::SolveExitStatus GlpkLp::solvePrimal() {
560 560
    _clear_temporals();
561 561

	
562 562
    glp_smcp smcp;
563 563
    glp_init_smcp(&smcp);
564 564

	
565 565
    switch (_message_level) {
566 566
    case MESSAGE_NO_OUTPUT:
567 567
      smcp.msg_lev = GLP_MSG_OFF;
568 568
      break;
569 569
    case MESSAGE_ERROR_MESSAGE:
570 570
      smcp.msg_lev = GLP_MSG_ERR;
571 571
      break;
572 572
    case MESSAGE_NORMAL_OUTPUT:
573 573
      smcp.msg_lev = GLP_MSG_ON;
574 574
      break;
575 575
    case MESSAGE_FULL_OUTPUT:
576 576
      smcp.msg_lev = GLP_MSG_ALL;
577 577
      break;
578 578
    }
579 579
    smcp.presolve = _presolve;
580 580

	
581 581
    // If the basis is not valid we get an error return value.
582 582
    // In this case we can try to create a new basis.
583 583
    switch (glp_simplex(lp, &smcp)) {
584 584
    case 0:
585 585
      break;
586 586
    case GLP_EBADB:
587 587
    case GLP_ESING:
588 588
    case GLP_ECOND:
589
      lpx_set_int_parm(lp, LPX_K_MSGLEV, smcp.msg_lev);
589
      glp_term_out(false);
590 590
      glp_adv_basis(lp, 0);
591
      glp_term_out(true);
591 592
      if (glp_simplex(lp, &smcp) != 0) return UNSOLVED;
592 593
      break;
593 594
    default:
594 595
      return UNSOLVED;
595 596
    }
596 597

	
597 598
    return SOLVED;
598 599
  }
599 600

	
600 601
  GlpkLp::SolveExitStatus GlpkLp::solveDual() {
601 602
    _clear_temporals();
602 603

	
603 604
    glp_smcp smcp;
604 605
    glp_init_smcp(&smcp);
605 606

	
606 607
    switch (_message_level) {
607 608
    case MESSAGE_NO_OUTPUT:
608 609
      smcp.msg_lev = GLP_MSG_OFF;
609 610
      break;
610 611
    case MESSAGE_ERROR_MESSAGE:
611 612
      smcp.msg_lev = GLP_MSG_ERR;
612 613
      break;
613 614
    case MESSAGE_NORMAL_OUTPUT:
614 615
      smcp.msg_lev = GLP_MSG_ON;
615 616
      break;
616 617
    case MESSAGE_FULL_OUTPUT:
617 618
      smcp.msg_lev = GLP_MSG_ALL;
618 619
      break;
619 620
    }
620 621
    smcp.meth = GLP_DUAL;
621 622
    smcp.presolve = _presolve;
622 623

	
623 624
    // If the basis is not valid we get an error return value.
624 625
    // In this case we can try to create a new basis.
625 626
    switch (glp_simplex(lp, &smcp)) {
626 627
    case 0:
627 628
      break;
628 629
    case GLP_EBADB:
629 630
    case GLP_ESING:
630 631
    case GLP_ECOND:
631
      lpx_set_int_parm(lp, LPX_K_MSGLEV, smcp.msg_lev);
632
      glp_term_out(false);
632 633
      glp_adv_basis(lp, 0);
634
      glp_term_out(true);
633 635
      if (glp_simplex(lp, &smcp) != 0) return UNSOLVED;
634 636
      break;
635 637
    default:
636 638
      return UNSOLVED;
637 639
    }
638 640
    return SOLVED;
639 641
  }
640 642

	
641 643
  GlpkLp::Value GlpkLp::_getPrimal(int i) const {
642 644
    return glp_get_col_prim(lp, i);
643 645
  }
644 646

	
645 647
  GlpkLp::Value GlpkLp::_getDual(int i) const {
646 648
    return glp_get_row_dual(lp, i);
647 649
  }
648 650

	
649 651
  GlpkLp::Value GlpkLp::_getPrimalValue() const {
650 652
    return glp_get_obj_val(lp);
651 653
  }
652 654

	
653 655
  GlpkLp::VarStatus GlpkLp::_getColStatus(int i) const {
654 656
    switch (glp_get_col_stat(lp, i)) {
655 657
    case GLP_BS:
656 658
      return BASIC;
657 659
    case GLP_UP:
658 660
      return UPPER;
659 661
    case GLP_LO:
660 662
      return LOWER;
661 663
    case GLP_NF:
662 664
      return FREE;
663 665
    case GLP_NS:
664 666
      return FIXED;
... ...
@@ -893,66 +895,67 @@
893 895
    }
894 896

	
895 897
  }
896 898

	
897 899
  GlpkMip::SolveExitStatus GlpkMip::_solve() {
898 900
    glp_smcp smcp;
899 901
    glp_init_smcp(&smcp);
900 902

	
901 903
    switch (_message_level) {
902 904
    case MESSAGE_NO_OUTPUT:
903 905
      smcp.msg_lev = GLP_MSG_OFF;
904 906
      break;
905 907
    case MESSAGE_ERROR_MESSAGE:
906 908
      smcp.msg_lev = GLP_MSG_ERR;
907 909
      break;
908 910
    case MESSAGE_NORMAL_OUTPUT:
909 911
      smcp.msg_lev = GLP_MSG_ON;
910 912
      break;
911 913
    case MESSAGE_FULL_OUTPUT:
912 914
      smcp.msg_lev = GLP_MSG_ALL;
913 915
      break;
914 916
    }
915 917
    smcp.meth = GLP_DUAL;
916 918

	
917 919
    // If the basis is not valid we get an error return value.
918 920
    // In this case we can try to create a new basis.
919 921
    switch (glp_simplex(lp, &smcp)) {
920 922
    case 0:
921 923
      break;
922 924
    case GLP_EBADB:
923 925
    case GLP_ESING:
924 926
    case GLP_ECOND:
925
      lpx_set_int_parm(lp, LPX_K_MSGLEV, smcp.msg_lev);
927
      glp_term_out(false);
926 928
      glp_adv_basis(lp, 0);
929
      glp_term_out(true);
927 930
      if (glp_simplex(lp, &smcp) != 0) return UNSOLVED;
928 931
      break;
929 932
    default:
930 933
      return UNSOLVED;
931 934
    }
932 935

	
933 936
    if (glp_get_status(lp) != GLP_OPT) return SOLVED;
934 937

	
935 938
    glp_iocp iocp;
936 939
    glp_init_iocp(&iocp);
937 940

	
938 941
    switch (_message_level) {
939 942
    case MESSAGE_NO_OUTPUT:
940 943
      iocp.msg_lev = GLP_MSG_OFF;
941 944
      break;
942 945
    case MESSAGE_ERROR_MESSAGE:
943 946
      iocp.msg_lev = GLP_MSG_ERR;
944 947
      break;
945 948
    case MESSAGE_NORMAL_OUTPUT:
946 949
      iocp.msg_lev = GLP_MSG_ON;
947 950
      break;
948 951
    case MESSAGE_FULL_OUTPUT:
949 952
      iocp.msg_lev = GLP_MSG_ALL;
950 953
      break;
951 954
    }
952 955

	
953 956
    if (glp_intopt(lp, &iocp) != 0) return UNSOLVED;
954 957
    return SOLVED;
955 958
  }
956 959

	
957 960

	
958 961
  GlpkMip::ProblemType GlpkMip::_getType() const {
0 comments (0 inline)