Re: [Help-glpk] Help! AccessViolationException in GLPK
Hello! I try use glpk for c#. I'm widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 bit. I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 to /bin directory. Test to solve was excellent. When I try use glpk in me application In GLPK.glp_add_cols(lp, varcounter), when varcounter= big number, for example varcounter=4961 I get exception 'GLPK.glp_add_cols(lp, varcounter)' threw an exception of type 'System.AccessViolationException' Data: {System.Collections.ListDictionaryInternal} HResult: -2147467261 HelpLink: null InnerException: null Message: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source: "libglpk-cli" StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef jarg1, Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, Int32 ncs)" TargetSite: {Int32 glp_add_cols(System.Runtime.InteropServices.HandleRef, Int32)} Help me, please! --- With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Help! AccessViolationException in GLPK
Best regards Heinrich Schuchardt http://www.xypron.de Am 13.10.16 um 12:32 schrieb Захарова Наталья Иркиновна > Hello! > I try use glpk for c#. > I'm widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 bit. > I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 to > /bin directory. > Test to solve was excellent. > When I try use glpk in me application > > In GLPK.glp_add_cols(lp, varcounter), when varcounter= big number, for > example varcounter=4961 > I get exception > 'GLPK.glp_add_cols(lp, varcounter)' threw an exception of type > 'System.AccessViolationException' > Data: {System.Collections.ListDictionaryInternal} > HResult: -2147467261 > HelpLink: null > InnerException: null > Message: "Attempted to read or write protected memory. This is often an > indication that other memory is corrupt." > Source: "libglpk-cli" > StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef jarg1, > Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, Int32 ncs)" > TargetSite: {Int32 glp_add_cols(System.Runtime.InteropServices.HandleRef, > Int32)} > > > Help me, please! > > > > --- > With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Help! AccessViolationException in GLPK
Hello Natalia, indexes in GÖPK start stopp 1. So if you have 10 rows/columns you need arrays with 11 entries. Best regards Heinrich Schuchardt http://www.xypron.de Am 13.10.16 um 12:32 schrieb Захарова Наталья Иркиновна > Hello! > I try use glpk for c#. > I'm widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 bit. > I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 to > /bin directory. > Test to solve was excellent. > When I try use glpk in me application > > In GLPK.glp_add_cols(lp, varcounter), when varcounter= big number, for > example varcounter=4961 > I get exception > 'GLPK.glp_add_cols(lp, varcounter)' threw an exception of type > 'System.AccessViolationException' > Data: {System.Collections.ListDictionaryInternal} > HResult: -2147467261 > HelpLink: null > InnerException: null > Message: "Attempted to read or write protected memory. This is often an > indication that other memory is corrupt." > Source: "libglpk-cli" > StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef jarg1, > Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, Int32 ncs)" > TargetSite: {Int32 glp_add_cols(System.Runtime.InteropServices.HandleRef, > Int32)} > > > Help me, please! > > > > --- > With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Help! AccessViolationException in GLPK
Thank you! I understand that, and create a variable with the number 1. The problem occurs at 4965 variable. And this is not the last variable. And each time is a different number. while (dateFrom <= dateTo) { for (var hour = 0; hour < 24; hour++) { var paramDate = station.Compound.GetParamForDate(dateFrom); var paramHour = paramDate.ParamByHour(hour); varCounter++; paramHour.PriznakDozagruzki = new PriznakDozagruzki() { ParamType = TipDozagruzki.Pmax, Day = dateFrom, Hour = hour, Position = varCounter, StationID = station.ID }; taskGLPK.AddVariable(varCounter, lp, GLPK.GLP_BV); station.FuelInfo.ToList() .ForEach(p => { varCounter++; var b = new RashodTopliva() { Day = dateFrom, Hour = hour, Position = varCounter, Station = station, FuelInfo = p, }; p.RashodTopliva.Add(b); taskGLPK.AddVariable(varCounter, lp, GLPK.GLP_CV); }); } dateFrom = dateFrom.AddDays(1); } public void AddVariable(int varcounter, glp_prob lp, int type) { GLPK.glp_add_cols(lp, varcounter); GLPK.glp_set_col_kind(lp, varcounter, type); } -Original Message- From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de] Sent: Thursday, October 13, 2016 4:30 PM To: Захарова Наталья Иркиновна Subject: Re: RE: Help! AccessViolationException in GLPK Hello Natalia, could you please send me a full example showing the problem. Best regards Heinrich Schuchardt http://www.xypron.de Am 13.10.16 um 12:32 schrieb Захарова Наталья Иркиновна > Hello! > I try use glpk for c#. > I'm widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 bit. > I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 to > /bin directory. > Test to solve was excellent. > When I try use glpk in me application > > In GLPK.glp_add_cols(lp, varcounter), when varcounter= big number, for > example varcounter=4961 I get exception 'GLPK.glp_add_cols(lp, > varcounter)' threw an exception of type 'System.AccessViolationException' > Data: {System.Collections.ListDictionaryInternal} > HResult: -2147467261 > HelpLink: null > InnerException: null > Message: "Attempted to read or write protected memory. This is often an > indication that other memory is corrupt." > Source: "libglpk-cli" > StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef jarg1, > Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, Int32 ncs)" > TargetSite: {Int32 > glp_add_cols(System.Runtime.InteropServices.HandleRef, Int32)} > > > Help me, please! > > > > --- > With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
Re: [Help-glpk] Help! AccessViolationException in GLPK
Sorry, At begin int varCounter=0; -Original Message- From: Захарова Наталья Иркиновна Sent: Thursday, October 13, 2016 4:35 PM To: 'Heinrich Schuchardt' Cc: help-glpk@gnu.org; bug-g...@gnu.org Subject: RE: RE: Help! AccessViolationException in GLPK Thank you! I understand that, and create a variable with the number 1. The problem occurs at 4965 variable. And this is not the last variable. And each time is a different number. while (dateFrom <= dateTo) { for (var hour = 0; hour < 24; hour++) { var paramDate = station.Compound.GetParamForDate(dateFrom); var paramHour = paramDate.ParamByHour(hour); varCounter++; paramHour.PriznakDozagruzki = new PriznakDozagruzki() { ParamType = TipDozagruzki.Pmax, Day = dateFrom, Hour = hour, Position = varCounter, StationID = station.ID }; taskGLPK.AddVariable(varCounter, lp, GLPK.GLP_BV); station.FuelInfo.ToList() .ForEach(p => { varCounter++; var b = new RashodTopliva() { Day = dateFrom, Hour = hour, Position = varCounter, Station = station, FuelInfo = p, }; p.RashodTopliva.Add(b); taskGLPK.AddVariable(varCounter, lp, GLPK.GLP_CV); }); } dateFrom = dateFrom.AddDays(1); } public void AddVariable(int varcounter, glp_prob lp, int type) { GLPK.glp_add_cols(lp, varcounter); GLPK.glp_set_col_kind(lp, varcounter, type); } -Original Message- From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de] Sent: Thursday, October 13, 2016 4:30 PM To: Захарова Наталья Иркиновна Subject: Re: RE: Help! AccessViolationException in GLPK Hello Natalia, could you please send me a full example showing the problem. Best regards Heinrich Schuchardt http://www.xypron.de Am 13.10.16 um 12:32 schrieb Захарова Наталья Иркиновна > Hello! > I try use glpk for c#. > I'm widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 bit. > I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 to > /bin directory. > Test to solve was excellent. > When I try use glpk in me application > > In GLPK.glp_add_cols(lp, varcounter), when varcounter= big number, for > example varcounter=4961 I get exception 'GLPK.glp_add_cols(lp, > varcounter)' threw an exception of type 'System.AccessViolationException' > Data: {System.Collections.ListDictionaryInternal} > HResult: -2147467261 > HelpLink: null > InnerException: null > Message: "Attempted to read or write protected memory. This is often an > indication that other memory is corrupt." > Source: "libglpk-cli" > StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef jarg1, > Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, Int32 ncs)" > TargetSite: {Int32 > glp_add_cols(System.Runtime.InteropServices.HandleRef, Int32)} > > > Help me, please! > > > > --- > With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
[Help-glpk] [Fwd: Help! AccessViolationException in GLPK]
Forwarded Message From: Захарова Наталья Иркиновна To: help-glpk@gnu.org , xypron.g...@gmx.de , bug-g...@gnu.org Subject: Help! AccessViolationException in GLPK Date: Thu, 13 Oct 2016 10:16:14 + Hello! I try use glpk for c#. I’m widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 bit. I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 to /bin directory. Test to solve was excellent. When I try use glpk in me application InGLPK.glp_add_cols(lp, varcounter), when varcounter= big number, for example varcounter=4961 I get exception 'GLPK.glp_add_cols(lp, varcounter)' threw an exception of type 'System.AccessViolationException' Data: {System.Collections.ListDictionaryInternal} HResult: -2147467261 HelpLink: null InnerException: null Message: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source: "libglpk-cli" StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef jarg1, Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, Int32 ncs)" TargetSite: {Int32 glp_add_cols(System.Runtime.InteropServices.HandleRef, Int32)} Help me, please! --- With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk
[Help-glpk] Fwd: RE: RE: RE: Help! AccessViolationException in GLPK
Anfang der weitergeleiteten E-Mail > Von: "Захарова Наталья Иркиновна" > Datum: 13. Oktober 2016 um 15:07 > An: "Heinrich Schuchardt" > Betreff: RE: RE: RE: Help! AccessViolationException in GLPK > > Thank you! > > -Original Message- > From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de] > Sent: Thursday, October 13, 2016 4:42 PM > To: Захарова Наталья Иркиновна > Subject: Re: RE: RE: Help! AccessViolationException in GLPK > > GLPK.glp_add_cols(lp, varcounter); > creates not one column but as many columns as varcounter specifies. > > Afterwards you set the "kind" of a single column with index varcounter. > > Best regards > > Heinrich Schuchardt > > http://www.xypron.de > > Am 13.10.16 um 13:34 schrieb Захарова Наталья Иркиновна > > > Thank you! > > I understand that, and create a variable with the number 1. > > The problem occurs at 4965 variable. And this is not the last variable. And > > each time is a different number. > > > > while (dateFrom <= dateTo) > > { > > for (var hour = 0; hour < 24; hour++) > > { > > var paramDate = > > station.Compound.GetParamForDate(dateFrom); > > var paramHour = paramDate.ParamByHour(hour); > > varCounter++; > > paramHour.PriznakDozagruzki = new > > PriznakDozagruzki() > > { > > ParamType = TipDozagruzki.Pmax, > > Day = dateFrom, > > Hour = hour, > > Position = varCounter, > > StationID = station.ID > > }; > > taskGLPK.AddVariable(varCounter, lp, > > GLPK.GLP_BV); > > > > station.FuelInfo.ToList() > > .ForEach(p => > > { > > varCounter++; > > var b = new RashodTopliva() > > { > > Day = dateFrom, > > Hour = hour, > > Position = varCounter, > > Station = station, > > FuelInfo = p, > > }; > > > > p.RashodTopliva.Add(b); > > taskGLPK.AddVariable(varCounter, > > lp, GLPK.GLP_CV); > > }); > > } > > dateFrom = dateFrom.AddDays(1); > > } > > > > > > public void AddVariable(int varcounter, glp_prob lp, int type) > > { > > GLPK.glp_add_cols(lp, varcounter); > > GLPK.glp_set_col_kind(lp, varcounter, type); > > } > > > > -Original Message- > > From: Heinrich Schuchardt [mailto:xypron.g...@gmx.de] > > Sent: Thursday, October 13, 2016 4:30 PM > > To: Захарова Наталья Иркиновна > > Subject: Re: RE: Help! AccessViolationException in GLPK > > > > Hello Natalia, > > > > could you please send me a full example showing the problem. > > > > Best regards > > > > Heinrich Schuchardt > > > > http://www.xypron.de > > > > Am 13.10.16 um 12:32 schrieb Захарова Наталья Иркиновна > > > > > Hello! > > > I try use glpk for c#. > > > I'm widows 10 and VS 2015 amd 64-bit Windows. But my application is 32 > > > bit. > > > I add libglpk-cli.dll to project and add libglpk_cli_native and glpk_4_60 > > > to /bin directory. > > > Test to solve was excellent. > > > When I try use glpk in me application > > > > > > In GLPK.glp_add_cols(lp, varcounter), when varcounter= big number, > > > for example varcounter=4961 I get exception 'GLPK.glp_add_cols(lp, > > > varcounter)' threw an exception of type 'System.AccessViolationException' > > > Data: {System.Collections.ListDictionaryInternal} > > > HResult: -2147467261 > > > HelpLink: null > > > InnerException: null > > > Message: "Attempted to read or write protected memory. This is often > > > an indication that other memory is corrupt." > > > Source: "libglpk-cli" > > > StackTrace: " at org.gnu.glpk.GLPKPINVOKE.glp_add_cols(HandleRef > > > jarg1, Int32 jarg2)\r\n at org.gnu.glpk.GLPK.glp_add_cols(glp_prob P, > > > Int32 ncs)" > > > TargetSite: {Int32 > > > glp_add_cols(System.Runtime.InteropServices.HandleRef, Int32)} > > > > > > > > > Help me, please! > > > > > > > > > > > > --- > > > With regards, Natalia ___ Help-glpk mailing list Help-glpk@gnu.org https://lists.gnu.org/mailman/listinfo/help-glpk