Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
aa193a6a
Commit
aa193a6a
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
clang-format
parent
75fc6045
No related branches found
No related tags found
1 merge request
!1004
Fit: catalogize algorithms, not minimizers
Pipeline
#73813
failed
2 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/Model/Job/MinimizerItem.cpp
+12
-16
12 additions, 16 deletions
GUI/Model/Job/MinimizerItem.cpp
GUI/Util/ComboProperty.cpp
+1
-1
1 addition, 1 deletion
GUI/Util/ComboProperty.cpp
GUI/View/Fit/MinimizerSettingsWidget.cpp
+12
-13
12 additions, 13 deletions
GUI/View/Fit/MinimizerSettingsWidget.cpp
with
25 additions
and
30 deletions
GUI/Model/Job/MinimizerItem.cpp
+
12
−
16
View file @
aa193a6a
...
@@ -42,18 +42,18 @@ void add_algorithm_from_minimizer_to_list_and_map(const QString& minimizer,
...
@@ -42,18 +42,18 @@ void add_algorithm_from_minimizer_to_list_and_map(const QString& minimizer,
QStringList
descriptions
=
MinimizerItemCatalog
::
algorithmDescriptions
(
minimizer
);
QStringList
descriptions
=
MinimizerItemCatalog
::
algorithmDescriptions
(
minimizer
);
ASSERT
(
algorithms
.
size
()
==
descriptions
.
size
())
ASSERT
(
algorithms
.
size
()
==
descriptions
.
size
())
for
(
int
i
=
0
;
i
<
algorithms
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
algorithms
.
size
();
i
++
)
{
QString
name
=
" "
+
algorithms
[
i
];
QString
name
=
" "
+
algorithms
[
i
];
common_algorithms_list
.
append
(
name
);
common_algorithms_list
.
append
(
name
);
common_algorithms_descriptions
.
append
(
descriptions
[
i
]);
common_algorithms_descriptions
.
append
(
descriptions
[
i
]);
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
minimizer
));
algorithm_minimizer_map
.
insert
(
name
,
minimizer_names_map
.
key
(
minimizer
));
}
}
}
}
void
create_algorithm_list_and_map
(
QString
&
default_common_algorithm
,
void
create_algorithm_list_and_map
(
QString
&
default_common_algorithm
,
QStringList
&
algorithms_list
,
QStringList
&
algorithms_list
,
QStringList
&
algorithms_descriptions
)
QStringList
&
algorithms_descriptions
)
{
{
// Group headers may not directly correspond to minimizers, so for them we don't use descriptions from MinimizerInfo
// Group headers may not directly correspond to minimizers, so for them we don't use
// descriptions from MinimizerInfo
algorithms_list
.
clear
();
algorithms_list
.
clear
();
algorithms_descriptions
.
clear
();
algorithms_descriptions
.
clear
();
...
@@ -63,34 +63,31 @@ void create_algorithm_list_and_map(QString& default_common_algorithm,
...
@@ -63,34 +63,31 @@ void create_algorithm_list_and_map(QString& default_common_algorithm,
algorithms_list
.
append
(
"ROOT Minuit2"
);
algorithms_list
.
append
(
"ROOT Minuit2"
);
algorithms_descriptions
.
append
(
"Minuit2 minimizer from CERN ROOT package"
);
algorithms_descriptions
.
append
(
"Minuit2 minimizer from CERN ROOT package"
);
add_algorithm_from_minimizer_to_list_and_map
(
MinuitMinimizerItem
::
M_TYPE
,
algorithms_list
,
algorithms_descriptions
);
add_algorithm_from_minimizer_to_list_and_map
(
MinuitMinimizerItem
::
M_TYPE
,
algorithms_list
,
algorithms_descriptions
);
// group 2
// group 2
algorithms_list
.
append
(
"ROOT TMVA"
);
algorithms_list
.
append
(
"ROOT TMVA"
);
algorithms_descriptions
.
append
(
"Genetic minimizer from TMVA package, part of CERN ROOT "
);
algorithms_descriptions
.
append
(
"Genetic minimizer from TMVA package, part of CERN ROOT "
);
add_algorithm_from_minimizer_to_list_and_map
(
GeneticMinimizerItem
::
M_TYPE
,
add_algorithm_from_minimizer_to_list_and_map
(
GeneticMinimizerItem
::
M_TYPE
,
algorithms_list
,
algorithms_list
,
algorithms_descriptions
);
algorithms_descriptions
);
// group 3
// group 3
algorithms_list
.
append
(
"GSL MultiMin"
);
algorithms_list
.
append
(
"GSL MultiMin"
);
algorithms_descriptions
.
append
(
"Multidimensional Minimization from GSL library"
);
algorithms_descriptions
.
append
(
"Multidimensional Minimization from GSL library"
);
add_algorithm_from_minimizer_to_list_and_map
(
GSLMultiMinimizerItem
::
M_TYPE
,
add_algorithm_from_minimizer_to_list_and_map
(
GSLMultiMinimizerItem
::
M_TYPE
,
algorithms_list
,
algorithms_list
,
algorithms_descriptions
);
algorithms_descriptions
);
// group 4
// group 4
algorithms_list
.
append
(
"GSL"
);
algorithms_list
.
append
(
"GSL"
);
algorithms_descriptions
.
append
(
"Other minimizers from GSL library"
);
algorithms_descriptions
.
append
(
"Other minimizers from GSL library"
);
add_algorithm_from_minimizer_to_list_and_map
(
SimAnMinimizerItem
::
M_TYPE
,
add_algorithm_from_minimizer_to_list_and_map
(
SimAnMinimizerItem
::
M_TYPE
,
algorithms_list
,
algorithms_list
,
algorithms_descriptions
);
algorithms_descriptions
);
add_algorithm_from_minimizer_to_list_and_map
(
GSLLMAMinimizerItem
::
M_TYPE
,
add_algorithm_from_minimizer_to_list_and_map
(
GSLLMAMinimizerItem
::
M_TYPE
,
algorithms_list
,
algorithms_list
,
algorithms_descriptions
);
algorithms_descriptions
);
default_common_algorithm
=
algorithms_list
[
1
];
// after the first header
default_common_algorithm
=
algorithms_list
[
1
];
// after the first header
...
@@ -120,8 +117,7 @@ MinimizerContainerItem::MinimizerContainerItem()
...
@@ -120,8 +117,7 @@ MinimizerContainerItem::MinimizerContainerItem()
QString
default_common_algorithm
;
QString
default_common_algorithm
;
QStringList
common_algorithms_list
;
QStringList
common_algorithms_list
;
QStringList
common_algorithms_descriptions
;
QStringList
common_algorithms_descriptions
;
create_algorithm_list_and_map
(
default_common_algorithm
,
create_algorithm_list_and_map
(
default_common_algorithm
,
common_algorithms_list
,
common_algorithms_list
,
common_algorithms_descriptions
);
common_algorithms_descriptions
);
ComboProperty
common_algorithm_combo
=
ComboProperty
common_algorithm_combo
=
ComboProperty
::
fromList
(
common_algorithms_list
,
default_common_algorithm
);
ComboProperty
::
fromList
(
common_algorithms_list
,
default_common_algorithm
);
...
@@ -195,7 +191,7 @@ ComboProperty MinimizerContainerItem::minimizerCombo() const
...
@@ -195,7 +191,7 @@ ComboProperty MinimizerContainerItem::minimizerCombo() const
return
getItemValue
(
P_MINIMIZERS
).
value
<
ComboProperty
>
();
return
getItemValue
(
P_MINIMIZERS
).
value
<
ComboProperty
>
();
}
}
#ifdef ALGORITHM_LIST
#ifdef ALGORITHM_LIST
bool
MinimizerContainerItem
::
algorithmHasMinimizer
(
const
QString
&
name
)
bool
MinimizerContainerItem
::
algorithmHasMinimizer
(
const
QString
&
name
)
{
{
return
algorithm_minimizer_map
.
contains
(
name
);
return
algorithm_minimizer_map
.
contains
(
name
);
}
}
...
...
This diff is collapsed.
Click to expand it.
GUI/Util/ComboProperty.cpp
+
1
−
1
View file @
aa193a6a
...
@@ -164,7 +164,7 @@ QString ComboProperty::stringOfTooltips() const
...
@@ -164,7 +164,7 @@ QString ComboProperty::stringOfTooltips() const
return
m_tooltips
.
join
(
value_separator
);
return
m_tooltips
.
join
(
value_separator
);
}
}
void
ComboProperty
::
setStringOfTooltips
(
const
QString
&
tooltips
)
void
ComboProperty
::
setStringOfTooltips
(
const
QString
&
tooltips
)
{
{
m_tooltips
=
tooltips
.
split
(
value_separator
);
m_tooltips
=
tooltips
.
split
(
value_separator
);
}
}
...
...
This diff is collapsed.
Click to expand it.
GUI/View/Fit/MinimizerSettingsWidget.cpp
+
12
−
13
View file @
aa193a6a
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
#include
<QComboBox>
#include
<QComboBox>
#include
<QFormLayout>
#include
<QFormLayout>
#include
<QPushButton>
#include
<QPushButton>
#include
<QVBoxLayout>
#include
<QStandardItemModel>
#include
<QStandardItemModel>
#include
<QVBoxLayout>
MinimizerSettingsWidget
::
MinimizerSettingsWidget
(
QWidget
*
parent
)
MinimizerSettingsWidget
::
MinimizerSettingsWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
:
QWidget
(
parent
)
...
@@ -99,16 +99,16 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
...
@@ -99,16 +99,16 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
// list with headers and separators
// list with headers and separators
QList
<
qsizetype
>
header_indices
;
QList
<
qsizetype
>
header_indices
;
QList
<
qsizetype
>
non_separator_indices
;
QList
<
qsizetype
>
non_separator_indices
;
for
(
QString
algorithm
:
list
)
{
for
(
QString
algorithm
:
list
)
{
comboBox
->
addItem
(
algorithm
);
comboBox
->
addItem
(
algorithm
);
if
(
!
m_currentItem
->
algorithmHasMinimizer
(
algorithm
))
{
if
(
!
m_currentItem
->
algorithmHasMinimizer
(
algorithm
))
{
comboBox
->
insertSeparator
(
comboBox
->
count
()
-
1
);
comboBox
->
insertSeparator
(
comboBox
->
count
()
-
1
);
qsizetype
header_index
=
comboBox
->
count
()
-
1
;
qsizetype
header_index
=
comboBox
->
count
()
-
1
;
header_indices
.
append
(
header_index
);
header_indices
.
append
(
header_index
);
non_separator_indices
.
append
(
header_index
);
non_separator_indices
.
append
(
header_index
);
QStandardItemModel
*
model
=
qobject_cast
<
QStandardItemModel
*>
(
comboBox
->
model
());
QStandardItemModel
*
model
=
qobject_cast
<
QStandardItemModel
*>
(
comboBox
->
model
());
QStandardItem
*
header_item
=
model
->
item
(
header_index
);
QStandardItem
*
header_item
=
model
->
item
(
header_index
);
header_item
->
setSelectable
(
false
);
header_item
->
setSelectable
(
false
);
...
@@ -118,7 +118,7 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
...
@@ -118,7 +118,7 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
comboBox
->
insertSeparator
(
comboBox
->
count
());
comboBox
->
insertSeparator
(
comboBox
->
count
());
}
else
}
else
non_separator_indices
.
append
(
comboBox
->
count
()
-
1
);
non_separator_indices
.
append
(
comboBox
->
count
()
-
1
);
}
}
comboBox
->
setCurrentText
(
m_currentItem
->
commonAlgorithmCombo
().
currentValue
());
comboBox
->
setCurrentText
(
m_currentItem
->
commonAlgorithmCombo
().
currentValue
());
...
@@ -133,16 +133,15 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
...
@@ -133,16 +133,15 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
comboBox
->
setProperty
(
"previous"
,
comboBox
->
currentIndex
());
comboBox
->
setProperty
(
"previous"
,
comboBox
->
currentIndex
());
QObject
::
connect
(
comboBox
,
&
QComboBox
::
currentTextChanged
,
[
=
]
{
QObject
::
connect
(
comboBox
,
&
QComboBox
::
currentTextChanged
,
[
=
]
{
// skip headers while scrolling
// skip headers while scrolling
if
(
header_indices
.
contains
(
comboBox
->
currentIndex
()))
if
(
header_indices
.
contains
(
comboBox
->
currentIndex
()))
{
{
int
previous_state
=
comboBox
->
property
(
"previous"
).
toInt
();
int
previous_state
=
comboBox
->
property
(
"previous"
).
toInt
();
int
prev
=
comboBox
->
currentIndex
()
-
2
;
int
prev
=
comboBox
->
currentIndex
()
-
2
;
int
next
=
comboBox
->
currentIndex
()
+
2
;
int
next
=
comboBox
->
currentIndex
()
+
2
;
if
(
previous_state
<
comboBox
->
currentIndex
()
&&
next
<
comboBox
->
count
())
if
(
previous_state
<
comboBox
->
currentIndex
()
&&
next
<
comboBox
->
count
())
comboBox
->
setCurrentIndex
(
next
);
comboBox
->
setCurrentIndex
(
next
);
else
if
(
previous_state
>
comboBox
->
currentIndex
()
&&
prev
>=
0
)
else
if
(
previous_state
>
comboBox
->
currentIndex
()
&&
prev
>=
0
)
comboBox
->
setCurrentIndex
(
prev
);
comboBox
->
setCurrentIndex
(
prev
);
else
else
comboBox
->
setCurrentIndex
(
previous_state
);
comboBox
->
setCurrentIndex
(
previous_state
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment