Esempio n. 1
0
 private void AddRowConstraint(double[] row, lpsolve_constr_types type = lpsolve_constr_types.EQ, double val = 0)
 {
     Rows++;
     if (!LpSolvePointer.add_constraint(row, type, val))
     {
         throw new InvalidOperationException();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// addConstraint({{0,10},{1,5}}, lpsolve.lpsolve_constr_types.LE, 100) means:
 /// 10x + 5y <= 100
 /// </summary>
 /// <param name="cfPerVarIdx">
 /// Each tuple contains variable index, and it's coefficient in this constraint.
 /// </param>
 public void addConstraint(List <Tuple <int, double> > cfPerVarIdx, lpsolve_constr_types constraintType, double rhs)
 {
     for (int j = 0; j < cfPerVarIdx.Count; ++j)
     {
         colno[j] = 1 + cfPerVarIdx[j].Item1; /* first column */
         row[j]   = cfPerVarIdx[j].Item2;
     }
     /* add the row to lpsolve */
     lpsolve.add_constraintex(lp, cfPerVarIdx.Count, row, colno, constraintType, rhs);
 }
Esempio n. 3
0
 public static extern bool add_lag_con(IntPtr lp, double[] row, lpsolve_constr_types con_type, double rhs);
Esempio n. 4
0
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool set_constr_type(int lp, int row, lpsolve_constr_types con_type);
Esempio n. 5
0
 public static extern bool add_constraint(IntPtr lp, double[] row, lpsolve_constr_types constr_type, double rh);
Esempio n. 6
0
 public bool set_constr_type(int row, lpsolve_constr_types con_type)
 {
     return(Interop.set_constr_type(_lp, row, con_type));
 }
Esempio n. 7
0
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool add_constraint(int lp, double[] row, lpsolve_constr_types constr_type, double rh);
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool str_add_constraint(IntPtr lp, string row_string, lpsolve_constr_types constr_type, double rh);
Esempio n. 9
0
 public bool add_constraintex(int count, double[] row, int[] colno, lpsolve_constr_types constr_type, double rh)
 {
     return(Interop.add_constraintex(_lp, count, row, colno, constr_type, rh));
 }
 public static extern byte set_constr_type(int lp, int row, lpsolve_constr_types con_type);
 public static extern byte str_add_constraint(int lp, string row_string, lpsolve_constr_types constr_type, double rh);
 public static extern byte add_constraintex(int lp, int count, ref double row, ref int colno, lpsolve_constr_types constr_type, double rh);
 public static extern byte add_lag_con(int lp, ref double row, lpsolve_constr_types con_type, double rhs);
 internal static extern byte add_constraintex(int lp, int count, double[] row, int[] colno, lpsolve_constr_types constr_type, double rh);
 internal static extern byte add_constraint(int lp, double[] row, lpsolve_constr_types constr_type, double rh);
Esempio n. 16
0
 public static extern bool str_add_constraint(IntPtr lp, [MarshalAs(UnmanagedType.LPStr)] string row_string, lpsolve_constr_types constr_type, double rh);
Esempio n. 17
0
 public static extern bool str_add_constraint(IntPtr lp, string row_string, lpsolve_constr_types constr_type, double rh);
 public static extern byte str_add_lag_con(int lp, string row_string, lpsolve_constr_types con_type, double rhs);
Esempio n. 19
0
 public static extern bool add_constraint(int lp, ref double row, lpsolve_constr_types constr_type, double rh);
Esempio n. 20
0
 [DllImport("lpsolve55.dll", SetLastError=true)] public static extern bool add_constraintex(int lp, int count, ref double row, ref int colno, lpsolve_constr_types constr_type, double rh);
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool add_constraintex(IntPtr lp, int count, double[] row, int[] colno, lpsolve_constr_types constr_type, double rh);
Esempio n. 22
0
 [DllImport("lpsolve55.dll", SetLastError=true)] public static extern bool set_constr_type(int lp, int row, lpsolve_constr_types con_type);
Esempio n. 23
0
 public bool str_add_constraint(string row_string, lpsolve_constr_types constr_type, double rh)
 {
     return(Interop.str_add_constraint(_lp, row_string, constr_type, rh));
 }
Esempio n. 24
0
 [DllImport("lpsolve55.dll", SetLastError=true)] public static extern bool str_add_lag_con(int lp, string row_string, lpsolve_constr_types con_type, double rhs);
Esempio n. 25
0
 private void AddRowConstraint(double[] row, lpsolve_constr_types type = lpsolve_constr_types.EQ, double val = 0)
 {
     Rows++;
     if (!LpSolvePointer.add_constraint(row, type, val))
     {
         throw new InvalidOperationException();
     }
 }
Esempio n. 26
0
 private static string ToFbcString(lpsolve_constr_types op)
 {
     switch (op)
       {
     case lpsolve_constr_types.LE:
       return "lessEqual";
     case lpsolve_constr_types.EQ:
     default:
       return "equal";
     case lpsolve_constr_types.GE:
       return "greaterEqual";
       }
 }
Esempio n. 27
0
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool add_constraintex(int lp, int count, ref double row, ref int colno, lpsolve_constr_types constr_type, double rh);
Esempio n. 28
0
 public LPsolveConstraint(XmlElement item)
 {
     _sbmlId = item.GetAttribute("reaction", FluxBalance.STR_FBA_NAMESPACE);
     _value = Convert.ToDouble(item.GetAttribute("value", FluxBalance.STR_FBA_NAMESPACE));
     _Operator = GetOperator(item.GetAttribute("operation", FluxBalance.STR_FBA_NAMESPACE));
 }
Esempio n. 29
0
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool str_add_lag_con(int lp, string row_string, lpsolve_constr_types con_type, double rhs);
Esempio n. 30
0
 public LPsolveConstraint(string sbmlId, lpsolve_constr_types sOperator, double value)
 {
     _sbmlId = sbmlId;
     _Operator = sOperator;
     _value = value;
 }
Esempio n. 31
0
 public static extern bool add_constraintex(IntPtr lp, int count, double[] row, int[] colno, lpsolve_constr_types constr_type, double rh);
Esempio n. 32
0
 private string GetOperationString(lpsolve_constr_types type)
 {
     switch (type)
     {
         case lpsolve_constr_types.LE:
             return "less";
         case lpsolve_constr_types.EQ:
             return "equal";
         case lpsolve_constr_types.GE:
         default:
             return "greater";
     }
 }
Esempio n. 33
0
 public static extern bool set_constr_type(IntPtr lp, int row, lpsolve_constr_types con_type);
Esempio n. 34
0
 public static extern bool add_lag_con(int lp, ref double row, lpsolve_constr_types con_type, double rhs);
Esempio n. 35
0
 public static extern bool str_add_lag_con(IntPtr lp, string row_string, lpsolve_constr_types con_type, double rhs);
Esempio n. 36
0
 public static extern bool str_add_constraint(int lp, string row_string, lpsolve_constr_types constr_type,
                                              double rh);
Esempio n. 37
0
 public static extern bool add_constraintex(int lp, int count, ref double row, ref int colno,
                                            lpsolve_constr_types constr_type, double rh);
 [DllImport("lpsolve55.dll", SetLastError = true)] public static extern bool add_lag_con(IntPtr lp, double[] row, lpsolve_constr_types con_type, double rhs);
Esempio n. 39
0
 public static extern bool set_constr_type(int lp, int row, lpsolve_constr_types con_type);
Esempio n. 40
0
 public static extern byte str_add_lag_con(IntPtr lp, [MarshalAs(UnmanagedType.LPStr)] string row_string, lpsolve_constr_types con_type, double rhs);
Esempio n. 41
0
 public static extern bool str_add_lag_con(int lp, string row_string, lpsolve_constr_types con_type, double rhs);
Esempio n. 42
0
 public bool add_constraint(double[] row, lpsolve_constr_types constr_type, double rh)
 {
     return(Interop.add_constraint(_lp, row, constr_type, rh));
 }