Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

IloInsertVisit failure

  • 1.  IloInsertVisit failure

    Posted 10/03/08 08:43 AM

    Originally posted by: SystemAdmin


    [anahana said:]

    I used two IloInsertVisit goals to insert a set of pickup and delivery visits (pickup and delivery visits are constrained by the IloOrderedVisitPair constraint). There are a total of 10 visits (both pickup and delivery) to insert, but only 5 of them can be inserted into the current solution; the IloInsertVisit goal fails when attempting to insert the remaining visits. The problem is that there are vehicles that are not used yet; total number of vehicles I'm using is 15 and only 5 of them are used for all the visits (including the new added ones), my question is, if some visits can not be inserted into the routing plans of the 5 vehicles, why can't they be inserted into new, unused, vehicles? Why does Dispatcher leave visits un-inserted while there are vehicles unused?
    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: IloInsertVisit failure

    Posted 10/03/08 12:58 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    If there is no constraint stating that your unused vehicles must remain used, the IloInsertVisit goal should insert your remaining visits on the remaining unused vehicles.
    Are you sure you haven't post a constraint such as nextVisit(first) = last on the "unused" vehicles?

    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: IloInsertVisit failure

    Posted 10/03/08 02:09 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    No, I don't have such a constraint; I did however add this constraint to "freeze" part of the routing plan

    IloVisit nextVisit = _dispatcher.getNext(rIt.operator *());
    _mdl.add(rIt.operator *().getNextVar() == nextVisit);

    where rIt is a route iterator.

    Of course if I remove this constraint, all visits will be inserted, but I can't see how this constraint forbids using the remaining vehicles
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: IloInsertVisit failure

    Posted 10/03/08 02:30 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    Are your vehicles optional?
    i.e. did you use this specific method on IloVehicle
        vehicle.setOptional(IloTrue);
    ?

    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: IloInsertVisit failure

    Posted 10/03/08 03:37 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    No, why?
    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: IloInsertVisit failure

    Posted 10/03/08 05:05 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    Then, I guess you added first->last constraints on the unused vehicles. Could you please add a trace in your code to be sure?
    #CPOptimizer
    #DecisionOptimization


  • 7.  Re: IloInsertVisit failure

    Posted 10/03/08 07:24 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    I will do so and let you know.

    Thanks.
    #CPOptimizer
    #DecisionOptimization


  • 8.  Re: IloInsertVisit failure

    Posted 10/04/08 11:16 AM

    Originally posted by: SystemAdmin


    [anahana said:]

    I noticed something that might be relevant; my program first finds an initial solution and then adds new visits to it using the IloInsertVisit.

    When I use IloSavingsGenerate to produce an initial solution, only 3 vehicles are used, I then store that solution in an instance of IloRoutingSolution and call the IloInsertVisit method to insert new visits, I noticed that non of the new visits were inserted because all 3 vehicles were full upon creating the initial solution. However, when I use IloInsertionGenerate to produce an initial solution, 5 vehicles are used and when I call the IloInsertVisit method, most of the new visits are inserted (using only 5 vehicles) and the remaining visits are not inserted as all 5 vehicles become "full".

    I concluded from this that once an initial solution is stored in an instance of IloRoutingSolution and when this solution instance is passed to IloInsertVisit, new vehicles can not be used to insert new visits as these new vehicles were not part of the initial solution.

    Am I right? If so, how can I go around this?

    #CPOptimizer
    #DecisionOptimization


  • 9.  Re: IloInsertVisit failure

    Posted 10/06/08 12:51 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    [quote author=ahocquet link=topic=596.msg1822#msg1822 date=1223035475]
    Then, I guess you added first->last constraints on the unused vehicles. Could you please add a trace in your code to be sure?


    Do you have an answer?
    Thanks.
    #CPOptimizer
    #DecisionOptimization


  • 10.  Re: IloInsertVisit failure

    Posted 10/06/08 01:58 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    Sorry, did not answer that part... I checked the code and there is no such constraint.

    Do you think that the first solution thing I mentioned causing this behavior?
    #CPOptimizer
    #DecisionOptimization


  • 11.  Re: IloInsertVisit failure

    Posted 10/06/08 02:10 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    It seems that your solution doesn't contain all vehicles, but only the ones used in the first solution.
    To allow the IloInsertVisit goal to add visits on new vehicles, you should add the unused vehicles to your solution. To do this, use the IloRoutingSolution::add(IloVehicle veh) method.
    #CPOptimizer
    #DecisionOptimization


  • 12.  Re: IloInsertVisit failure

    Posted 10/06/08 02:48 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    Thanks, I'll give it a try and let you know.
    #CPOptimizer
    #DecisionOptimization


  • 13.  Re: IloInsertVisit failure

    Posted 10/07/08 06:25 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    I tried it but with no luck as the unused vehicles are already in the routing solution, they are just not being used; I get this error message once I add the unused vehicles to the solution:

    "Error: Extractable already present in solution"

    which is true because the unused vehicles are part of the current (initial) solution.

    Any thoughts?
    #CPOptimizer
    #DecisionOptimization


  • 14.  Re: IloInsertVisit failure

    Posted 10/09/08 04:45 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    If all your vehicles are contained in the solution (it is obviously the case) and if you haven't deactivated the unused vehicles by adding "next(first)=last" constraints, then there is no reason why your vehicles can't be used with the IloInsertVisit goal.
    You can try using IloGoal IloInsertVisit(IloEnv env, IloVisit visit, IloVehicleArray vehicles, IloRoutingSolution solution) with a vehicle arry containing all your unused vehicles, but it should not work better than the other goal.
    If it solves your problem, please tell us...
    If not and if you're sure there is no contraint in your model which deactivate your vehicles, then I guess you will have to send us some code, so that we can look at your specific problem.
    #CPOptimizer
    #DecisionOptimization


  • 15.  Re: IloInsertVisit failure

    Posted 10/09/08 11:40 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    Thank you for getting back to me.

    As you said, all vehicles are obviously included in the solution, and non are deactivated using the constraint "next(firstVist) == lastVisit". I also tried passing an array of vehicles, but with no luck; only the vehicles that were used in the initial solution are used to insert new visits (or what ever can fit in those vehicles).

    Below are the codes for the "createVehiles" and "addNewVisits" methods, and the output I get when running the code; you will notice in the output that I displayed the solution after the insertion of each visit hoping to know what the problem is, the solution outputs just fine up until IloInsetVisit attempts to insert visit66, it fails and so does all visits after it.

    Hope you can help me...

    void RoutingModel::createVehicles(char* vehicleFileName)
    {
    IloCsvReader csvVehicleReader(_env, vehicleFileName);
    IloCsvReader::LineIterator it(csvVehicleReader);

    while(it.ok())
    {
    IloCsvLine line = *it;

    char * namefirst = line.getStringByHeader("first");
    char * namelast = line.getStringByHeader("last");
    char * name = line.getStringByHeader("name");

    IloNum capacity = line.getFloatByHeader("capacity");
    IloNum openTime = line.getFloatByHeader("open");
    IloNum closeTime = line.getFloatByHeader("close");

    IloNode node1 = IloNode::Find(_env, namefirst);
    IloNode node2 = IloNode::Find(_env, namelast);

    IloVisit first(node1, namefirst);
    _mdl.add(first.getCumulVar(_weight) == 0);
    _mdl.add(first.getCumulVar(_time) >= openTime);

    IloVisit last(node2, namelast);
    _mdl.add(last.getCumulVar(_time) <= closeTime);<br />
    IloVehicle vehicle(_env, name);
    vehicle.setFirstVisit(first);
    vehicle.setLastVisit(last);

    vehicle.setCost(_time, 1.0);
        vehicle.setCost(_distance, 1.0);
    vehicle.setCapacity(_weight, capacity);

    _mdl.add(vehicle);
    _vehicleArray.add(vehicle);

    ++it;
    }
    csvVehicleReader.end();
    }


    IloBool RoutingSolver::addNewVisit (IloVisitArray _pickupArray, IloVisitArray _deliveryArray)
    {
    IloVehicleIterator vIt(_mdl);
    for(int i = 0; i < _dispatcher.getNbOfVehiclesUsed(); i++)<br /> {
    IloVehicle dyVehicle = *vIt;

    // if (_dispatcher.getRouteSize(dyVehicle) == 0)
    // _solution.add(dyVehicle);

    IloDispatcher::RouteIterator rIt(_dispatcher, dyVehicle);

    for(int j = 0; j <= 2; j++)<br /> {
    if (rIt.ok())
    {
    IloVisit nextVisit = _dispatcher.getNext(rIt.operator *());
    _mdl.add(rIt.operator *().getNextVar() == nextVisit);
    }
    ++rIt;
    }
    ++vIt;
    }

    for (int i = 25; i <= _pickupArray.getSize() - 1; i++)<br /> {
    IloGoal insertPickupVisit = IloInsertVisit(_env, _pickupArray[i], _solution, _instantiateCost);

    if (!_solver.solve(insertPickupVisit))
    {
    _solver.out() << "Cannot insert new pickup visit in solution" << endl;<br /> cout << _pickupArray&#91;i&#93; << endl;<br />// return IloFalse;
    }

    else
    {
    _solution.add(_pickupArray[i]);

    _mdl.add(IloOrderedVisitPair(_env, _pickupArray[i], _deliveryArray[i]));

    IloGoal insertDeliveryVisit = IloInsertVisit(_env, _deliveryArray[i], _solution, _instantiateCost);

    if (!_solver.solve(insertDeliveryVisit))
    {
    _solver.out() << "Cannot insert new delivery visit in solution" << endl;<br /> cout << _deliveryArray&#91;i&#93; << endl;<br />// return IloFalse;
    }

    else
    {
    _solution.add(_deliveryArray[i]);
    _solution.store(_solver);
    cout << IloTerse(_dispatcher) << endl;<br /> }
    }
    }

    for(IloDispatcher::UnperformedVisitIterator uvIt(_dispatcher); uvIt.ok(); ++uvIt)
    cout << *uvIt << endl;<br />
    return IloTrue;
    }


    IloBool RoutingSolver::addNewVisit (IloVisitArray _pickupArray, IloVisitArray _deliveryArray)
    {
    IloVehicleIterator vIt(_mdl);
    for(int i = 0; i < _dispatcher.getNbOfVehiclesUsed(); i++)<br /> {
    IloVehicle dyVehicle = *vIt;

    IloDispatcher::RouteIterator rIt(_dispatcher, dyVehicle);

    for(int j = 0; j <= 2; j++)<br /> {
    if (rIt.ok())
    {
    IloVisit nextVisit = _dispatcher.getNext(rIt.operator *());
    _mdl.add(rIt.operator *().getNextVar() == nextVisit);
    }
    ++rIt;
    }
    ++vIt;
    }

    for (int i = 25; i <= _pickupArray.getSize() - 1; i++)<br /> {
    IloGoal insertPickupVisit = IloInsertVisit(_env, _pickupArray[i], _solution, _instantiateCost);

    if (!_solver.solve(insertPickupVisit))
    {
    _solver.out() << "Cannot insert new pickup visit in solution" << endl;<br /> cout << _pickupArray&#91;i&#93; << endl;<br />// return IloFalse;
    }

    else
    {
    _solution.add(_pickupArray[i]);

    _mdl.add(IloOrderedVisitPair(_env, _pickupArray[i], _deliveryArray[i]));

    IloGoal insertDeliveryVisit = IloInsertVisit(_env, _deliveryArray[i], _solution, _instantiateCost);

    if (!_solver.solve(insertDeliveryVisit))
    {
    _solver.out() << "Cannot insert new delivery visit in solution" << endl;<br /> cout << _deliveryArray&#91;i&#93; << endl;<br />// return IloFalse;
    }

    else
    {
    _solution.add(_deliveryArray[i]);
    _solution.store(_solver);
    cout << IloTerse(_dispatcher) << endl;<br /> }
    }
    }
    return IloTrue;
    }

    ***output***

    ***First Solution***
    Solver Information...
    Number of fails              : 25
    Number of choice points      : 1114
    Number of variables          : 2393
    Number of constraints        : 562
    Reversible stack (bytes)      : 176248
    Solver heap (bytes)          : 1025308
    Solver global heap (bytes)    : 145684
    And stack (bytes)            : 32068
    Or stack (bytes)              : 48088
    Search Stack (bytes)          : 16048
    Constraint queue (bytes)      : 11152
    Total memory used (bytes)    : 1454596
    Running time since creation  : 0.5625
    ---------------
    Dispatcher Information...
    Number of nodes              : 66
    Number of visits              : 80
    Number of vehicles            : 15
    Number of dimensions          : 3
    Number of accepted moves      : 0
    ---------------
    Total Cost : 2018.99
    Number of vehicles used : 5
    Number of visits performed : 80
    Solution    :
    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit10 -> visit20 -> depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit32 -> visit34 -> visit25 -> visit39 -> visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    ../../../examples/data/pdp/nodes2.csv // prompt for the new nodes' file
    ../../../examples/data/pdp/nodes2.csv // new nodes' file
    ../../../examples/data/pdp/visits2.csv // prompt for new visits' file
    ../../../examples/data/pdp/visits2.csv // new visits' file

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit10 -> visit20 -> visit52 -> depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit32 -> visit34 -> visit25 -> visit39 -> visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit10 -> visit20 -> visit52 -> depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit53 -> visit32 -> visit34 -> visit54 -> visit25 -> visit39 -> visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit55 -> visit10 -> visit20 -> visit52 -> visit56 -> depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit53 -> visit32 -> visit34 -> visit54 -> visit25 -> visit39 -> visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit55 -> visit10 -> visit20 -> visit52 -> visit56 -> depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit53 -> visit57 -> visit32 -> visit34 -> visit54 -> visit58 -> visit25 -> visit39 -> visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit59 -> visit55 -> visit10 -> visit20 -> visit52 -> visit60 -> visit56 ->
    depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit53 -> visit57 -> visit32 -> visit34 -> visit54 -> visit58 -> visit25 -> visit39 -> visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit59 -> visit55 -> visit10 -> visit20 -> visit52 -> visit60 -> visit56 ->
    depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit53 -> visit61 -> visit57 -> visit32 -> visit34 -> visit54 -> visit62 -> visit58 -> visit25 -> visit39 -> visit26 -> visit40 -
    > depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Unperformed visits : None
    vehicle1 Route : depot -> visit21 -> visit22 -> visit15 -> visit16 -> visit7 -> visit8 -> visit5 -> visit6 -> visit1 -> visit3 -> visit2 -> visit4 -> depot
    vehicle2 Route : depot -> visit45 -> visit47 -> visit46 -> visit48 -> visit11 -> visit12 -> visit9 -> visit19 -> visit51 -> visit59 -> visit55 -> visit10 -> visit20 -> visit52 -> visit60 -> visit56 ->
    depot
    vehicle3 Route : depot -> visit27 -> visit28 -> visit23 -> visit41 -> visit35 -> visit29 -> visit24 -> visit42 -> visit36 -> visit30 -> visit13 -> visit17 -> visit14 -> visit18 -> depot
    vehicle4 Route : depot -> visit49 -> visit50 -> visit31 -> visit33 -> visit63 -> visit53 -> visit61 -> visit57 -> visit32 -> visit34 -> visit64 -> visit54 -> visit62 -> visit58 -> visit25 -> visit39 -
    > visit26 -> visit40 -> depot
    vehicle5 Route : depot -> visit43 -> visit44 -> visit37 -> visit38 -> depot
    vehicle6 : Unused
    vehicle7 : Unused
    vehicle8 : Unused
    vehicle9 : Unused
    vehicle10 : Unused
    vehicle11 : Unused
    vehicle12 : Unused
    vehicle13 : Unused
    vehicle14 : Unused
    vehicle15 : Unused

    Cannot insert new delivery visit in solution
    Visit[visit66] node : Node[node66] X = 35 Y = 22 Z = 0
    Cannot insert new pickup visit in solution
    Visit[visit67] node : Node[node67] X = 35 Y = 36 Z = 0
    Cannot insert new pickup visit in solution
    Visit[visit69] node : Node[node69] X = 37 Y = 31 Z = 0

    ***Solution including new visit***
    Solver Information...
    Number of fails              : 9
    Number of choice points      : 4
    Number of variables          : 2853
    Number of constraints        : 0
    Reversible stack (bytes)      : 192268
    Solver heap (bytes)          : 1217548
    Solver global heap (bytes)    : 756284
    And stack (bytes)            : 32068
    Or stack (bytes)              : 48088
    Search Stack (bytes)          : 16048
    Constraint queue (bytes)      : 11152
    Total memory used (bytes)    : 2273456
    Running time since creation  : 0
    ---------------
    Dispatcher Information...
    Number of nodes              : 86
    Number of visits              : 100
    Number of vehicles            : 15
    Number of dimensions          : 3
    Number of accepted moves      : 0
    ---------------
    Total Cost : -1.#INF
    Number of vehicles used : 0
    Number of visits performed : 100
    Solution    :
    Unperformed visits : None
    vehicle1 : Incomplete
    vehicle2 : Incomplete
    vehicle3 : Incomplete
    vehicle4 : Incomplete
    vehicle5 : Incomplete
    vehicle6 : Incomplete
    vehicle7 : Incomplete
    vehicle8 : Incomplete
    vehicle9 : Incomplete
    vehicle10 : Incomplete
    vehicle11 : Incomplete
    vehicle12 : Incomplete
    vehicle13 : Incomplete
    vehicle14 : Incomplete
    vehicle15 : Incomplete



    #CPOptimizer
    #DecisionOptimization


  • 16.  Re: IloInsertVisit failure

    Posted 10/10/08 01:42 PM

    Originally posted by: SystemAdmin


    [ahocquet said:]

    Hi,

    First you should modify your code with the following red lines. It will be safer if the used vehicles are not the first ones in the model...

    [quote author=anahana link=topic=596.msg1845#msg1845 date=1223577614]

    IloBool RoutingSolver::addNewVisit (IloVisitArray _pickupArray, IloVisitArray _deliveryArray)
    {
    [color=red][b]for (IloVehicleIterator vIt(_mdl); vIt.ok(); ++vIt)
    {
    IloVehicle dyVehicle = *vIt;

    if (_dispatcher.getRouteSize(dyVehicle) == 0) continue;[/b][/color]

    IloDispatcher::RouteIterator rIt(_dispatcher, dyVehicle);

    for(int j = 0; j <= 2; j++)<br /> {
    if (rIt.ok())
    {
    IloVisit nextVisit = _dispatcher.getNext(rIt.operator *());
    _mdl.add(rIt.operator *().getNextVar() == nextVisit);
    }
    ++rIt;
    }
    ++vIt;
    }

    ...



    Then, I'm sorry but I don't understand the second part of your "addNewVisit" code. If you have pickup-delivery pairs, they should be created and added to the model before trying to add them with the IloInsertVisit goal. I also don't really understand if you try to add visits one by one or array of visits by array of visits... What is this "25" value?
    I suggest you contact the customer support for more help. You could send your code and you will get a full assistance on your development.


    #CPOptimizer
    #DecisionOptimization


  • 17.  Re: IloInsertVisit failure

    Posted 10/10/08 11:34 PM

    Originally posted by: SystemAdmin


    [anahana said:]

    Hi,

    Sorry about not explaining the second part of the "addNewVisit" code; there are a few things that should be clarified.

    First, "addNewVisit" takes two IloVisitArray parameters: "_pickupArray" and "_deliveryArray" each containing all the pickup and delivery visits that were created for both the initial solution and the new visits that should be added. Actually, all new visits that are created are automatically added to these arrays using another function called "createVisits" which is a bit different than the standard sample function code used in most ILOG examples.

    Second, as the arrays contain all visits, the IloInsertVisit method should only be used on the set of visits that are not already in the initial solution, which in my case start at index 25 of each array; hence, the parameter 25.

    Third, once I made sure that the IloInsertVisit uses only visits that were not part of the initial solution (by making the for loop start at index 25), I used a loop to iterate through the "_pickupArray" array first and insert a pickup visit, if it succeeds, it can insert the corresponding delivery visit from the "_deliveryArray" array using another IloInsertVisit goal; if it does not succeeds, it outputs the pickup visit that could not be inserted and loops to the next pickup visit (as it makes no sence to add a delivery visit without its pickup visit pair). So, I'm adding one visit pair at a time, but using arrays to add a set of such pairs

    Finally, I did contact customer support, but I did not get an answer yet!

    Please let me know if you need any more clarification.

    I really appreciate your help.
    #CPOptimizer
    #DecisionOptimization


  • 18.  Re: IloInsertVisit failure

    Posted 10/15/08 10:26 AM

    Originally posted by: SystemAdmin


    [anahana said:]

    Guys, can anyone help?
    #CPOptimizer
    #DecisionOptimization