Commit 6dc26880 authored by Jukka Pekka's avatar Jukka Pekka Committed by jpekka

Implemented the algorithm selection.

2002-08-17  Jukka Pekka  <jiivonen@hutcs.cs.hut.fi>

	* dialog-solver.c (dialog_init): Implemented the algorithm
	selection.

	* solver.glade: related changes.
parent ef93250b
......@@ -14,6 +14,8 @@ Jukka:
scale problems, written by Andrew Makhorin. It performs
much better than lp-solve if the model is large, see
a benchmark in ftp://plato.la.asu.edu/pub/lpsimp.txt.
- Added the algorithm selection into the dialog.
- Solver dialog improvements.
Morten:
* Add poor man's utf8 regexp routines.
......
-*- mode: m4 -*-
AC_PREREQ(2.52)
AC_INIT(gnumeric, 1.1.6,
AC_INIT(gnumeric, 1.1.8,
http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric)
AC_CONFIG_SRCDIR(src/sheet.h)
......@@ -657,6 +657,8 @@ src/pixmaps/Makefile
src/widgets/Makefile
src/tools/Makefile
src/tools/solver/Makefile
src/tools/solver/glpk/Makefile
src/tools/solver/glpk/source/Makefile
src/tools/solver/lp_solve/Makefile
doc/Makefile
doc/C/Makefile
......
2002-08-17 Jukka Pekka <jiivonen@hutcs.cs.hut.fi>
* dialog-solver.c (dialog_init): Implemented the algorithm
selection.
* solver.glade: related changes.
2002-08-16 Jon K Hellan <hellan@acm.org>
* dialog-cell-format.c: #if 0 static variable fmt_dialog_currency.
......
......@@ -346,7 +346,6 @@ cb_tool_cancel_clicked (GtkWidget *button, GenericToolState *state)
{
simulation_tool_destroy (current_sim);
gtk_widget_destroy (state->dialog);
g_free (state);
}
static void
......
......@@ -62,6 +62,7 @@ typedef struct {
GnumericExprEntry *lhs_entry;
GnumericExprEntry *rhs_entry;
GtkOptionMenu *type_combo;
GtkOptionMenu *algorithm_combo;
GtkCList *constraint_list;
gint selected_row;
gnum_float ov_target;
......@@ -90,6 +91,17 @@ static char const * constraint_strs_untranslated[] = {
};
#endif
typedef struct {
char const *name;
SolverLPAlgorithmType type;
} algorithm_def_t;
static algorithm_def_t algorithm_defs [] = {
{ N_("Revised Simplex (GLPK 3.2)"), GLPKSimplex },
{ N_("Simplex (LP Solve 3.2)"), LPSolve },
{ NULL, 0 }
};
typedef struct {
GtkCList *c_listing;
GSList *c_list;
......@@ -186,7 +198,6 @@ dialog_set_sec_button_sensitivity (GtkWidget *dummy, SolverState *state)
gtk_widget_set_sensitive (state->delete_button, select_ready);
}
/**
* constraint_select_click:
* @clist:
......@@ -847,6 +858,18 @@ cb_dialog_solve_clicked (GtkWidget *button, SolverState *state)
gnumeric_glade_group_value (state->gui, problem_type_group);
param->options.model_type =
gnumeric_glade_group_value (state->gui, model_type_group);
for (i = 0; algorithm_defs [i].name; i++) {
GtkEntry *entry = GTK_ENTRY
(GTK_COMBO (state->algorithm_combo)->entry);
G_CONST_RETURN gchar *name = gtk_entry_get_text (entry);
if (strcmp (algorithm_defs [i].name, name) == 0) {
param->options.algorithm = algorithm_defs [i].type;
break;
}
}
param->options.assume_non_negative = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (glade_xml_get_widget (state->gui,
"non_neg_button")));
......@@ -953,6 +976,16 @@ dialog_init (SolverState *state)
GtkTable *table;
constraint_conversion_t conv;
SolverParameters *param;
static GList *alg_name_list = NULL;
if (alg_name_list == NULL) {
int i;
for (i = 0; algorithm_defs [i].name; i++)
alg_name_list = g_list_append
(alg_name_list,
(gpointer) algorithm_defs [i].name);
}
param = state->sheet->solver_parameters;
......@@ -1034,6 +1067,12 @@ dialog_init (SolverState *state)
g_signal_connect_after (G_OBJECT (state->change_cell_entry), "changed",
G_CALLBACK (dialog_set_main_button_sensitivity), state);
/* Algorithm */
state->algorithm_combo = GTK_OPTION_MENU
(glade_xml_get_widget (state->gui, "algorithm_combo"));
gtk_combo_set_popdown_strings (GTK_COMBO (state->algorithm_combo),
alg_name_list);
/* Options */
state->max_iter_entry = glade_xml_get_widget (state->gui,
"max_iter_entry");
......
......@@ -282,6 +282,70 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCombo" id="algorithm_combo">
<property name="visible">True</property>
<property name="value_in_list">False</property>
<property name="allow_empty">True</property>
<property name="case_sensitive">False</property>
<property name="enable_arrow_keys">True</property>
<property name="enable_arrows_always">False</property>
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry1">
<property name="width_request">178</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
</child>
<child internal-child="list">
<widget class="GtkList" id="combo-list1">
<property name="visible">True</property>
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label21">
<property name="visible">True</property>
<property name="label" translatable="yes">Algorithm:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.89</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment