.Net: fix few contrib samples
This commit is contained in:
@@ -16,7 +16,10 @@ limitations under the License.
|
||||
open Google.OrTools.FSharp
|
||||
|
||||
let profits = [ 360L; 83L; 59L; 130L; 431L; 67L; 230L; 52L; 93L; 125L; 670L; 892L; 600L; 38L; 48L; 147L; 78L; 256L; 63L; 17L; 120L; 164L; 432L; 35L; 92L; 110L; 22L; 42L; 50L; 323L; 514L; 28L; 87L; 73L; 78L; 15L; 26L; 78L; 210L; 36L; 85L; 189L; 274L; 43L; 33L; 10L; 19L; 389L; 276L; 312L ]
|
||||
let weights = [ 7L; 0L; 30L; 22L; 80L; 94L; 11L; 81L; 70L; 64L; 59L; 18L; 0L; 36L; 3L; 8L; 15L; 42L; 9L; 0L; 42L; 47L; 52L; 32L; 26L; 48L; 55L; 6L; 29L; 84L; 2L; 4L; 18L; 56L; 7L; 29L; 93L; 44L; 71L; 3L; 86L; 66L; 31L; 65L; 0L; 79L; 20L; 65L; 52L; 13L ]
|
||||
let weights = array2D [ [ 7L; 0L; 30L; 22L; 80L; 94L; 11L; 81L; 70L; 64L; 59L; 18L; 0L;
|
||||
36L; 3L; 8L; 15L; 42L; 9L; 0L; 42L; 47L; 52L; 32L; 26L; 48L; 55L; 6L; 29L; 84L;
|
||||
2L; 4L; 18L; 56L; 7L; 29L; 93L; 44L; 71L; 3L; 86L; 66L; 31L; 65L; 0L; 79L; 20L;
|
||||
65L; 52L; 13L ] ]
|
||||
let capacities = [ 850L ]
|
||||
|
||||
printfn "Solving knapsack with %i items and %i dimensions" (profits.Length) (weights.Length)
|
||||
|
||||
@@ -87,21 +87,22 @@ public class NurseRostering
|
||||
// For TransitionConstraint
|
||||
IntTupleSet transition_tuples = new IntTupleSet(3);
|
||||
// state, input, next state
|
||||
transition_tuples.InsertAll(new int[,] { {1,1,2},
|
||||
{1,2,3},
|
||||
{1,3,1},
|
||||
{2,1,4},
|
||||
{2,2,4},
|
||||
{2,3,1},
|
||||
{3,1,4},
|
||||
{3,2,5},
|
||||
{3,3,1},
|
||||
{4,1,6},
|
||||
{4,2,6},
|
||||
{4,3,1},
|
||||
{5,1,6},
|
||||
{5,3,1},
|
||||
{6,3,1} });
|
||||
transition_tuples.InsertAll(new long[][] {
|
||||
new long[] {1,1,2},
|
||||
new long[] {1,2,3},
|
||||
new long[] {1,3,1},
|
||||
new long[] {2,1,4},
|
||||
new long[] {2,2,4},
|
||||
new long[] {2,3,1},
|
||||
new long[] {3,1,4},
|
||||
new long[] {3,2,5},
|
||||
new long[] {3,3,1},
|
||||
new long[] {4,1,6},
|
||||
new long[] {4,2,6},
|
||||
new long[] {4,3,1},
|
||||
new long[] {5,1,6},
|
||||
new long[] {5,3,1},
|
||||
new long[] {6,3,1} });
|
||||
|
||||
string[] days = {"d","n","o"}; // for presentation
|
||||
|
||||
|
||||
@@ -80,10 +80,11 @@ public class TrafficLights
|
||||
|
||||
// The allowed combinations
|
||||
IntTupleSet allowed = new IntTupleSet(4);
|
||||
allowed.InsertAll(new int[,] {{r,r,g,g},
|
||||
{ry,r,y,r},
|
||||
{g,g,r,r},
|
||||
{y,r,ry,r}});
|
||||
allowed.InsertAll(new long[][] {
|
||||
new long[] {r,r,g,g},
|
||||
new long[] {ry,r,y,r},
|
||||
new long[] {g,g,r,r},
|
||||
new long[] {y,r,ry,r}});
|
||||
//
|
||||
// Decision variables
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user