This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// うみねこのなく頃に8 のベルンの挑戦のAlloyモデル | |
abstract sig Person { kill : set Person } | |
one sig | |
Krauss, Natsuhi, Jessica, | |
Eva, Hideyoshi, George, | |
Rudolf, Kyrie, Battler, | |
Rosa, Maria, | |
Nanjo, | |
Genji, Shannon, Kanon, Gouda, Kumasawa | |
extends Person {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 失敗版 | |
sig Coin {} | |
abstract sig State { | |
candidates : set Coin, | |
} | |
sig Branch extends State { | |
left, right : set Coin, | |
eq, lt, gt : State |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
----------------------------------------------------------------------------- | |
-- | | |
-- Module : FourierMotzkin | |
-- Copyright : (c) Masahiro Sakai 2011 | |
-- License : BSD-style | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : provisional | |
-- Portability : portable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# OPTIONS_GHC -Wall #-} | |
----------------------------------------------------------------------------- | |
-- | | |
-- Module : Simplex | |
-- Copyright : (c) Masahiro Sakai 2011 | |
-- License : BSD-style | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : provisional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
----------------------------------------------------------------------------- | |
-- | | |
-- Module : Cooper | |
-- Copyright : (c) Masahiro Sakai 2011 | |
-- License : BSD-style | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : provisional | |
-- Portability : portable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind #-} | |
----------------------------------------------------------------------------- | |
-- | | |
-- Module : LPFile | |
-- Copyright : (c) Masahiro Sakai 2011 | |
-- License : BSD-style | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : provisional | |
-- Portability : portable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type S = ((Int,Int),(Int,Int),(Int,Int)) | |
guess :: S -> S | |
guess ((a1,a2),(b1,b2),(c1,c2)) = | |
case (a1+b1) `compare` (b2+c1) of | |
EQ -> | |
if b1 < b2 | |
then ((100,99),(99,100),(99,100)) | |
else ((99,100),(100,99),(100,99)) | |
LT -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SATSolver | |
def initialize | |
@cnt = 0 | |
@ok = true | |
@clauses = [] | |
@model = Hash.new | |
@watches = Hash.new | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module TseitinEncoding | |
( Var | |
, Lit | |
, Clause | |
, CNF | |
, Formula | |
, CNFGenMonad (..) | |
, emitFormula | |
, CNFGen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TuplingExample where | |
import Prelude hiding (even, odd) | |
even :: Int -> Bool | |
even n = if n==0 then True else odd (n-1) | |
odd :: Int -> Bool | |
odd n = if n==0 then False else even (n-1) |
OlderNewer