Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ constraint_solver/

or-tools/src/constraint_solver/resource.cc File Reference

#include <string.h>
#include <algorithm>
#include "base/hash.h"
#include <string>
#include <vector>
#include "base/commandlineflags.h"
#include "base/integral_types.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
#include "base/join.h"
#include "base/stl_util.h"
#include "base/mathutil.h"
#include "constraint_solver/constraint_solver.h"
#include "constraint_solver/constraint_solveri.h"
#include "util/bitset.h"
#include "util/monoid_operation_tree.h"

Go to the source code of this file.

Namespaces

namespace  operations_research

Typedefs

typedef IndexedTask
< DisjunctiveTask > 
operations_research::DisjunctiveIndexedTask
typedef IndexedTask
< CumulativeTask > 
operations_research::CumulativeIndexedTask

Functions

 DEFINE_bool (cp_use_cumulative_edge_finder, true,"Use the O(n log n) cumulative edge finding algorithm described ""in 'Edge Finding Filtering Algorithm for Discrete Cumulative ""Resources in O(kn log n)' by Petr Vilim, CP 2009.")
 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
 DEFINE_bool (cp_use_cumulative_time_table, true,"Use a O(n^2) cumulative time table propagation algorithm.")
 DEFINE_bool (cp_use_sequence_high_demand_tasks, true,"Use a sequence constraints for cumulative tasks that have a ""demand greater than half of the capacity of the resource.")
 DEFINE_bool (cp_use_all_possible_disjunctions, true,"Post temporal disjunctions for all pairs of tasks sharing a ""cumulative resource and that cannot overlap because the sum of ""their demand exceeds the capacity.")
template<class Task>
bool operations_research::StartMinLessThan (const IndexedTask< Task > *const w1, const IndexedTask< Task > *const w2)
 Comparison methods, used by the STL sort.
template<class Task>
bool operations_research::EndMaxLessThan (const IndexedTask< Task > *const w1, const IndexedTask< Task > *const w2)
template<class Task>
bool operations_research::StartMaxLessThan (const IndexedTask< Task > *const w1, const IndexedTask< Task > *const w2)
template<class Task>
bool operations_research::EndMinLessThan (const IndexedTask< Task > *const w1, const IndexedTask< Task > *const w2)
template<typename T, typename Compare>
void operations_research::Sort (std::vector< T > *vector, Compare compare)
bool operations_research::TaskStartMinLessThan (const CumulativeTask *const task1, const CumulativeTask *const task2)
CumulativeTask * operations_research::MakeTask (Solver *solver, IntervalVar *interval, int64 demand)
 Cumulative.
int64 operations_research::SafeProduct (int64 a, int64 b)
 Returns min(a * b, kint64max). a is positive.
bool operations_research::TimeLessThan (const ProfileDelta &delta1, const ProfileDelta &delta2)


Function Documentation

DEFINE_bool ( cp_use_all_possible_disjunctions  ,
true  ,
"Post temporal disjunctions for all pairs of tasks sharing a ""cumulative resource and that cannot overlap because the sum of ""their demand exceeds the capacity."   
)

DEFINE_bool ( cp_use_sequence_high_demand_tasks  ,
true  ,
"Use a sequence constraints for cumulative tasks that have a ""demand greater than half of the capacity of the resource."   
)

DEFINE_bool ( cp_use_cumulative_time_table  ,
true  ,
"Use a O(n^2) cumulative time table propagation algorithm."   
)

DEFINE_bool ( cp_use_cumulative_edge_finder  ,
true  ,
"Use the O(n log n) cumulative edge finding algorithm described ""in 'Edge Finding Filtering Algorithm for Discrete Cumulative ""Resources in O(kn log n)' by Petr   Vilim,
CP 2009."   
)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file contains implementations of several resource constraints. The implemented constraints are: Disjunctive: forces a set of intervals to be non-overlapping Cumulative: forces a set of intervals with associated demands to be such that the sum of demands of the intervals containing any given integer does not exceed a capacity. In addition, it implements the SequenceVar that allows ranking decisions on a set of interval variables.

Todo:
TODO(user) Should these remains flags, or should they move to SolverParameters?


Variable Documentation

The argmax in energetic_end_min_opt_.

It is the index of the chosen task in the Lambda set, if any, or kNone if none.

Definition at line 394 of file resource.cc.

The argmax in energy_opt_.

It is the index of the chosen task in the Lambda set, if any, or kNone if none.

Definition at line 386 of file resource.cc.

std::vector<CumulativeIndexedTask*> by_end_max_

Cumulative tasks, ordered by non-decreasing end max.

Definition at line 481 of file resource.cc.

std::vector<CumulativeIndexedTask*> by_end_min_

Cumulative tasks, ordered by non-decreasing end min.

Definition at line 601 of file resource.cc.

std::vector<DisjunctiveIndexedTask*> by_start_max_

Definition at line 482 of file resource.cc.

std::vector<CumulativeTask*> by_start_min_

Cumulative tasks, ordered by non-decreasing start min.

Definition at line 480 of file resource.cc.

const int64 capacity_

Capacity of the cumulative resource.

Definition at line 457 of file resource.cc.

int64 delta

Definition at line 1336 of file resource.cc.

const int64 demand_

Definition at line 111 of file resource.cc.

scoped_array<int64> demands_

Array of demands for the visitor.

Definition at line 1719 of file resource.cc.

Max_{subset S of Theta} (capacity * start_min(S) + energy(S)).

Definition at line 379 of file resource.cc.

Energetic end min of the alpha set.

Used when swimming up only.

Definition at line 993 of file resource.cc.

Max_{subset S of Theta, i in Lambda} (capacity * start_min(S union {i}) + energy(S union {i})).

Definition at line 390 of file resource.cc.

int64 energy_

Amount of resource consumed by the Theta set, in units of demand X time.

This is energy(Theta).

Definition at line 376 of file resource.cc.

Energy of the alpha set, that is, the set of tasks whose start min does not exceed the max start min of a set with excess residual energy.

Used when swimming up only.

Definition at line 988 of file resource.cc.

int64 energy_opt_

Max_{i in Lambda} (energy(Theta union {i})).

Definition at line 382 of file resource.cc.

Energy threshold such that if a set has an energetic_end_min greater than the threshold, then it can push tasks that must end at or after the currently considered end max.

Used when diving down only.

Definition at line 982 of file resource.cc.

IntervalVar* interval_

Definition at line 81 of file resource.cc.

scoped_array<IntervalVar*> intervals_

Array of intervals for the visitor.

Definition at line 791 of file resource.cc.

const int kNone [static]

Special value for task indices meaning 'no such task'.

Definition at line 260 of file resource.cc.

const int64 kNotAvailable [static]

Definition at line 931 of file resource.cc.

const int64 kNotInitialized [static]

Definition at line 893 of file resource.cc.

const int kUnknown [static]

Definition at line 119 of file resource.cc.

CumulativeLambdaThetaTree lt_tree_

Cumulative theta-lamba tree.

Definition at line 609 of file resource.cc.

EdgeFinderAndDetectablePrecedences mirror_

Definition at line 794 of file resource.cc.

Definition at line 796 of file resource.cc.

std::vector<int64> new_est_

new_est_[i] is the new start min for interval est_[i]->interval().

Definition at line 606 of file resource.cc.

std::vector<int64> new_lct_

new_lct_[i] is the new end max for interval est_[i]->interval().

Definition at line 483 of file resource.cc.

std::vector<StartMinUpdater> new_start_min_

Stack of updates to the new start min to do.

Definition at line 1008 of file resource.cc.

Definition at line 1515 of file resource.cc.

Definition at line 1514 of file resource.cc.

Definition at line 913 of file resource.cc.

Max_{subset S of Theta} (residual_capacity * start_min(S) + energy(S)).

Definition at line 883 of file resource.cc.

const int size_

Number of tasks sharing this cumulative resource.

Number of tasks.

Definition at line 478 of file resource.cc.

Solver* const solver_

Definition at line 588 of file resource.cc.

Definition at line 141 of file resource.cc.

EdgeFinderAndDetectablePrecedences straight_

Definition at line 793 of file resource.cc.

Definition at line 795 of file resource.cc.

Task task_

Definition at line 140 of file resource.cc.

const scoped_array<CumulativeTask*> tasks_

The tasks that share the cumulative resource.

Definition at line 1711 of file resource.cc.

ThetaTree theta_tree_

All the following member variables are essentially used as local ones: no invariant is maintained about them, except for the fact that the vectors always contains all the considered intervals, so any function that wants to use them must first sort them in the right order.

All of these vectors store the same set of objects. Therefore, at destruction time, STLDeleteElements should be called on only one of them. It does not matter which one.

Definition at line 479 of file resource.cc.

int64 time

Definition at line 1335 of file resource.cc.

int64 total_ect_

Definition at line 218 of file resource.cc.

Definition at line 217 of file resource.cc.

Definition at line 1033 of file resource.cc.

UpdateMap update_map_

update_map_[d][i] is an integer such that if a task whose demand is d cannot end before by_end_max_[i], then it cannot start before update_map_[d][i].

Definition at line 1307 of file resource.cc.

std::vector<int64> updates_

Definition at line 1032 of file resource.cc.