$darkmode
DENOPTIM
CheckPoint.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.combinatorial;
20
21import java.io.File;
22import java.util.ArrayList;
23
24
39public class CheckPoint
40{
44 protected int level = -1;
45
49 protected long unqVrtId = -1L;
50
54 protected int unqGraphId = -1;
55
59 protected int unqMolId = -1;
60
64 protected int rootId = -1;
65
69 protected int graphId = -1;
70
74 protected ArrayList<Integer> nextIds;
75
76
77//-----------------------------------------------------------------------------
78
79 public CheckPoint()
80 {
81 nextIds = new ArrayList<Integer>();
82 }
83
84//-----------------------------------------------------------------------------
85
86 public int getLevel()
87 {
88 return level;
89 }
90
91//-----------------------------------------------------------------------------
92
93 public long getUnqVrtId()
94 {
95 return unqVrtId;
96 }
97
98//-----------------------------------------------------------------------------
99
100 public int getUnqGraphId()
101 {
102 return unqGraphId;
103 }
104
105//-----------------------------------------------------------------------------
106
107 public int getUnqMolId()
108 {
109 return unqMolId;
110 }
111
112//-----------------------------------------------------------------------------
113
114 public ArrayList<Integer> getNextIds()
115 {
116 return nextIds;
117 }
118
119//-----------------------------------------------------------------------------
120
122 {
123 return graphId;
124 }
125
126//-----------------------------------------------------------------------------
127
128 public int getRootId()
129 {
130 return rootId;
131 }
132
133//-----------------------------------------------------------------------------
134
142 public boolean serFileAlreadyUsed(String filename)
143 {
144 File candFile = new File(filename);
145 File doneFile = new File(CEBLUtils.getBaseNameOfStorageFile(rootId));
146 int res = candFile.compareTo(doneFile);
147 if (res < 0)
148 {
149 return true;
150 }
151 return false;
152 }
153
154//-----------------------------------------------------------------------------
155
161 public void setNextIds(ArrayList<Integer> nextIds)
162 {
163 this.nextIds = nextIds;
164 }
165
166//-----------------------------------------------------------------------------
167
172 public void setLevel(int level)
173 {
174 this.level = level;
175 }
176
177//-----------------------------------------------------------------------------
178
183 public void setUnqVrtId(long l)
184 {
185 unqVrtId = l;
186 }
187
188//-----------------------------------------------------------------------------
189
194 public void setUnqGraphId(int val)
195 {
196 unqGraphId = val;
197 }
198
199//-----------------------------------------------------------------------------
200
205 public void setUnqMolId(int val)
206 {
207 unqMolId = val;
208 }
209
210//-----------------------------------------------------------------------------
211
216 public void setSafelyCompletedGraphId(int val)
217 {
218 graphId = val;
219 }
220
221//-----------------------------------------------------------------------------
222
227 public void setRootId(int val)
228 {
229 rootId = val;
230 }
231
232//-----------------------------------------------------------------------------
233
234 @Override
235 public String toString()
236 {
237 StringBuilder sb = new StringBuilder();
238 sb.append("FSECheckPoint[");
239 sb.append("level=").append(level);
240 sb.append(", unqVrtId=").append(unqVrtId);
241 sb.append(", unqGraphId=").append(unqGraphId);
242 sb.append(", unqMolId=").append(unqMolId);
243 sb.append(", graphId=").append(graphId);
244 sb.append(", rootId=").append(rootId);
245 sb.append(", nextIds=").append(nextIds);
246 return sb.toString();
247 }
248
249//-----------------------------------------------------------------------------
250
251}
Helper methods for the exploration of the fragment space.
Definition: CEBLUtils.java:45
static String getBaseNameOfStorageFile(int graphId)
Definition: CEBLUtils.java:101
Object collecting information needed to restart a FragSpaceExplorer job.
Definition: CheckPoint.java:40
void setNextIds(ArrayList< Integer > nextIds)
Set the indexes that identify the combination of fragments next to the latest one that has been prope...
int unqGraphId
Unique graph index.
Definition: CheckPoint.java:54
void setUnqGraphId(int val)
Set the restart value for the unique graph ID.
void setSafelyCompletedGraphId(int val)
Set the graphId of the safely completed graph.
long unqVrtId
Unique vertex index.
Definition: CheckPoint.java:49
ArrayList< Integer > getNextIds()
int unqMolId
Unique molecule index.
Definition: CheckPoint.java:59
boolean serFileAlreadyUsed(String filename)
ArrayList< Integer > nextIds
Set of indexes for the next iteration in combination of building blocks.
Definition: CheckPoint.java:74
void setLevel(int level)
Set the current level.
int rootId
ID of the root graph used to build this graph.
Definition: CheckPoint.java:64
void setUnqMolId(int val)
Set the restart value for the unique molecule ID.
int graphId
ID of safely completed graph.
Definition: CheckPoint.java:69
void setRootId(int val)
Set the graph ID of the root graph used to build this task.
void setUnqVrtId(long l)
Set the restart value for the unique vertex ID.