Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
1.1 kB
9
Indexable
Never
void Callback::callback() {
    try {
        if (where == GRB_CB_MIPSOL) {


            findsubtour(p->n, &len, tour);


            if (len < p->n) {
                //Add subtour elimination constraint
            }


           else{
                int len_sub = 3;
                bool stop_cond = true;

                do { costruisci un subpath di lunghezza len_sub del tour trovato
                    calcola LB del subpath

                    if (subpath < LB_1) {
                        aggiungi tagllio;
                        stop_cond = false;
                    }
                    else {
                        len_sub++;
                    }
                } while (len_sub < p->n && stop_cond);
            }

            delete[] tour;
        }
    }
    catch (GRBException e) {
        std::cout << "Error number: " << e.getErrorCode() << std::endl;
        std::cout << e.getMessage() << std::endl;
    }
    catch (...) {
        std::cout << "Error during callback" << std::endl;
    }
}