Skip to content

Commit 2fbef77

Browse files
authored
Merge pull request #38 from vandenheuvel/reproduce_gat_issue
Reproduce gat issue
2 parents 17b3aa8 + 7ef3990 commit 2fbef77

File tree

11 files changed

+23
-20
lines changed

11 files changed

+23
-20
lines changed

examples/max_flow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ where
143143
F: SparseElement<F> + Zero + Eq + NonZero,
144144
{
145145
type Column = Column;
146-
type Cost<'a> = Cost;
146+
type Cost<'a> where Self: 'a = Cost;
147147
type Rhs = F;
148148

149149
fn column(&self, j: usize) -> Self::Column {

src/algorithm/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ pub trait SolveRelaxation: MatrixProvider {
2222
/// # Return value
2323
///
2424
/// Whether the problem is feasible, and if so, a solution if the problem is bounded.
25-
fn solve_relaxation<IM>(&self) -> OptimizationResult<IM::F>
25+
fn solve_relaxation<'provider, IM>(&'provider self) -> OptimizationResult<IM::F>
2626
where
2727
IM: InverseMaintener<F:
2828
im_ops::FieldHR +
2929
im_ops::Column<<Self::Column as Column>::F> +
3030
im_ops::Cost<ArtificialCost> +
31+
im_ops::Cost<Self::Cost<'provider>> +
3132
im_ops::Rhs<Self::Rhs> +
3233
im_ops::Column<Self::Rhs> +
3334
>,
34-
for<'r> IM::F: im_ops::Cost<Self::Cost<'r>>,
3535
;
3636
}
3737

src/algorithm/two_phase/matrix_provider/column/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub trait Column: ColumnIntoIterator<Self::F> + Debug {
3636
/// Type of struct to iterate over this column.
3737
///
3838
/// It should be somewhat cheaply cloneable and as such not be too large.
39-
type Iter<'a>: ColumnIterator<'a, F=Self::F>;
39+
type Iter<'a>: ColumnIterator<'a, F=Self::F> where Self: 'a;
4040

4141
/// Derive the iterator object.
4242
///

src/algorithm/two_phase/matrix_provider/filter/generic_wrapper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ where
226226
MP: MatrixProvider<Column: IntoFilteredColumn>,
227227
{
228228
type Column = <MP::Column as IntoFilteredColumn>::Filtered;
229-
type Cost<'a> = MP::Cost<'a>;
229+
type Cost<'a> where Self: 'a = MP::Cost<'provider>;
230230
type Rhs = MP::Rhs;
231231

232232
fn column(&self, j: usize) -> Self::Column {

src/algorithm/two_phase/matrix_provider/filter/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub trait Filtered: MatrixProvider {
1818
/// Derive a variant of the matrix provider that has rows removed from it.
1919
pub trait ToFiltered: MatrixProvider {
2020
/// The resulting matrix provider type.
21-
type Filtered<'provider>: Filtered<Column: Column<F=<Self::Column as Column>::F>>;
21+
type Filtered<'provider>: Filtered<Column: Column<F=<Self::Column as Column>::F>> where Self: 'provider;
2222

2323
/// Derive a variant of the matrix provider that has rows removed from it.
2424
///

src/algorithm/two_phase/matrix_provider/matrix_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ where
284284
for<'r> &'r F: FieldRef<F>,
285285
{
286286
type Column = Column<F>;
287-
type Cost<'a> = Option<&'a <Self::Column as ColumnTrait>::F>;
287+
type Cost<'a> where Self: 'a = Option<&'a <Self::Column as ColumnTrait>::F>;
288288
type Rhs = F;
289289

290290
#[inline]

src/algorithm/two_phase/matrix_provider/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub trait MatrixProvider {
4545
///
4646
/// This type will often be of the form `Option<_>` so to not have to store any zero values, the
4747
/// inner type would never be zero in that case.
48-
type Cost<'a>;
48+
type Cost<'a> where Self: 'a;
4949

5050
/// Right hand side type.
5151
type Rhs: ops::Rhs;

src/algorithm/two_phase/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ where
2727
MP: MatrixProvider<Column: Identity + IntoFilteredColumn>,
2828
{
2929
// TODO(ENHANCEMENT): Specialize for MatrixProviders that can be filtered directly.
30-
default fn solve_relaxation<IM>(&self) -> OptimizationResult<IM::F>
30+
default fn solve_relaxation<'provider, IM>(&'provider self) -> OptimizationResult<IM::F>
3131
where
3232
IM: InverseMaintener<F:
3333
im_ops::FieldHR +
3434
im_ops::Column<<<Self as MatrixProvider>::Column as Column>::F> +
3535
im_ops::Cost<ArtificialCost> +
36+
im_ops::Cost<MP::Cost<'provider>> +
3637
im_ops::Rhs<MP::Rhs> +
3738
>,
38-
for<'r> IM::F: im_ops::Cost<MP::Cost<'r>>,
3939
{
4040
match self.compute_bfs_giving_im::<IM>() {
4141
RankedFeasibilityResult::Feasible {
@@ -84,15 +84,15 @@ where
8484
MP: MatrixProvider<Column: Identity + IntoFilteredColumn>,
8585
MP::Rhs: 'static + ColumnNumber,
8686
{
87-
fn solve_relaxation<IM>(&self) -> OptimizationResult<IM::F>
87+
fn solve_relaxation<'provider, IM>(&'provider self) -> OptimizationResult<IM::F>
8888
where
8989
IM: InverseMaintener<F:
9090
im_ops::FieldHR +
9191
im_ops::Column<<<Self as MatrixProvider>::Column as Column>::F> +
92+
im_ops::Cost<MP::Cost<'provider>> +
9293
im_ops::Rhs<Self::Rhs> +
9394
im_ops::Column<Self::Rhs> +
9495
>,
95-
for<'r> IM::F: im_ops::Cost<MP::Cost<'r>>,
9696
{
9797
let basis_indices = self.pivot_element_indices();
9898
// Sorting of identity matrix columns

src/algorithm/two_phase/phase_two.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ use crate::algorithm::two_phase::tableau::kind::non_artificial::NonArtificial;
1919
///
2020
/// An `OptimizationResult` indicating whether or not the problem has a finite optimum. It cannot be
2121
/// infeasible, as a feasible solution is needed to start using this method.
22-
pub fn primal<IM, MP, PR>(
23-
tableau: &mut Tableau<IM, NonArtificial<MP>>,
22+
pub fn primal<'provider, IM, MP, PR>(
23+
tableau: &mut Tableau<IM, NonArtificial<'provider, MP>>,
2424
) -> OptimizationResult<IM::F>
2525
where
26-
IM: InverseMaintener<F: im_ops::FieldHR + im_ops::Column<<MP::Column as Column>::F>>,
27-
for<'r> IM::F: im_ops::Cost<MP::Cost<'r>>,
26+
IM: InverseMaintener<F:
27+
im_ops::FieldHR +
28+
im_ops::Column<<MP::Column as Column>::F> +
29+
im_ops::Cost<MP::Cost<'provider>> +
30+
>,
2831
MP: MatrixProvider,
2932
PR: PivotRule<IM::F>,
3033
{

src/data/linear_algebra/vector/sparse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ where
203203
C: SparseComparator,
204204
{
205205
type F = F;
206-
type Iter<'a> = SparseSliceIterator<'a, F>;
206+
type Iter<'a> where C: 'a = SparseSliceIterator<'a, F>;
207207

208208
fn iter(&self) -> Self::Iter<'_> {
209209
SparseSliceIterator::new(&self.data)

0 commit comments

Comments
 (0)