Changeset 1062 for trunk


Ignore:
Timestamp:
Feb 2, 2014 10:37:58 AM (6 years ago)
Author:
pbelotti
Message:

do not fix to zero extra L1-norm variables related to ignored (multipl=0) originals; check pre-loop NLP solution for MINLP feasibility. Use BT-induced bound in MILP passed to SCIP

Location:
trunk/Couenne/src/heuristics
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Couenne/src/heuristics/CouenneFPFindSolution.cpp

    r966 r1062  
    7575
    7676      printf ("Couenne Feasibility Pump: SCIP did not return a feasible solution\n");
    77       return COIN_DBL_MAX;
     77      obj = COIN_DBL_MAX;
    7878    }
    7979  } else
  • trunk/Couenne/src/heuristics/CouenneFPSolveMILP.cpp

    r1058 r1062  
    112112    if ((compDistInt_ == FP_DIST_POST) && !postlp_)
    113113      postlp_ = createCloneMILP (this, model_, false);
     114
     115    // the bounds might have improved because of FBBT. Unless a new
     116    // MINLP solution was found (unlikely ...), this should be done only
     117    // at the first call to the FP
     118
     119    milp_ -> setColLower (problem_ -> Lb ());
     120    milp_ -> setColUpper (problem_ -> Ub ());
    114121  }
    115122
  • trunk/Couenne/src/heuristics/CouenneFPcreateMILP.cpp

    r901 r1062  
    5151    // creating LP  AND fractional variable
    5252
     53    // TODO: should this really happen? I bet no
     54
     55    //if (fp -> Problem () -> Var (j) -> Multiplicity () <= 0)
     56    //continue;
     57
    5358    bool intVar = lp -> isInteger (j);
    5459
     
    5762        (!isMILP && !intVar))
    5863      // (empty) coeff col vector, lb = 0, ub = inf, obj coeff
    59       lp -> addCol (vec, 0., (fp -> Problem () -> Var (j) -> Multiplicity () <= 0) ? 0. : COIN_DBL_MAX, 1.);
     64      lp -> addCol (vec, 0., COIN_DBL_MAX, 1.);
    6065  }
    6166
  • trunk/Couenne/src/heuristics/CouenneFPscipSolve.cpp

    r1061 r1062  
    160160          (problem_ -> Var (j) -> Multiplicity () > 0) &&
    161161          (fabs (ubs [j] - lbs [j]) > .5)) {
     162
    162163        // problem_ -> Ub  (j) - problem_ -> Lb (j) > .5) {
    163164
     
    166167        // }
    167168
    168         /* FIXME: restore
    169 
    170169        assert (fabs (lbs [j] - problem_ -> Lb (j)) < SCIPfeastol (scip));
    171170        assert (fabs (ubs [j] - problem_ -> Ub (j)) < SCIPfeastol (scip));
     
    173172
    174173        assert (nEntries <= 2*nvars - 2);
    175         */
    176174
    177175        double x_rounded = floor (x [j] + .5);
     
    434432    SCIP_CALL( SCIPwriteParams(scip, "debug.set", FALSE,TRUE) );
    435433#endif
    436           
     434     
    437435    // solve the MILP
    438436
    439437    SCIP_RETCODE retcode = SCIPsolve (scip);
     438
     439#if 0
     440    if (SCIPgetStatus (scip) == SCIP_STATUS_INFEASIBLE) {
     441
     442      // writes MILP problem and SCIP settings into a file
     443      SCIP_CALL( SCIPwriteOrigProblem(scip, "debug.lp", NULL, FALSE) );
     444      SCIP_CALL( SCIPwriteParams(scip, "debug.set", FALSE, TRUE));
     445
     446      printf ("SCIP found that the problem is infeasible, exiting\n");
     447
     448      exit (-1);
     449    }
     450#endif
    440451
    441452    if (problem_ -> Jnlst () -> ProduceOutput (Ipopt::J_WARNING, J_NLPHEURISTIC))
  • trunk/Couenne/src/heuristics/CouenneFeasPump.cpp

    r1061 r1062  
    6969    nlp_ = new CouenneTNLP (problem_);
    7070
    71   problem_ -> domain () -> push (*(problem_ -> domain () -> current ()));
     71  //problem_ -> domain () -> push (*(problem_ -> domain () -> current ()));
     72  problem_ -> domain () -> push (model_ -> solver ());
     73  // NOTE: FP should only get bounds from the current BB node
    7274
    7375  // Initial Bound Tightening: since Cbc prefers (reasonably) to call
     
    119121  problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "FP: Initial NLP... "); fflush (stdout);
    120122
    121   // Solve with original objective function
    122   ApplicationReturnStatus status = app_ -> OptimizeTNLP (nlp_);
     123
     124  // Solve with original objective function                           //       /|---------+
     125  ApplicationReturnStatus status = app_ -> OptimizeTNLP (nlp_);       //      < |   NLP   |
     126                                                                      //       \|---------+
    123127
    124128  problem_ -> Jnlst () -> Printf (J_WARNING, J_NLPHEURISTIC, "done\n"); fflush (stdout);
     
    135139  ////////////////////////////////////////////////////////////////
    136140
    137   problem_ -> domain () -> pop ();
     141  //problem_ -> domain () -> pop ();
    138142
    139143  if ((status != Solve_Succeeded) && (status != Solved_To_Acceptable_Level))
     
    187191  if (nlp_ -> getSolution ())
    188192    nSol = CoinCopyOfArray (nlp_ -> getSolution (), problem_ -> nVars ());
     193
     194  bool isNlpFeas = problem_ -> checkNLP0 (nSol,
     195                                          nSol [objInd],
     196                                          true,
     197                                          false, // don't care about obj
     198                                          true,  // stop at first violation
     199                                          true); // checkAll
    189200
    190201  /////////////////////////////////////////////////////////////////////////
     
    202213  // of the main routine
    203214
    204   problem_ -> domain () -> push (model_ -> solver ());
     215  // use new bounds found in BT earlier
     216
     217  //problem_ -> domain () -> push (model_ -> solver ());
    205218
    206219  expression *originalObjective = problem_ -> Obj (0) -> Body ();
     
    214227    save_mOM = multObjFMILP_;
    215228
    216   do {
     229  if (!isNlpFeas) do { // only do this if NLP solution was not also MINLP
     230
     231    if (CoinCpuTime () > problem_ -> getMaxCpuTime ())
     232      break;
    217233
    218234    if (niter) {
     
    225241    }
    226242
    227     if (CoinCpuTime () > problem_ -> getMaxCpuTime ())
    228       break;
    229 
    230243    problem_ -> Jnlst () -> Printf (J_ERROR, J_NLPHEURISTIC, "[FeasPump] Iteration %d [%gs]\n", niter, CoinCpuTime() - time0);
    231244
     
    239252           
    240253    double z = solveMILP (nSol, iSol, niter, &nsuciter);
     254
     255#if 0
     256    if (milp_ && milp_ -> getColLower ()) {
     257      printf ("fixed in milp_:    ");
     258      for (int i=0; i<problem_ -> nVars (); ++i)
     259        if (fabs (milp_ -> getColUpper () [i] -
     260                  milp_ -> getColLower () [i]) < COUENNE_EPS)
     261          printf ("%d ", i);
     262    }
     263
     264    problem_ -> domain () -> push (model_ -> solver ());
     265    printf ("\nfixed in model_:   ");
     266    for (int i=0; i<problem_ -> nVars (); ++i)
     267      if (fabs (problem_ -> Ub (i) - problem_ -> Lb (i)) < COUENNE_EPS)
     268        printf ("%d ", i);
     269    problem_ -> domain () -> pop ();
     270
     271    problem_ -> domain () -> push (*(problem_ -> domain () -> current ()));
     272    printf ("\nfixed in problem_: ");
     273    for (int i=0; i<problem_ -> nVars (); ++i)
     274      if (fabs (problem_ -> Ub (i) - problem_ -> Lb (i)) < COUENNE_EPS)
     275        printf ("%d ", i);
     276    problem_ -> domain () -> pop ();
     277    printf ("\n");
     278#endif
    241279
    242280    // if no MILP solution was found, bail out
Note: See TracChangeset for help on using the changeset viewer.