Changeset 1074


Ignore:
Timestamp:
Apr 11, 2014 6:56:02 PM (6 years ago)
Author:
pbelotti
Message:

added rounding (option 6 of FP milp); do getIntCand even if no Nsol (use lpsol)

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

Legend:

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

    r1073 r1074  
    439439
    440440        {
    441           bool success;
    442 
    443441          if (!sol)
    444442            sol = new CouNumber [problem_ -> nVars ()];
    445443
    446           if (nSol)
    447             problem_ -> getIntegerCandidate (nSol, sol, problem_ -> Lb (), problem_ -> Ub ());
    448 
    449           //
    450           //
    451           SCIP_SOL* scipSol;// = {0,0,0,sol,NULL,NULL,0,0,0,0,0,0};
     444          if (!nSol)
     445            nSol = milp_ -> getColSolution ();
     446
     447          // whatever nSol, pick solution through getIntCand
     448
     449          problem_ -> getIntegerCandidate (nSol, sol, problem_ -> Lb (), problem_ -> Ub ());
     450
     451          SCIP_SOL* scipSol;
    452452          SCIP_CALL( SCIPcreateSol(scip, &scipSol, NULL ));
    453           SCIP_CALL(SCIPsetSolVals(scip, scipSol, nvars, vars,(double*) sol));//SCIP_CALL (SCIPtrySol (scip, ScipSol, FALSE, FALSE, FALSE, FALSE, &success) );
    454           //if (!success)
    455           //problem_ -> Jnlst () -> Printf (Ipopt::J_WARNING, J_NLPHEURISTIC, "Could not add initial MINLP solution to SCIP\n");
     453          SCIP_CALL(SCIPsetSolVals(scip, scipSol, nvars, vars,(double*) sol));
    456454        }
    457455
    458456        break;
    459457
    460       case 6: // round, but perturb first if we are cycling
     458      case 6: // round; TODO: but perturb first if we are cycling
     459
     460        if (!sol)
     461          sol = new CouNumber [problem_ -> nVars ()];
     462
     463        if (!nSol)
     464          nSol = milp_ -> getColSolution ();
     465
     466        for (int j = 0; j < problem_ -> nVars (); ++j)
     467          sol [j] =
     468            (problem_ -> Var (j) -> Multiplicity () <= 0) ? 0. :
     469            (problem_ -> Var (j) -> isInteger    ())      ? COUENNE_round (nSol [j]) : nSol [j];
     470
     471          SCIP_SOL* scipSol;
     472          SCIP_CALL( SCIPcreateSol(scip, &scipSol, NULL ));
     473          SCIP_CALL(SCIPsetSolVals(scip, scipSol, nvars, vars, (double*) sol));
    461474
    462475        break;
     
    517530     
    518531    // solve the MILP
    519 
    520     SCIP_RETCODE retcode = SCIPsolve (scip);
    521 
     532                                                //   /|
     533                                                //  / +---------+
     534    SCIP_RETCODE retcode = SCIPsolve (scip);    // <     MILP   |
     535                                                //  \ +---------+
     536                                                //   \|
    522537#if 0
    523538    if (SCIPgetStatus (scip) == SCIP_STATUS_INFEASIBLE) {
  • trunk/Couenne/src/heuristics/CouenneFeasPumpConstructors.cpp

    r1073 r1074  
    549549    ("feas_pump_milpmethod",
    550550     "How should the integral solution be constructed?",
    551      -1, 5, 0,
    552        "0: automatic, 1: aggressive heuristics, large node limit, 2: default, node limit, 3: RENS, 4: Objective Feasibility Pump, -1: solve MILP completely");
     551     -1, 6, 0,
     552       "0: automatic, 1: aggressive heuristics, large node limit, 2: default, node limit, 3: RENS, 4: Objective Feasibility Pump, 5: MINLP rounding heuristic, 6: rounding, -1: solve MILP completely");
    553553
    554554  roptions -> AddBoundedIntegerOption
Note: See TracChangeset for help on using the changeset viewer.