mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 11:25:51 +00:00
mv util/lp to math/lp
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
b6513b8e2d
commit
33cbd29ed0
150 changed files with 524 additions and 479 deletions
45
src/math/lp/indexer_of_constraints.h
Normal file
45
src/math/lp/indexer_of_constraints.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
<name>
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
Nikolaj Bjorner (nbjorner)
|
||||
Lev Nachmanson (levnach)
|
||||
|
||||
Revision History:
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
#pragma once
|
||||
#include "math/lp/binary_heap_priority_queue.h"
|
||||
namespace lp {
|
||||
|
||||
class indexer_of_constraints {
|
||||
binary_heap_priority_queue<unsigned> m_queue_of_released_indices;
|
||||
unsigned m_max;
|
||||
public:
|
||||
indexer_of_constraints() :m_max(0) {}
|
||||
unsigned get_new_index() {
|
||||
unsigned ret;
|
||||
if (m_queue_of_released_indices.is_empty()) {
|
||||
ret = m_max++;
|
||||
}
|
||||
else {
|
||||
ret = m_queue_of_released_indices.dequeue();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
void release_index(unsigned i) {
|
||||
m_queue_of_released_indices.enqueue(i, i);
|
||||
};
|
||||
unsigned max() const { return m_max; }
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue