Scippy

SoPlex

Sequential object-oriented simPlex

spxid.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 #include <stdlib.h>
26 #include <assert.h>
27 
28 #include "soplex/spxid.h"
29 #include "soplex/exceptions.h"
30 
31 namespace soplex
32 {
34  : DataKey(p_key)
35 {
37 }
38 
40  : DataKey(p_key)
41 {
42  assert(!p_key.isSPxRowId());
43 
45 }
46 
48  : DataKey(p_key)
49 {
51 }
52 
54  : DataKey(p_key)
55 {
56  assert(!p_key.isSPxColId());
57 
59 }
60 
61 std::ostream& operator<<(std::ostream& os, const SPxId& id)
62 {
63  switch(id.type())
64  {
65  case SPxId::ROW_ID:
66  os << "row ";
67  break;
68 
69  case SPxId::COL_ID :
70  os << "col ";
71  break;
72 
73  case SPxId::INVALID :
74  os << "Invalid ";
75  break;
76 
77  default :
78  throw SPxInternalCodeException("XSPXID01 This should never happen.");
79  }
80 
81  os << id.idx << " (" << id.info << ")";
82 
83  return os;
84 }
85 
86 } // namespace soplex
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
Definition: exceptions.h:118
Exception classes for SoPlex.
SPxRowId()
default constructor.
Definition: spxid.h:68
invalid id.
Definition: spxid.h:107
SPxColId()
default constructor.
Definition: spxid.h:49
Entry identifier class for items of a DataSet.Every item in a DataSet is assigned a DataKey by which ...
Definition: datakey.h:55
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:94
Row and columns Id&#39;s SPxLP.
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
Definition: basevectors.h:1143
bool isSPxColId() const
is id a column id?
Definition: spxid.h:168
int info
user information to store values -1, 0, +1
Definition: datakey.h:64
row identifier.
Definition: spxid.h:106
column identifier.
Definition: spxid.h:108
type
Definition: core.h:687
Everything should be within this namespace.
bool isSPxRowId() const
is id a row id?
Definition: spxid.h:163