Struct grote_opdracht::model::State [] [src]

pub struct State {
    pub current_score: Time,
    pub events: [[Vec<Segment>; 5]; 2],
    pub possible_orders: HashSet<u32>,
    pub scheduled_orders: HashMap<u32, HashSet<(usize, usize, usize)>>,
    pub orders: Arc<OrderList>,
    pub travel_time: Arc<TravelTime>,
}

Represents the searchable state in which we will try to minimize our score using local search algorithms. Operators come in two forms:

The instructions returned by the try_<operator>() functions can be executed using the execute_operator() function. See Action for more information.

Fields

The total current score in time units.

The events are structured as follows: state.events[truck][day][event_id].

Important

For efficiency reasons this list won't contain a final Events::Dump. All methods acting on the state should still assume this event always happens!

Which orders are still able to be scheduled.

In which vehicle, on which day and in which segment orders are scheduled. Needed for deletion.

Methods

impl State
[src]

[src]

Creates a new state, filling the list of possible orders using the supplied orderlist.

[src]

Returns the current score in minutes.

[src]

Performs the actions returned by the try_<operator>() functions.

Panics

This function does not perform any bounds checking, and will thus panic when invalid actions are passed.

[src]

Insert a dump at EventIndex. This will result in splitting the segment into two segments.

[src]

Try to insert a dump at EventIndex by splitting the segment.

[src]

Inserts an order into the schedule while preventing the order to be scheduled on incompatible days. chosen_days should contain (vehicle, day, event_index) pairs on which the order should be scheduled. If the truck would go over capacity a new dump gets inserted. Inserting at event ID = day length will cause the order to be scheduled at the end of the day.

[src]

Calculate what would happen if an order were to be inserted. This returns the difference in score and for which days a dump should be added before the order.

[src]

Inserts an order into the schedule at the end of the day. This function should only be used as a helper for creating the initial solutions.

[src]

Simulates inserting an order into the schedule at the end of the day. This function should only be used as a helper for creating the initial solutions.

[src]

Moves an order from a vehicle/day/segment to another segment. This will return an error if the order doesn't fit in the new day due to volume or time constraints. The operator doesn't checker whether the order could actually be moved to the new day (due to frequency constraints).

[src]

Try to move an order from a vehicle/day/segment to another segment. See push_order for more implementation details.

[src]

Removes an order from the schedule. Orders will be removed form all the days they are scheduled on. If this causes a segment to be empty it will get removed.

[src]

Try to remove an order. An error will be returned if the order could not be removed. If this causes a segment to be empty it will get removed.

[src]

Helper for finding the location id of an order, retrieved from self.events. If order is None, this is either the location before the first or after the last order i.e. the dumping location.

[src]

Calculates what the score should have been in minutes. This is useful for debugging score fluctuations.

[src]

Checks whether or not a solution is correct and feasible.

Trait Implementations

impl Clone for State
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for State
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for State
[src]

[src]

Formats the value using the given formatter. Read more